@hattoriai/poney 0.1.1 → 0.2.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.
@@ -1,889 +0,0 @@
1
- var PA=Object.defineProperty;var DA=(t,e,n)=>e in t?PA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var en=(t,e,n)=>DA(t,typeof e!="symbol"?e+"":e,n);function zA(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var mG=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function NS(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ES={exports:{}},Jh={},$S={exports:{}},De={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var md=Symbol.for("react.element"),LA=Symbol.for("react.portal"),FA=Symbol.for("react.fragment"),BA=Symbol.for("react.strict_mode"),VA=Symbol.for("react.profiler"),WA=Symbol.for("react.provider"),UA=Symbol.for("react.context"),ZA=Symbol.for("react.forward_ref"),HA=Symbol.for("react.suspense"),qA=Symbol.for("react.memo"),KA=Symbol.for("react.lazy"),M0=Symbol.iterator;function JA(t){return t===null||typeof t!="object"?null:(t=M0&&t[M0]||t["@@iterator"],typeof t=="function"?t:null)}var MS={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},TS=Object.assign,OS={};function hl(t,e,n){this.props=t,this.context=e,this.refs=OS,this.updater=n||MS}hl.prototype.isReactComponent={};hl.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};hl.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function AS(){}AS.prototype=hl.prototype;function Gx(t,e,n){this.props=t,this.context=e,this.refs=OS,this.updater=n||MS}var Yx=Gx.prototype=new AS;Yx.constructor=Gx;TS(Yx,hl.prototype);Yx.isPureReactComponent=!0;var T0=Array.isArray,RS=Object.prototype.hasOwnProperty,Qx={current:null},IS={key:!0,ref:!0,__self:!0,__source:!0};function PS(t,e,n){var r,s={},i=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)RS.call(e,r)&&!IS.hasOwnProperty(r)&&(s[r]=e[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];s.children=l}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)s[r]===void 0&&(s[r]=a[r]);return{$$typeof:md,type:t,key:i,ref:o,props:s,_owner:Qx.current}}function GA(t,e){return{$$typeof:md,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Xx(t){return typeof t=="object"&&t!==null&&t.$$typeof===md}function YA(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var O0=/\/+/g;function Jp(t,e){return typeof t=="object"&&t!==null&&t.key!=null?YA(""+t.key):e.toString(36)}function Mu(t,e,n,r,s){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case md:case LA:o=!0}}if(o)return o=t,s=s(o),t=r===""?"."+Jp(o,0):r,T0(s)?(n="",t!=null&&(n=t.replace(O0,"$&/")+"/"),Mu(s,e,n,"",function(c){return c})):s!=null&&(Xx(s)&&(s=GA(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(O0,"$&/")+"/")+t)),e.push(s)),1;if(o=0,r=r===""?".":r+":",T0(t))for(var a=0;a<t.length;a++){i=t[a];var l=r+Jp(i,a);o+=Mu(i,e,n,l,s)}else if(l=JA(t),typeof l=="function")for(t=l.call(t),a=0;!(i=t.next()).done;)i=i.value,l=r+Jp(i,a++),o+=Mu(i,e,n,l,s);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function Wd(t,e,n){if(t==null)return t;var r=[],s=0;return Mu(t,r,"","",function(i){return e.call(n,i,s++)}),r}function QA(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var wn={current:null},Tu={transition:null},XA={ReactCurrentDispatcher:wn,ReactCurrentBatchConfig:Tu,ReactCurrentOwner:Qx};function DS(){throw Error("act(...) is not supported in production builds of React.")}De.Children={map:Wd,forEach:function(t,e,n){Wd(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Wd(t,function(){e++}),e},toArray:function(t){return Wd(t,function(e){return e})||[]},only:function(t){if(!Xx(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};De.Component=hl;De.Fragment=FA;De.Profiler=VA;De.PureComponent=Gx;De.StrictMode=BA;De.Suspense=HA;De.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=XA;De.act=DS;De.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=TS({},t.props),s=t.key,i=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=Qx.current),e.key!==void 0&&(s=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)RS.call(e,l)&&!IS.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:md,type:t.type,key:s,ref:i,props:r,_owner:o}};De.createContext=function(t){return t={$$typeof:UA,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:WA,_context:t},t.Consumer=t};De.createElement=PS;De.createFactory=function(t){var e=PS.bind(null,t);return e.type=t,e};De.createRef=function(){return{current:null}};De.forwardRef=function(t){return{$$typeof:ZA,render:t}};De.isValidElement=Xx;De.lazy=function(t){return{$$typeof:KA,_payload:{_status:-1,_result:t},_init:QA}};De.memo=function(t,e){return{$$typeof:qA,type:t,compare:e===void 0?null:e}};De.startTransition=function(t){var e=Tu.transition;Tu.transition={};try{t()}finally{Tu.transition=e}};De.unstable_act=DS;De.useCallback=function(t,e){return wn.current.useCallback(t,e)};De.useContext=function(t){return wn.current.useContext(t)};De.useDebugValue=function(){};De.useDeferredValue=function(t){return wn.current.useDeferredValue(t)};De.useEffect=function(t,e){return wn.current.useEffect(t,e)};De.useId=function(){return wn.current.useId()};De.useImperativeHandle=function(t,e,n){return wn.current.useImperativeHandle(t,e,n)};De.useInsertionEffect=function(t,e){return wn.current.useInsertionEffect(t,e)};De.useLayoutEffect=function(t,e){return wn.current.useLayoutEffect(t,e)};De.useMemo=function(t,e){return wn.current.useMemo(t,e)};De.useReducer=function(t,e,n){return wn.current.useReducer(t,e,n)};De.useRef=function(t){return wn.current.useRef(t)};De.useState=function(t){return wn.current.useState(t)};De.useSyncExternalStore=function(t,e,n){return wn.current.useSyncExternalStore(t,e,n)};De.useTransition=function(){return wn.current.useTransition()};De.version="18.3.1";$S.exports=De;var b=$S.exports;const wr=NS(b),pl=zA({__proto__:null,default:wr},[b]);/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var e3=b,t3=Symbol.for("react.element"),n3=Symbol.for("react.fragment"),r3=Object.prototype.hasOwnProperty,s3=e3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i3={key:!0,ref:!0,__self:!0,__source:!0};function zS(t,e,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)r3.call(e,r)&&!i3.hasOwnProperty(r)&&(s[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)s[r]===void 0&&(s[r]=e[r]);return{$$typeof:t3,type:t,key:i,ref:o,props:s,_owner:s3.current}}Jh.Fragment=n3;Jh.jsx=zS;Jh.jsxs=zS;ES.exports=Jh;var d=ES.exports,LS={exports:{}},Kn={},FS={exports:{}},BS={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */(function(t){function e(I,L){var K=I.length;I.push(L);e:for(;0<K;){var ne=K-1>>>1,D=I[ne];if(0<s(D,L))I[ne]=L,I[K]=D,K=ne;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var L=I[0],K=I.pop();if(K!==L){I[0]=K;e:for(var ne=0,D=I.length,z=D>>>1;ne<z;){var B=2*(ne+1)-1,H=I[B],$=B+1,A=I[$];if(0>s(H,K))$<D&&0>s(A,H)?(I[ne]=A,I[$]=K,ne=$):(I[ne]=H,I[B]=K,ne=B);else if($<D&&0>s(A,K))I[ne]=A,I[$]=K,ne=$;else break e}}return L}function s(I,L){var K=I.sortIndex-L.sortIndex;return K!==0?K:I.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,f=null,h=3,m=!1,g=!1,p=!1,x=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(I){for(var L=n(c);L!==null;){if(L.callback===null)r(c);else if(L.startTime<=I)r(c),L.sortIndex=L.expirationTime,e(l,L);else break;L=n(c)}}function w(I){if(p=!1,k(I),!g)if(n(l)!==null)g=!0,O(j);else{var L=n(c);L!==null&&R(w,L.startTime-I)}}function j(I,L){g=!1,p&&(p=!1,y(S),S=-1),m=!0;var K=h;try{for(k(L),f=n(l);f!==null&&(!(f.expirationTime>L)||I&&!M());){var ne=f.callback;if(typeof ne=="function"){f.callback=null,h=f.priorityLevel;var D=ne(f.expirationTime<=L);L=t.unstable_now(),typeof D=="function"?f.callback=D:f===n(l)&&r(l),k(L)}else r(l);f=n(l)}if(f!==null)var z=!0;else{var B=n(c);B!==null&&R(w,B.startTime-L),z=!1}return z}finally{f=null,h=K,m=!1}}var C=!1,E=null,S=-1,_=5,N=-1;function M(){return!(t.unstable_now()-N<_)}function P(){if(E!==null){var I=t.unstable_now();N=I;var L=!0;try{L=E(!0,I)}finally{L?V():(C=!1,E=null)}}else C=!1}var V;if(typeof v=="function")V=function(){v(P)};else if(typeof MessageChannel<"u"){var Z=new MessageChannel,Y=Z.port2;Z.port1.onmessage=P,V=function(){Y.postMessage(null)}}else V=function(){x(P,0)};function O(I){E=I,C||(C=!0,V())}function R(I,L){S=x(function(){I(t.unstable_now())},L)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(I){I.callback=null},t.unstable_continueExecution=function(){g||m||(g=!0,O(j))},t.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<I?Math.floor(1e3/I):5},t.unstable_getCurrentPriorityLevel=function(){return h},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(I){switch(h){case 1:case 2:case 3:var L=3;break;default:L=h}var K=h;h=L;try{return I()}finally{h=K}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(I,L){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var K=h;h=I;try{return L()}finally{h=K}},t.unstable_scheduleCallback=function(I,L,K){var ne=t.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?ne+K:ne):K=ne,I){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=K+D,I={id:u++,callback:L,priorityLevel:I,startTime:K,expirationTime:D,sortIndex:-1},K>ne?(I.sortIndex=K,e(c,I),n(l)===null&&I===n(c)&&(p?(y(S),S=-1):p=!0,R(w,K-ne))):(I.sortIndex=D,e(l,I),g||m||(g=!0,O(j))),I},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(I){var L=h;return function(){var K=h;h=L;try{return I.apply(this,arguments)}finally{h=K}}}})(BS);FS.exports=BS;var o3=FS.exports;/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var a3=b,Zn=o3;function Q(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var VS=new Set,Nc={};function Io(t,e){Aa(t,e),Aa(t+"Capture",e)}function Aa(t,e){for(Nc[t]=e,t=0;t<e.length;t++)VS.add(e[t])}var _s=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cg=Object.prototype.hasOwnProperty,l3=/^[: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]*$/,A0={},R0={};function c3(t){return Cg.call(R0,t)?!0:Cg.call(A0,t)?!1:l3.test(t)?R0[t]=!0:(A0[t]=!0,!1)}function d3(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function u3(t,e,n,r){if(e===null||typeof e>"u"||d3(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function bn(t,e,n,r,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var Yt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Yt[t]=new bn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Yt[e]=new bn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Yt[t]=new bn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Yt[t]=new bn(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Yt[t]=new bn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Yt[t]=new bn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Yt[t]=new bn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Yt[t]=new bn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Yt[t]=new bn(t,5,!1,t.toLowerCase(),null,!1,!1)});var ev=/[\-:]([a-z])/g;function tv(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(ev,tv);Yt[e]=new bn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(ev,tv);Yt[e]=new bn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(ev,tv);Yt[e]=new bn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Yt[t]=new bn(t,1,!1,t.toLowerCase(),null,!1,!1)});Yt.xlinkHref=new bn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Yt[t]=new bn(t,1,!1,t.toLowerCase(),null,!0,!0)});function nv(t,e,n,r){var s=Yt.hasOwnProperty(e)?Yt[e]:null;(s!==null?s.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(u3(e,n,s,r)&&(n=null),r||s===null?c3(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):s.mustUseProperty?t[s.propertyName]=n===null?s.type===3?!1:"":n:(e=s.attributeName,r=s.attributeNamespace,n===null?t.removeAttribute(e):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var Is=a3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ud=Symbol.for("react.element"),ca=Symbol.for("react.portal"),da=Symbol.for("react.fragment"),rv=Symbol.for("react.strict_mode"),_g=Symbol.for("react.profiler"),WS=Symbol.for("react.provider"),US=Symbol.for("react.context"),sv=Symbol.for("react.forward_ref"),Ng=Symbol.for("react.suspense"),Eg=Symbol.for("react.suspense_list"),iv=Symbol.for("react.memo"),Ws=Symbol.for("react.lazy"),ZS=Symbol.for("react.offscreen"),I0=Symbol.iterator;function _l(t){return t===null||typeof t!="object"?null:(t=I0&&t[I0]||t["@@iterator"],typeof t=="function"?t:null)}var ut=Object.assign,Gp;function Ul(t){if(Gp===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Gp=e&&e[1]||""}return`
34
- `+Gp+t}var Yp=!1;function Qp(t,e){if(!t||Yp)return"";Yp=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var r=c}Reflect.construct(t,[],e)}else{try{e.call()}catch(c){r=c}t.call(e.prototype)}else{try{throw Error()}catch(c){r=c}t()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var s=c.stack.split(`
35
- `),i=r.stack.split(`
36
- `),o=s.length-1,a=i.length-1;1<=o&&0<=a&&s[o]!==i[a];)a--;for(;1<=o&&0<=a;o--,a--)if(s[o]!==i[a]){if(o!==1||a!==1)do if(o--,a--,0>a||s[o]!==i[a]){var l=`
37
- `+s[o].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{Yp=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Ul(t):""}function f3(t){switch(t.tag){case 5:return Ul(t.type);case 16:return Ul("Lazy");case 13:return Ul("Suspense");case 19:return Ul("SuspenseList");case 0:case 2:case 15:return t=Qp(t.type,!1),t;case 11:return t=Qp(t.type.render,!1),t;case 1:return t=Qp(t.type,!0),t;default:return""}}function $g(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case da:return"Fragment";case ca:return"Portal";case _g:return"Profiler";case rv:return"StrictMode";case Ng:return"Suspense";case Eg:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case US:return(t.displayName||"Context")+".Consumer";case WS:return(t._context.displayName||"Context")+".Provider";case sv:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case iv:return e=t.displayName||null,e!==null?e:$g(t.type)||"Memo";case Ws:e=t._payload,t=t._init;try{return $g(t(e))}catch{}}return null}function h3(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return $g(e);case 8:return e===rv?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Si(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function HS(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function p3(t){var e=HS(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Zd(t){t._valueTracker||(t._valueTracker=p3(t))}function qS(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=HS(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function ef(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Mg(t,e){var n=e.checked;return ut({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function P0(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Si(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function KS(t,e){e=e.checked,e!=null&&nv(t,"checked",e,!1)}function Tg(t,e){KS(t,e);var n=Si(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Og(t,e.type,n):e.hasOwnProperty("defaultValue")&&Og(t,e.type,Si(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function D0(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Og(t,e,n){(e!=="number"||ef(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Zl=Array.isArray;function Sa(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s<n.length;s++)e["$"+n[s]]=!0;for(n=0;n<t.length;n++)s=e.hasOwnProperty("$"+t[n].value),t[n].selected!==s&&(t[n].selected=s),s&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Si(n),e=null,s=0;s<t.length;s++){if(t[s].value===n){t[s].selected=!0,r&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function Ag(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Q(91));return ut({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function z0(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(Q(92));if(Zl(n)){if(1<n.length)throw Error(Q(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Si(n)}}function JS(t,e){var n=Si(e.value),r=Si(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function L0(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function GS(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Rg(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?GS(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Hd,YS=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,s){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Hd=Hd||document.createElement("div"),Hd.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Hd.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ec(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var sc={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},m3=["Webkit","ms","Moz","O"];Object.keys(sc).forEach(function(t){m3.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),sc[e]=sc[t]})});function QS(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||sc.hasOwnProperty(t)&&sc[t]?(""+e).trim():e+"px"}function XS(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=QS(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var g3=ut({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ig(t,e){if(e){if(g3[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Q(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Q(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Q(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Q(62))}}function Pg(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 Dg=null;function ov(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var zg=null,ja=null,Ca=null;function F0(t){if(t=xd(t)){if(typeof zg!="function")throw Error(Q(280));var e=t.stateNode;e&&(e=ep(e),zg(t.stateNode,t.type,e))}}function ej(t){ja?Ca?Ca.push(t):Ca=[t]:ja=t}function tj(){if(ja){var t=ja,e=Ca;if(Ca=ja=null,F0(t),e)for(t=0;t<e.length;t++)F0(e[t])}}function nj(t,e){return t(e)}function rj(){}var Xp=!1;function sj(t,e,n){if(Xp)return t(e,n);Xp=!0;try{return nj(t,e,n)}finally{Xp=!1,(ja!==null||Ca!==null)&&(rj(),tj())}}function $c(t,e){var n=t.stateNode;if(n===null)return null;var r=ep(n);if(r===null)return null;n=r[e];e:switch(e){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)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(Q(231,e,typeof n));return n}var Lg=!1;if(_s)try{var Nl={};Object.defineProperty(Nl,"passive",{get:function(){Lg=!0}}),window.addEventListener("test",Nl,Nl),window.removeEventListener("test",Nl,Nl)}catch{Lg=!1}function y3(t,e,n,r,s,i,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(u){this.onError(u)}}var ic=!1,tf=null,nf=!1,Fg=null,x3={onError:function(t){ic=!0,tf=t}};function v3(t,e,n,r,s,i,o,a,l){ic=!1,tf=null,y3.apply(x3,arguments)}function k3(t,e,n,r,s,i,o,a,l){if(v3.apply(this,arguments),ic){if(ic){var c=tf;ic=!1,tf=null}else throw Error(Q(198));nf||(nf=!0,Fg=c)}}function Po(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function ij(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function B0(t){if(Po(t)!==t)throw Error(Q(188))}function w3(t){var e=t.alternate;if(!e){if(e=Po(t),e===null)throw Error(Q(188));return e!==t?null:t}for(var n=t,r=e;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return B0(s),t;if(i===r)return B0(s),e;i=i.sibling}throw Error(Q(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o)throw Error(Q(189))}}if(n.alternate!==r)throw Error(Q(190))}if(n.tag!==3)throw Error(Q(188));return n.stateNode.current===n?t:e}function oj(t){return t=w3(t),t!==null?aj(t):null}function aj(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=aj(t);if(e!==null)return e;t=t.sibling}return null}var lj=Zn.unstable_scheduleCallback,V0=Zn.unstable_cancelCallback,b3=Zn.unstable_shouldYield,S3=Zn.unstable_requestPaint,yt=Zn.unstable_now,j3=Zn.unstable_getCurrentPriorityLevel,av=Zn.unstable_ImmediatePriority,cj=Zn.unstable_UserBlockingPriority,rf=Zn.unstable_NormalPriority,C3=Zn.unstable_LowPriority,dj=Zn.unstable_IdlePriority,Gh=null,Hr=null;function _3(t){if(Hr&&typeof Hr.onCommitFiberRoot=="function")try{Hr.onCommitFiberRoot(Gh,t,void 0,(t.current.flags&128)===128)}catch{}}var br=Math.clz32?Math.clz32:$3,N3=Math.log,E3=Math.LN2;function $3(t){return t>>>=0,t===0?32:31-(N3(t)/E3|0)|0}var qd=64,Kd=4194304;function Hl(t){switch(t&-t){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: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&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function sf(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,i=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=Hl(a):(i&=o,i!==0&&(r=Hl(i)))}else o=n&~s,o!==0?r=Hl(o):i!==0&&(r=Hl(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-br(e),s=1<<n,r|=t[n],e&=~s;return r}function M3(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64: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 e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function T3(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,s=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-br(i),a=1<<o,l=s[o];l===-1?(!(a&n)||a&r)&&(s[o]=M3(a,e)):l<=e&&(t.expiredLanes|=a),i&=~a}}function Bg(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function uj(){var t=qd;return qd<<=1,!(qd&4194240)&&(qd=64),t}function em(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function gd(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-br(e),t[e]=n}function O3(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var s=31-br(n),i=1<<s;e[s]=0,r[s]=-1,t[s]=-1,n&=~i}}function lv(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-br(n),s=1<<r;s&e|t[r]&e&&(t[r]|=e),n&=~s}}var Je=0;function fj(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var hj,cv,pj,mj,gj,Vg=!1,Jd=[],oi=null,ai=null,li=null,Mc=new Map,Tc=new Map,Gs=[],A3="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 submit".split(" ");function W0(t,e){switch(t){case"focusin":case"focusout":oi=null;break;case"dragenter":case"dragleave":ai=null;break;case"mouseover":case"mouseout":li=null;break;case"pointerover":case"pointerout":Mc.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Tc.delete(e.pointerId)}}function El(t,e,n,r,s,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},e!==null&&(e=xd(e),e!==null&&cv(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function R3(t,e,n,r,s){switch(e){case"focusin":return oi=El(oi,t,e,n,r,s),!0;case"dragenter":return ai=El(ai,t,e,n,r,s),!0;case"mouseover":return li=El(li,t,e,n,r,s),!0;case"pointerover":var i=s.pointerId;return Mc.set(i,El(Mc.get(i)||null,t,e,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Tc.set(i,El(Tc.get(i)||null,t,e,n,r,s)),!0}return!1}function yj(t){var e=Ki(t.target);if(e!==null){var n=Po(e);if(n!==null){if(e=n.tag,e===13){if(e=ij(n),e!==null){t.blockedOn=e,gj(t.priority,function(){pj(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Ou(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Wg(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);Dg=r,n.target.dispatchEvent(r),Dg=null}else return e=xd(n),e!==null&&cv(e),t.blockedOn=n,!1;e.shift()}return!0}function U0(t,e,n){Ou(t)&&n.delete(e)}function I3(){Vg=!1,oi!==null&&Ou(oi)&&(oi=null),ai!==null&&Ou(ai)&&(ai=null),li!==null&&Ou(li)&&(li=null),Mc.forEach(U0),Tc.forEach(U0)}function $l(t,e){t.blockedOn===e&&(t.blockedOn=null,Vg||(Vg=!0,Zn.unstable_scheduleCallback(Zn.unstable_NormalPriority,I3)))}function Oc(t){function e(s){return $l(s,t)}if(0<Jd.length){$l(Jd[0],t);for(var n=1;n<Jd.length;n++){var r=Jd[n];r.blockedOn===t&&(r.blockedOn=null)}}for(oi!==null&&$l(oi,t),ai!==null&&$l(ai,t),li!==null&&$l(li,t),Mc.forEach(e),Tc.forEach(e),n=0;n<Gs.length;n++)r=Gs[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Gs.length&&(n=Gs[0],n.blockedOn===null);)yj(n),n.blockedOn===null&&Gs.shift()}var _a=Is.ReactCurrentBatchConfig,of=!0;function P3(t,e,n,r){var s=Je,i=_a.transition;_a.transition=null;try{Je=1,dv(t,e,n,r)}finally{Je=s,_a.transition=i}}function D3(t,e,n,r){var s=Je,i=_a.transition;_a.transition=null;try{Je=4,dv(t,e,n,r)}finally{Je=s,_a.transition=i}}function dv(t,e,n,r){if(of){var s=Wg(t,e,n,r);if(s===null)dm(t,e,r,af,n),W0(t,r);else if(R3(s,t,e,n,r))r.stopPropagation();else if(W0(t,r),e&4&&-1<A3.indexOf(t)){for(;s!==null;){var i=xd(s);if(i!==null&&hj(i),i=Wg(t,e,n,r),i===null&&dm(t,e,r,af,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else dm(t,e,r,null,n)}}var af=null;function Wg(t,e,n,r){if(af=null,t=ov(r),t=Ki(t),t!==null)if(e=Po(t),e===null)t=null;else if(n=e.tag,n===13){if(t=ij(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return af=t,null}function xj(t){switch(t){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(j3()){case av:return 1;case cj:return 4;case rf:case C3:return 16;case dj:return 536870912;default:return 16}default:return 16}}var ti=null,uv=null,Au=null;function vj(){if(Au)return Au;var t,e=uv,n=e.length,r,s="value"in ti?ti.value:ti.textContent,i=s.length;for(t=0;t<n&&e[t]===s[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===s[i-r];r++);return Au=s.slice(t,1<r?1-r:void 0)}function Ru(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Gd(){return!0}function Z0(){return!1}function Jn(t){function e(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Gd:Z0,this.isPropagationStopped=Z0,this}return ut(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Gd)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Gd)},persist:function(){},isPersistent:Gd}),e}var ml={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fv=Jn(ml),yd=ut({},ml,{view:0,detail:0}),z3=Jn(yd),tm,nm,Ml,Yh=ut({},yd,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hv,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ml&&(Ml&&t.type==="mousemove"?(tm=t.screenX-Ml.screenX,nm=t.screenY-Ml.screenY):nm=tm=0,Ml=t),tm)},movementY:function(t){return"movementY"in t?t.movementY:nm}}),H0=Jn(Yh),L3=ut({},Yh,{dataTransfer:0}),F3=Jn(L3),B3=ut({},yd,{relatedTarget:0}),rm=Jn(B3),V3=ut({},ml,{animationName:0,elapsedTime:0,pseudoElement:0}),W3=Jn(V3),U3=ut({},ml,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Z3=Jn(U3),H3=ut({},ml,{data:0}),q0=Jn(H3),q3={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},K3={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"},J3={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function G3(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=J3[t])?!!e[t]:!1}function hv(){return G3}var Y3=ut({},yd,{key:function(t){if(t.key){var e=q3[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Ru(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?K3[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hv,charCode:function(t){return t.type==="keypress"?Ru(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ru(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Q3=Jn(Y3),X3=ut({},Yh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),K0=Jn(X3),e5=ut({},yd,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hv}),t5=Jn(e5),n5=ut({},ml,{propertyName:0,elapsedTime:0,pseudoElement:0}),r5=Jn(n5),s5=ut({},Yh,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),i5=Jn(s5),o5=[9,13,27,32],pv=_s&&"CompositionEvent"in window,oc=null;_s&&"documentMode"in document&&(oc=document.documentMode);var a5=_s&&"TextEvent"in window&&!oc,kj=_s&&(!pv||oc&&8<oc&&11>=oc),J0=" ",G0=!1;function wj(t,e){switch(t){case"keyup":return o5.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bj(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ua=!1;function l5(t,e){switch(t){case"compositionend":return bj(e);case"keypress":return e.which!==32?null:(G0=!0,J0);case"textInput":return t=e.data,t===J0&&G0?null:t;default:return null}}function c5(t,e){if(ua)return t==="compositionend"||!pv&&wj(t,e)?(t=vj(),Au=uv=ti=null,ua=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return kj&&e.locale!=="ko"?null:e.data;default:return null}}var d5={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 Y0(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!d5[t.type]:e==="textarea"}function Sj(t,e,n,r){ej(r),e=lf(e,"onChange"),0<e.length&&(n=new fv("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var ac=null,Ac=null;function u5(t){Rj(t,0)}function Qh(t){var e=pa(t);if(qS(e))return t}function f5(t,e){if(t==="change")return e}var jj=!1;if(_s){var sm;if(_s){var im="oninput"in document;if(!im){var Q0=document.createElement("div");Q0.setAttribute("oninput","return;"),im=typeof Q0.oninput=="function"}sm=im}else sm=!1;jj=sm&&(!document.documentMode||9<document.documentMode)}function X0(){ac&&(ac.detachEvent("onpropertychange",Cj),Ac=ac=null)}function Cj(t){if(t.propertyName==="value"&&Qh(Ac)){var e=[];Sj(e,Ac,t,ov(t)),sj(u5,e)}}function h5(t,e,n){t==="focusin"?(X0(),ac=e,Ac=n,ac.attachEvent("onpropertychange",Cj)):t==="focusout"&&X0()}function p5(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Qh(Ac)}function m5(t,e){if(t==="click")return Qh(e)}function g5(t,e){if(t==="input"||t==="change")return Qh(e)}function y5(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var _r=typeof Object.is=="function"?Object.is:y5;function Rc(t,e){if(_r(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!Cg.call(e,s)||!_r(t[s],e[s]))return!1}return!0}function ek(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function tk(t,e){var n=ek(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ek(n)}}function _j(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?_j(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Nj(){for(var t=window,e=ef();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=ef(t.document)}return e}function mv(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function x5(t){var e=Nj(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&_j(n.ownerDocument.documentElement,n)){if(r!==null&&mv(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!t.extend&&i>r&&(s=r,r=i,i=s),s=tk(n,i);var o=tk(n,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var v5=_s&&"documentMode"in document&&11>=document.documentMode,fa=null,Ug=null,lc=null,Zg=!1;function nk(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Zg||fa==null||fa!==ef(r)||(r=fa,"selectionStart"in r&&mv(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}),lc&&Rc(lc,r)||(lc=r,r=lf(Ug,"onSelect"),0<r.length&&(e=new fv("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=fa)))}function Yd(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var ha={animationend:Yd("Animation","AnimationEnd"),animationiteration:Yd("Animation","AnimationIteration"),animationstart:Yd("Animation","AnimationStart"),transitionend:Yd("Transition","TransitionEnd")},om={},Ej={};_s&&(Ej=document.createElement("div").style,"AnimationEvent"in window||(delete ha.animationend.animation,delete ha.animationiteration.animation,delete ha.animationstart.animation),"TransitionEvent"in window||delete ha.transitionend.transition);function Xh(t){if(om[t])return om[t];if(!ha[t])return t;var e=ha[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Ej)return om[t]=e[n];return t}var $j=Xh("animationend"),Mj=Xh("animationiteration"),Tj=Xh("animationstart"),Oj=Xh("transitionend"),Aj=new Map,rk="abort auxClick 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(" ");function Pi(t,e){Aj.set(t,e),Io(e,[t])}for(var am=0;am<rk.length;am++){var lm=rk[am],k5=lm.toLowerCase(),w5=lm[0].toUpperCase()+lm.slice(1);Pi(k5,"on"+w5)}Pi($j,"onAnimationEnd");Pi(Mj,"onAnimationIteration");Pi(Tj,"onAnimationStart");Pi("dblclick","onDoubleClick");Pi("focusin","onFocus");Pi("focusout","onBlur");Pi(Oj,"onTransitionEnd");Aa("onMouseEnter",["mouseout","mouseover"]);Aa("onMouseLeave",["mouseout","mouseover"]);Aa("onPointerEnter",["pointerout","pointerover"]);Aa("onPointerLeave",["pointerout","pointerover"]);Io("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Io("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Io("onBeforeInput",["compositionend","keypress","textInput","paste"]);Io("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Io("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Io("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ql="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(" "),b5=new Set("cancel close invalid load scroll toggle".split(" ").concat(ql));function sk(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,k3(r,e,void 0,t),t.currentTarget=null}function Rj(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],s=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&s.isPropagationStopped())break e;sk(s,a,c),i=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&s.isPropagationStopped())break e;sk(s,a,c),i=l}}}if(nf)throw t=Fg,nf=!1,Fg=null,t}function tt(t,e){var n=e[Gg];n===void 0&&(n=e[Gg]=new Set);var r=t+"__bubble";n.has(r)||(Ij(e,t,2,!1),n.add(r))}function cm(t,e,n){var r=0;e&&(r|=4),Ij(n,t,r,e)}var Qd="_reactListening"+Math.random().toString(36).slice(2);function Ic(t){if(!t[Qd]){t[Qd]=!0,VS.forEach(function(n){n!=="selectionchange"&&(b5.has(n)||cm(n,!1,t),cm(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Qd]||(e[Qd]=!0,cm("selectionchange",!1,e))}}function Ij(t,e,n,r){switch(xj(e)){case 1:var s=P3;break;case 4:s=D3;break;default:s=dv}n=s.bind(null,e,n,t),s=void 0,!Lg||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),r?s!==void 0?t.addEventListener(e,n,{capture:!0,passive:s}):t.addEventListener(e,n,!0):s!==void 0?t.addEventListener(e,n,{passive:s}):t.addEventListener(e,n,!1)}function dm(t,e,n,r,s){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===s||a.nodeType===8&&a.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===s||l.nodeType===8&&l.parentNode===s))return;o=o.return}for(;a!==null;){if(o=Ki(a),o===null)return;if(l=o.tag,l===5||l===6){r=i=o;continue e}a=a.parentNode}}r=r.return}sj(function(){var c=i,u=ov(n),f=[];e:{var h=Aj.get(t);if(h!==void 0){var m=fv,g=t;switch(t){case"keypress":if(Ru(n)===0)break e;case"keydown":case"keyup":m=Q3;break;case"focusin":g="focus",m=rm;break;case"focusout":g="blur",m=rm;break;case"beforeblur":case"afterblur":m=rm;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=H0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=F3;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=t5;break;case $j:case Mj:case Tj:m=W3;break;case Oj:m=r5;break;case"scroll":m=z3;break;case"wheel":m=i5;break;case"copy":case"cut":case"paste":m=Z3;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=K0}var p=(e&4)!==0,x=!p&&t==="scroll",y=p?h!==null?h+"Capture":null:h;p=[];for(var v=c,k;v!==null;){k=v;var w=k.stateNode;if(k.tag===5&&w!==null&&(k=w,y!==null&&(w=$c(v,y),w!=null&&p.push(Pc(v,w,k)))),x)break;v=v.return}0<p.length&&(h=new m(h,g,null,n,u),f.push({event:h,listeners:p}))}}if(!(e&7)){e:{if(h=t==="mouseover"||t==="pointerover",m=t==="mouseout"||t==="pointerout",h&&n!==Dg&&(g=n.relatedTarget||n.fromElement)&&(Ki(g)||g[Ns]))break e;if((m||h)&&(h=u.window===u?u:(h=u.ownerDocument)?h.defaultView||h.parentWindow:window,m?(g=n.relatedTarget||n.toElement,m=c,g=g?Ki(g):null,g!==null&&(x=Po(g),g!==x||g.tag!==5&&g.tag!==6)&&(g=null)):(m=null,g=c),m!==g)){if(p=H0,w="onMouseLeave",y="onMouseEnter",v="mouse",(t==="pointerout"||t==="pointerover")&&(p=K0,w="onPointerLeave",y="onPointerEnter",v="pointer"),x=m==null?h:pa(m),k=g==null?h:pa(g),h=new p(w,v+"leave",m,n,u),h.target=x,h.relatedTarget=k,w=null,Ki(u)===c&&(p=new p(y,v+"enter",g,n,u),p.target=k,p.relatedTarget=x,w=p),x=w,m&&g)t:{for(p=m,y=g,v=0,k=p;k;k=Wo(k))v++;for(k=0,w=y;w;w=Wo(w))k++;for(;0<v-k;)p=Wo(p),v--;for(;0<k-v;)y=Wo(y),k--;for(;v--;){if(p===y||y!==null&&p===y.alternate)break t;p=Wo(p),y=Wo(y)}p=null}else p=null;m!==null&&ik(f,h,m,p,!1),g!==null&&x!==null&&ik(f,x,g,p,!0)}}e:{if(h=c?pa(c):window,m=h.nodeName&&h.nodeName.toLowerCase(),m==="select"||m==="input"&&h.type==="file")var j=f5;else if(Y0(h))if(jj)j=g5;else{j=p5;var C=h5}else(m=h.nodeName)&&m.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(j=m5);if(j&&(j=j(t,c))){Sj(f,j,n,u);break e}C&&C(t,h,c),t==="focusout"&&(C=h._wrapperState)&&C.controlled&&h.type==="number"&&Og(h,"number",h.value)}switch(C=c?pa(c):window,t){case"focusin":(Y0(C)||C.contentEditable==="true")&&(fa=C,Ug=c,lc=null);break;case"focusout":lc=Ug=fa=null;break;case"mousedown":Zg=!0;break;case"contextmenu":case"mouseup":case"dragend":Zg=!1,nk(f,n,u);break;case"selectionchange":if(v5)break;case"keydown":case"keyup":nk(f,n,u)}var E;if(pv)e:{switch(t){case"compositionstart":var S="onCompositionStart";break e;case"compositionend":S="onCompositionEnd";break e;case"compositionupdate":S="onCompositionUpdate";break e}S=void 0}else ua?wj(t,n)&&(S="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(S="onCompositionStart");S&&(kj&&n.locale!=="ko"&&(ua||S!=="onCompositionStart"?S==="onCompositionEnd"&&ua&&(E=vj()):(ti=u,uv="value"in ti?ti.value:ti.textContent,ua=!0)),C=lf(c,S),0<C.length&&(S=new q0(S,t,null,n,u),f.push({event:S,listeners:C}),E?S.data=E:(E=bj(n),E!==null&&(S.data=E)))),(E=a5?l5(t,n):c5(t,n))&&(c=lf(c,"onBeforeInput"),0<c.length&&(u=new q0("onBeforeInput","beforeinput",null,n,u),f.push({event:u,listeners:c}),u.data=E))}Rj(f,e)})}function Pc(t,e,n){return{instance:t,listener:e,currentTarget:n}}function lf(t,e){for(var n=e+"Capture",r=[];t!==null;){var s=t,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=$c(t,n),i!=null&&r.unshift(Pc(t,i,s)),i=$c(t,e),i!=null&&r.push(Pc(t,i,s))),t=t.return}return r}function Wo(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function ik(t,e,n,r,s){for(var i=e._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,s?(l=$c(n,i),l!=null&&o.unshift(Pc(n,l,a))):s||(l=$c(n,i),l!=null&&o.push(Pc(n,l,a)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var S5=/\r\n?/g,j5=/\u0000|\uFFFD/g;function ok(t){return(typeof t=="string"?t:""+t).replace(S5,`
38
- `).replace(j5,"")}function Xd(t,e,n){if(e=ok(e),ok(t)!==e&&n)throw Error(Q(425))}function cf(){}var Hg=null,qg=null;function Kg(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Jg=typeof setTimeout=="function"?setTimeout:void 0,C5=typeof clearTimeout=="function"?clearTimeout:void 0,ak=typeof Promise=="function"?Promise:void 0,_5=typeof queueMicrotask=="function"?queueMicrotask:typeof ak<"u"?function(t){return ak.resolve(null).then(t).catch(N5)}:Jg;function N5(t){setTimeout(function(){throw t})}function um(t,e){var n=e,r=0;do{var s=n.nextSibling;if(t.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){t.removeChild(s),Oc(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Oc(e)}function ci(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function lk(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var gl=Math.random().toString(36).slice(2),Br="__reactFiber$"+gl,Dc="__reactProps$"+gl,Ns="__reactContainer$"+gl,Gg="__reactEvents$"+gl,E5="__reactListeners$"+gl,$5="__reactHandles$"+gl;function Ki(t){var e=t[Br];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Ns]||n[Br]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=lk(t);t!==null;){if(n=t[Br])return n;t=lk(t)}return e}t=n,n=t.parentNode}return null}function xd(t){return t=t[Br]||t[Ns],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function pa(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(Q(33))}function ep(t){return t[Dc]||null}var Yg=[],ma=-1;function Di(t){return{current:t}}function st(t){0>ma||(t.current=Yg[ma],Yg[ma]=null,ma--)}function et(t,e){ma++,Yg[ma]=t.current,t.current=e}var ji={},dn=Di(ji),$n=Di(!1),fo=ji;function Ra(t,e){var n=t.type.contextTypes;if(!n)return ji;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Mn(t){return t=t.childContextTypes,t!=null}function df(){st($n),st(dn)}function ck(t,e,n){if(dn.current!==ji)throw Error(Q(168));et(dn,e),et($n,n)}function Pj(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(Q(108,h3(t)||"Unknown",s));return ut({},n,r)}function uf(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||ji,fo=dn.current,et(dn,t),et($n,$n.current),!0}function dk(t,e,n){var r=t.stateNode;if(!r)throw Error(Q(169));n?(t=Pj(t,e,fo),r.__reactInternalMemoizedMergedChildContext=t,st($n),st(dn),et(dn,t)):st($n),et($n,n)}var ps=null,tp=!1,fm=!1;function Dj(t){ps===null?ps=[t]:ps.push(t)}function M5(t){tp=!0,Dj(t)}function zi(){if(!fm&&ps!==null){fm=!0;var t=0,e=Je;try{var n=ps;for(Je=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}ps=null,tp=!1}catch(s){throw ps!==null&&(ps=ps.slice(t+1)),lj(av,zi),s}finally{Je=e,fm=!1}}return null}var ga=[],ya=0,ff=null,hf=0,tr=[],nr=0,ho=null,gs=1,ys="";function Ui(t,e){ga[ya++]=hf,ga[ya++]=ff,ff=t,hf=e}function zj(t,e,n){tr[nr++]=gs,tr[nr++]=ys,tr[nr++]=ho,ho=t;var r=gs;t=ys;var s=32-br(r)-1;r&=~(1<<s),n+=1;var i=32-br(e)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,gs=1<<32-br(e)+s|n<<s|r,ys=i+t}else gs=1<<i|n<<s|r,ys=t}function gv(t){t.return!==null&&(Ui(t,1),zj(t,1,0))}function yv(t){for(;t===ff;)ff=ga[--ya],ga[ya]=null,hf=ga[--ya],ga[ya]=null;for(;t===ho;)ho=tr[--nr],tr[nr]=null,ys=tr[--nr],tr[nr]=null,gs=tr[--nr],tr[nr]=null}var Wn=null,Bn=null,ot=!1,vr=null;function Lj(t,e){var n=sr(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function uk(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Wn=t,Bn=ci(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Wn=t,Bn=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=ho!==null?{id:gs,overflow:ys}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=sr(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,Wn=t,Bn=null,!0):!1;default:return!1}}function Qg(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Xg(t){if(ot){var e=Bn;if(e){var n=e;if(!uk(t,e)){if(Qg(t))throw Error(Q(418));e=ci(n.nextSibling);var r=Wn;e&&uk(t,e)?Lj(r,n):(t.flags=t.flags&-4097|2,ot=!1,Wn=t)}}else{if(Qg(t))throw Error(Q(418));t.flags=t.flags&-4097|2,ot=!1,Wn=t}}}function fk(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Wn=t}function eu(t){if(t!==Wn)return!1;if(!ot)return fk(t),ot=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Kg(t.type,t.memoizedProps)),e&&(e=Bn)){if(Qg(t))throw Fj(),Error(Q(418));for(;e;)Lj(t,e),e=ci(e.nextSibling)}if(fk(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Q(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){Bn=ci(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}Bn=null}}else Bn=Wn?ci(t.stateNode.nextSibling):null;return!0}function Fj(){for(var t=Bn;t;)t=ci(t.nextSibling)}function Ia(){Bn=Wn=null,ot=!1}function xv(t){vr===null?vr=[t]:vr.push(t)}var T5=Is.ReactCurrentBatchConfig;function Tl(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Q(309));var r=n.stateNode}if(!r)throw Error(Q(147,t));var s=r,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(o){var a=s.refs;o===null?delete a[i]:a[i]=o},e._stringRef=i,e)}if(typeof t!="string")throw Error(Q(284));if(!n._owner)throw Error(Q(290,t))}return t}function tu(t,e){throw t=Object.prototype.toString.call(e),Error(Q(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function hk(t){var e=t._init;return e(t._payload)}function Bj(t){function e(y,v){if(t){var k=y.deletions;k===null?(y.deletions=[v],y.flags|=16):k.push(v)}}function n(y,v){if(!t)return null;for(;v!==null;)e(y,v),v=v.sibling;return null}function r(y,v){for(y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function s(y,v){return y=hi(y,v),y.index=0,y.sibling=null,y}function i(y,v,k){return y.index=k,t?(k=y.alternate,k!==null?(k=k.index,k<v?(y.flags|=2,v):k):(y.flags|=2,v)):(y.flags|=1048576,v)}function o(y){return t&&y.alternate===null&&(y.flags|=2),y}function a(y,v,k,w){return v===null||v.tag!==6?(v=vm(k,y.mode,w),v.return=y,v):(v=s(v,k),v.return=y,v)}function l(y,v,k,w){var j=k.type;return j===da?u(y,v,k.props.children,w,k.key):v!==null&&(v.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Ws&&hk(j)===v.type)?(w=s(v,k.props),w.ref=Tl(y,v,k),w.return=y,w):(w=Bu(k.type,k.key,k.props,null,y.mode,w),w.ref=Tl(y,v,k),w.return=y,w)}function c(y,v,k,w){return v===null||v.tag!==4||v.stateNode.containerInfo!==k.containerInfo||v.stateNode.implementation!==k.implementation?(v=km(k,y.mode,w),v.return=y,v):(v=s(v,k.children||[]),v.return=y,v)}function u(y,v,k,w,j){return v===null||v.tag!==7?(v=io(k,y.mode,w,j),v.return=y,v):(v=s(v,k),v.return=y,v)}function f(y,v,k){if(typeof v=="string"&&v!==""||typeof v=="number")return v=vm(""+v,y.mode,k),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Ud:return k=Bu(v.type,v.key,v.props,null,y.mode,k),k.ref=Tl(y,null,v),k.return=y,k;case ca:return v=km(v,y.mode,k),v.return=y,v;case Ws:var w=v._init;return f(y,w(v._payload),k)}if(Zl(v)||_l(v))return v=io(v,y.mode,k,null),v.return=y,v;tu(y,v)}return null}function h(y,v,k,w){var j=v!==null?v.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return j!==null?null:a(y,v,""+k,w);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Ud:return k.key===j?l(y,v,k,w):null;case ca:return k.key===j?c(y,v,k,w):null;case Ws:return j=k._init,h(y,v,j(k._payload),w)}if(Zl(k)||_l(k))return j!==null?null:u(y,v,k,w,null);tu(y,k)}return null}function m(y,v,k,w,j){if(typeof w=="string"&&w!==""||typeof w=="number")return y=y.get(k)||null,a(v,y,""+w,j);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Ud:return y=y.get(w.key===null?k:w.key)||null,l(v,y,w,j);case ca:return y=y.get(w.key===null?k:w.key)||null,c(v,y,w,j);case Ws:var C=w._init;return m(y,v,k,C(w._payload),j)}if(Zl(w)||_l(w))return y=y.get(k)||null,u(v,y,w,j,null);tu(v,w)}return null}function g(y,v,k,w){for(var j=null,C=null,E=v,S=v=0,_=null;E!==null&&S<k.length;S++){E.index>S?(_=E,E=null):_=E.sibling;var N=h(y,E,k[S],w);if(N===null){E===null&&(E=_);break}t&&E&&N.alternate===null&&e(y,E),v=i(N,v,S),C===null?j=N:C.sibling=N,C=N,E=_}if(S===k.length)return n(y,E),ot&&Ui(y,S),j;if(E===null){for(;S<k.length;S++)E=f(y,k[S],w),E!==null&&(v=i(E,v,S),C===null?j=E:C.sibling=E,C=E);return ot&&Ui(y,S),j}for(E=r(y,E);S<k.length;S++)_=m(E,y,S,k[S],w),_!==null&&(t&&_.alternate!==null&&E.delete(_.key===null?S:_.key),v=i(_,v,S),C===null?j=_:C.sibling=_,C=_);return t&&E.forEach(function(M){return e(y,M)}),ot&&Ui(y,S),j}function p(y,v,k,w){var j=_l(k);if(typeof j!="function")throw Error(Q(150));if(k=j.call(k),k==null)throw Error(Q(151));for(var C=j=null,E=v,S=v=0,_=null,N=k.next();E!==null&&!N.done;S++,N=k.next()){E.index>S?(_=E,E=null):_=E.sibling;var M=h(y,E,N.value,w);if(M===null){E===null&&(E=_);break}t&&E&&M.alternate===null&&e(y,E),v=i(M,v,S),C===null?j=M:C.sibling=M,C=M,E=_}if(N.done)return n(y,E),ot&&Ui(y,S),j;if(E===null){for(;!N.done;S++,N=k.next())N=f(y,N.value,w),N!==null&&(v=i(N,v,S),C===null?j=N:C.sibling=N,C=N);return ot&&Ui(y,S),j}for(E=r(y,E);!N.done;S++,N=k.next())N=m(E,y,S,N.value,w),N!==null&&(t&&N.alternate!==null&&E.delete(N.key===null?S:N.key),v=i(N,v,S),C===null?j=N:C.sibling=N,C=N);return t&&E.forEach(function(P){return e(y,P)}),ot&&Ui(y,S),j}function x(y,v,k,w){if(typeof k=="object"&&k!==null&&k.type===da&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Ud:e:{for(var j=k.key,C=v;C!==null;){if(C.key===j){if(j=k.type,j===da){if(C.tag===7){n(y,C.sibling),v=s(C,k.props.children),v.return=y,y=v;break e}}else if(C.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Ws&&hk(j)===C.type){n(y,C.sibling),v=s(C,k.props),v.ref=Tl(y,C,k),v.return=y,y=v;break e}n(y,C);break}else e(y,C);C=C.sibling}k.type===da?(v=io(k.props.children,y.mode,w,k.key),v.return=y,y=v):(w=Bu(k.type,k.key,k.props,null,y.mode,w),w.ref=Tl(y,v,k),w.return=y,y=w)}return o(y);case ca:e:{for(C=k.key;v!==null;){if(v.key===C)if(v.tag===4&&v.stateNode.containerInfo===k.containerInfo&&v.stateNode.implementation===k.implementation){n(y,v.sibling),v=s(v,k.children||[]),v.return=y,y=v;break e}else{n(y,v);break}else e(y,v);v=v.sibling}v=km(k,y.mode,w),v.return=y,y=v}return o(y);case Ws:return C=k._init,x(y,v,C(k._payload),w)}if(Zl(k))return g(y,v,k,w);if(_l(k))return p(y,v,k,w);tu(y,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,v!==null&&v.tag===6?(n(y,v.sibling),v=s(v,k),v.return=y,y=v):(n(y,v),v=vm(k,y.mode,w),v.return=y,y=v),o(y)):n(y,v)}return x}var Pa=Bj(!0),Vj=Bj(!1),pf=Di(null),mf=null,xa=null,vv=null;function kv(){vv=xa=mf=null}function wv(t){var e=pf.current;st(pf),t._currentValue=e}function ey(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Na(t,e){mf=t,vv=xa=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(En=!0),t.firstContext=null)}function or(t){var e=t._currentValue;if(vv!==t)if(t={context:t,memoizedValue:e,next:null},xa===null){if(mf===null)throw Error(Q(308));xa=t,mf.dependencies={lanes:0,firstContext:t}}else xa=xa.next=t;return e}var Ji=null;function bv(t){Ji===null?Ji=[t]:Ji.push(t)}function Wj(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,bv(e)):(n.next=s.next,s.next=n),e.interleaved=n,Es(t,r)}function Es(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Us=!1;function Sv(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Uj(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function ks(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function di(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Ve&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,Es(t,n)}return s=r.interleaved,s===null?(e.next=e,bv(r)):(e.next=s.next,s.next=e),r.interleaved=e,Es(t,n)}function Iu(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,lv(t,n)}}function pk(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=e:i=i.next=e}else s=i=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function gf(t,e,n,r){var s=t.updateQueue;Us=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?i=c:o.next=c,o=l;var u=t.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(i!==null){var f=s.baseState;o=0,u=c=l=null,a=i;do{var h=a.lane,m=a.eventTime;if((r&h)===h){u!==null&&(u=u.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=t,p=a;switch(h=e,m=n,p.tag){case 1:if(g=p.payload,typeof g=="function"){f=g.call(m,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=p.payload,h=typeof g=="function"?g.call(m,f,h):g,h==null)break e;f=ut({},f,h);break e;case 2:Us=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,h=s.effects,h===null?s.effects=[a]:h.push(a))}else m={eventTime:m,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=m,l=f):u=u.next=m,o|=h;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;h=a,a=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(u===null&&(l=f),s.baseState=l,s.firstBaseUpdate=c,s.lastBaseUpdate=u,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);mo|=o,t.lanes=o,t.memoizedState=f}}function mk(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(Q(191,s));s.call(r)}}}var vd={},qr=Di(vd),zc=Di(vd),Lc=Di(vd);function Gi(t){if(t===vd)throw Error(Q(174));return t}function jv(t,e){switch(et(Lc,e),et(zc,t),et(qr,vd),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Rg(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Rg(e,t)}st(qr),et(qr,e)}function Da(){st(qr),st(zc),st(Lc)}function Zj(t){Gi(Lc.current);var e=Gi(qr.current),n=Rg(e,t.type);e!==n&&(et(zc,t),et(qr,n))}function Cv(t){zc.current===t&&(st(qr),st(zc))}var lt=Di(0);function yf(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var hm=[];function _v(){for(var t=0;t<hm.length;t++)hm[t]._workInProgressVersionPrimary=null;hm.length=0}var Pu=Is.ReactCurrentDispatcher,pm=Is.ReactCurrentBatchConfig,po=0,ct=null,_t=null,It=null,xf=!1,cc=!1,Fc=0,O5=0;function tn(){throw Error(Q(321))}function Nv(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!_r(t[n],e[n]))return!1;return!0}function Ev(t,e,n,r,s,i){if(po=i,ct=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Pu.current=t===null||t.memoizedState===null?P5:D5,t=n(r,s),cc){i=0;do{if(cc=!1,Fc=0,25<=i)throw Error(Q(301));i+=1,It=_t=null,e.updateQueue=null,Pu.current=z5,t=n(r,s)}while(cc)}if(Pu.current=vf,e=_t!==null&&_t.next!==null,po=0,It=_t=ct=null,xf=!1,e)throw Error(Q(300));return t}function $v(){var t=Fc!==0;return Fc=0,t}function Ir(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return It===null?ct.memoizedState=It=t:It=It.next=t,It}function ar(){if(_t===null){var t=ct.alternate;t=t!==null?t.memoizedState:null}else t=_t.next;var e=It===null?ct.memoizedState:It.next;if(e!==null)It=e,_t=t;else{if(t===null)throw Error(Q(310));_t=t,t={memoizedState:_t.memoizedState,baseState:_t.baseState,baseQueue:_t.baseQueue,queue:_t.queue,next:null},It===null?ct.memoizedState=It=t:It=It.next=t}return It}function Bc(t,e){return typeof e=="function"?e(t):e}function mm(t){var e=ar(),n=e.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=t;var r=_t,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var a=o=null,l=null,c=i;do{var u=c.lane;if((po&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:t(r,c.action);else{var f={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=f,o=r):l=l.next=f,ct.lanes|=u,mo|=u}c=c.next}while(c!==null&&c!==i);l===null?o=r:l.next=a,_r(r,e.memoizedState)||(En=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){s=t;do i=s.lane,ct.lanes|=i,mo|=i,s=s.next;while(s!==t)}else s===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function gm(t){var e=ar(),n=e.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=t;var r=n.dispatch,s=n.pending,i=e.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=t(i,o.action),o=o.next;while(o!==s);_r(i,e.memoizedState)||(En=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function Hj(){}function qj(t,e){var n=ct,r=ar(),s=e(),i=!_r(r.memoizedState,s);if(i&&(r.memoizedState=s,En=!0),r=r.queue,Mv(Gj.bind(null,n,r,t),[t]),r.getSnapshot!==e||i||It!==null&&It.memoizedState.tag&1){if(n.flags|=2048,Vc(9,Jj.bind(null,n,r,s,e),void 0,null),Lt===null)throw Error(Q(349));po&30||Kj(n,e,s)}return s}function Kj(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=ct.updateQueue,e===null?(e={lastEffect:null,stores:null},ct.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function Jj(t,e,n,r){e.value=n,e.getSnapshot=r,Yj(e)&&Qj(t)}function Gj(t,e,n){return n(function(){Yj(e)&&Qj(t)})}function Yj(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!_r(t,n)}catch{return!0}}function Qj(t){var e=Es(t,1);e!==null&&Sr(e,t,1,-1)}function gk(t){var e=Ir();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Bc,lastRenderedState:t},e.queue=t,t=t.dispatch=I5.bind(null,ct,t),[e.memoizedState,t]}function Vc(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=ct.updateQueue,e===null?(e={lastEffect:null,stores:null},ct.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function Xj(){return ar().memoizedState}function Du(t,e,n,r){var s=Ir();ct.flags|=t,s.memoizedState=Vc(1|e,n,void 0,r===void 0?null:r)}function np(t,e,n,r){var s=ar();r=r===void 0?null:r;var i=void 0;if(_t!==null){var o=_t.memoizedState;if(i=o.destroy,r!==null&&Nv(r,o.deps)){s.memoizedState=Vc(e,n,i,r);return}}ct.flags|=t,s.memoizedState=Vc(1|e,n,i,r)}function yk(t,e){return Du(8390656,8,t,e)}function Mv(t,e){return np(2048,8,t,e)}function eC(t,e){return np(4,2,t,e)}function tC(t,e){return np(4,4,t,e)}function nC(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function rC(t,e,n){return n=n!=null?n.concat([t]):null,np(4,4,nC.bind(null,e,t),n)}function Tv(){}function sC(t,e){var n=ar();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Nv(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function iC(t,e){var n=ar();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Nv(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function oC(t,e,n){return po&21?(_r(n,e)||(n=uj(),ct.lanes|=n,mo|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,En=!0),t.memoizedState=n)}function A5(t,e){var n=Je;Je=n!==0&&4>n?n:4,t(!0);var r=pm.transition;pm.transition={};try{t(!1),e()}finally{Je=n,pm.transition=r}}function aC(){return ar().memoizedState}function R5(t,e,n){var r=fi(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},lC(t))cC(e,n);else if(n=Wj(t,e,n,r),n!==null){var s=yn();Sr(n,t,r,s),dC(n,e,r)}}function I5(t,e,n){var r=fi(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(lC(t))cC(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,_r(a,o)){var l=e.interleaved;l===null?(s.next=s,bv(e)):(s.next=l.next,l.next=s),e.interleaved=s;return}}catch{}finally{}n=Wj(t,e,s,r),n!==null&&(s=yn(),Sr(n,t,r,s),dC(n,e,r))}}function lC(t){var e=t.alternate;return t===ct||e!==null&&e===ct}function cC(t,e){cc=xf=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function dC(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,lv(t,n)}}var vf={readContext:or,useCallback:tn,useContext:tn,useEffect:tn,useImperativeHandle:tn,useInsertionEffect:tn,useLayoutEffect:tn,useMemo:tn,useReducer:tn,useRef:tn,useState:tn,useDebugValue:tn,useDeferredValue:tn,useTransition:tn,useMutableSource:tn,useSyncExternalStore:tn,useId:tn,unstable_isNewReconciler:!1},P5={readContext:or,useCallback:function(t,e){return Ir().memoizedState=[t,e===void 0?null:e],t},useContext:or,useEffect:yk,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Du(4194308,4,nC.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Du(4194308,4,t,e)},useInsertionEffect:function(t,e){return Du(4,2,t,e)},useMemo:function(t,e){var n=Ir();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Ir();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=R5.bind(null,ct,t),[r.memoizedState,t]},useRef:function(t){var e=Ir();return t={current:t},e.memoizedState=t},useState:gk,useDebugValue:Tv,useDeferredValue:function(t){return Ir().memoizedState=t},useTransition:function(){var t=gk(!1),e=t[0];return t=A5.bind(null,t[1]),Ir().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=ct,s=Ir();if(ot){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=e(),Lt===null)throw Error(Q(349));po&30||Kj(r,e,n)}s.memoizedState=n;var i={value:n,getSnapshot:e};return s.queue=i,yk(Gj.bind(null,r,i,t),[t]),r.flags|=2048,Vc(9,Jj.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=Ir(),e=Lt.identifierPrefix;if(ot){var n=ys,r=gs;n=(r&~(1<<32-br(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Fc++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=O5++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},D5={readContext:or,useCallback:sC,useContext:or,useEffect:Mv,useImperativeHandle:rC,useInsertionEffect:eC,useLayoutEffect:tC,useMemo:iC,useReducer:mm,useRef:Xj,useState:function(){return mm(Bc)},useDebugValue:Tv,useDeferredValue:function(t){var e=ar();return oC(e,_t.memoizedState,t)},useTransition:function(){var t=mm(Bc)[0],e=ar().memoizedState;return[t,e]},useMutableSource:Hj,useSyncExternalStore:qj,useId:aC,unstable_isNewReconciler:!1},z5={readContext:or,useCallback:sC,useContext:or,useEffect:Mv,useImperativeHandle:rC,useInsertionEffect:eC,useLayoutEffect:tC,useMemo:iC,useReducer:gm,useRef:Xj,useState:function(){return gm(Bc)},useDebugValue:Tv,useDeferredValue:function(t){var e=ar();return _t===null?e.memoizedState=t:oC(e,_t.memoizedState,t)},useTransition:function(){var t=gm(Bc)[0],e=ar().memoizedState;return[t,e]},useMutableSource:Hj,useSyncExternalStore:qj,useId:aC,unstable_isNewReconciler:!1};function yr(t,e){if(t&&t.defaultProps){e=ut({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function ty(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:ut({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var rp={isMounted:function(t){return(t=t._reactInternals)?Po(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=yn(),s=fi(t),i=ks(r,s);i.payload=e,n!=null&&(i.callback=n),e=di(t,i,s),e!==null&&(Sr(e,t,s,r),Iu(e,t,s))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=yn(),s=fi(t),i=ks(r,s);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=di(t,i,s),e!==null&&(Sr(e,t,s,r),Iu(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=yn(),r=fi(t),s=ks(n,r);s.tag=2,e!=null&&(s.callback=e),e=di(t,s,r),e!==null&&(Sr(e,t,r,n),Iu(e,t,r))}};function xk(t,e,n,r,s,i,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,o):e.prototype&&e.prototype.isPureReactComponent?!Rc(n,r)||!Rc(s,i):!0}function uC(t,e,n){var r=!1,s=ji,i=e.contextType;return typeof i=="object"&&i!==null?i=or(i):(s=Mn(e)?fo:dn.current,r=e.contextTypes,i=(r=r!=null)?Ra(t,s):ji),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=rp,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=i),e}function vk(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&rp.enqueueReplaceState(e,e.state,null)}function ny(t,e,n,r){var s=t.stateNode;s.props=n,s.state=t.memoizedState,s.refs={},Sv(t);var i=e.contextType;typeof i=="object"&&i!==null?s.context=or(i):(i=Mn(e)?fo:dn.current,s.context=Ra(t,i)),s.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(ty(t,e,i,n),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&rp.enqueueReplaceState(s,s.state,null),gf(t,n,s,r),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function za(t,e){try{var n="",r=e;do n+=f3(r),r=r.return;while(r);var s=n}catch(i){s=`
39
- Error generating stack: `+i.message+`
40
- `+i.stack}return{value:t,source:e,stack:s,digest:null}}function ym(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function ry(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var L5=typeof WeakMap=="function"?WeakMap:Map;function fC(t,e,n){n=ks(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){wf||(wf=!0,hy=r),ry(t,e)},n}function hC(t,e,n){n=ks(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var s=e.value;n.payload=function(){return r(s)},n.callback=function(){ry(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){ry(t,e),typeof r!="function"&&(ui===null?ui=new Set([this]):ui.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function kk(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new L5;var s=new Set;r.set(e,s)}else s=r.get(e),s===void 0&&(s=new Set,r.set(e,s));s.has(n)||(s.add(n),t=X5.bind(null,t,e,n),e.then(t,t))}function wk(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function bk(t,e,n,r,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=ks(-1,1),e.tag=2,di(n,e,1))),n.lanes|=1),t)}var F5=Is.ReactCurrentOwner,En=!1;function hn(t,e,n,r){e.child=t===null?Vj(e,null,n,r):Pa(e,t.child,n,r)}function Sk(t,e,n,r,s){n=n.render;var i=e.ref;return Na(e,s),r=Ev(t,e,n,r,i,s),n=$v(),t!==null&&!En?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,$s(t,e,s)):(ot&&n&&gv(e),e.flags|=1,hn(t,e,r,s),e.child)}function jk(t,e,n,r,s){if(t===null){var i=n.type;return typeof i=="function"&&!Lv(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,pC(t,e,i,r,s)):(t=Bu(n.type,null,r,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Rc,n(o,r)&&t.ref===e.ref)return $s(t,e,s)}return e.flags|=1,t=hi(i,r),t.ref=e.ref,t.return=e,e.child=t}function pC(t,e,n,r,s){if(t!==null){var i=t.memoizedProps;if(Rc(i,r)&&t.ref===e.ref)if(En=!1,e.pendingProps=r=i,(t.lanes&s)!==0)t.flags&131072&&(En=!0);else return e.lanes=t.lanes,$s(t,e,s)}return sy(t,e,n,r,s)}function mC(t,e,n){var r=e.pendingProps,s=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},et(ka,zn),zn|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,et(ka,zn),zn|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,et(ka,zn),zn|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,et(ka,zn),zn|=r;return hn(t,e,s,n),e.child}function gC(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function sy(t,e,n,r,s){var i=Mn(n)?fo:dn.current;return i=Ra(e,i),Na(e,s),n=Ev(t,e,n,r,i,s),r=$v(),t!==null&&!En?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,$s(t,e,s)):(ot&&r&&gv(e),e.flags|=1,hn(t,e,n,s),e.child)}function Ck(t,e,n,r,s){if(Mn(n)){var i=!0;uf(e)}else i=!1;if(Na(e,s),e.stateNode===null)zu(t,e),uC(e,n,r),ny(e,n,r,s),r=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=n.contextType;typeof c=="object"&&c!==null?c=or(c):(c=Mn(n)?fo:dn.current,c=Ra(e,c));var u=n.getDerivedStateFromProps,f=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==c)&&vk(e,o,r,c),Us=!1;var h=e.memoizedState;o.state=h,gf(e,r,o,s),l=e.memoizedState,a!==r||h!==l||$n.current||Us?(typeof u=="function"&&(ty(e,n,u,r),l=e.memoizedState),(a=Us||xk(e,n,a,r,h,l,c))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),o.props=r,o.state=l,o.context=c,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,Uj(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:yr(e.type,a),o.props=c,f=e.pendingProps,h=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=or(l):(l=Mn(n)?fo:dn.current,l=Ra(e,l));var m=n.getDerivedStateFromProps;(u=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==f||h!==l)&&vk(e,o,r,l),Us=!1,h=e.memoizedState,o.state=h,gf(e,r,o,s);var g=e.memoizedState;a!==f||h!==g||$n.current||Us?(typeof m=="function"&&(ty(e,n,m,r),g=e.memoizedState),(c=Us||xk(e,n,c,r,h,g,l)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=g),o.props=r,o.state=g,o.context=l,r=c):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),r=!1)}return iy(t,e,n,r,i,s)}function iy(t,e,n,r,s,i){gC(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return s&&dk(e,n,!1),$s(t,e,i);r=e.stateNode,F5.current=e;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=Pa(e,t.child,null,i),e.child=Pa(e,null,a,i)):hn(t,e,a,i),e.memoizedState=r.state,s&&dk(e,n,!0),e.child}function yC(t){var e=t.stateNode;e.pendingContext?ck(t,e.pendingContext,e.pendingContext!==e.context):e.context&&ck(t,e.context,!1),jv(t,e.containerInfo)}function _k(t,e,n,r,s){return Ia(),xv(s),e.flags|=256,hn(t,e,n,r),e.child}var oy={dehydrated:null,treeContext:null,retryLane:0};function ay(t){return{baseLanes:t,cachePool:null,transitions:null}}function xC(t,e,n){var r=e.pendingProps,s=lt.current,i=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(s&2)!==0),a?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),et(lt,s&1),t===null)return Xg(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,i?(r=e.mode,i=e.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=op(o,r,0,null),t=io(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=ay(n),e.memoizedState=oy,t):Ov(e,o));if(s=t.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return B5(t,e,o,r,a,s,n);if(i){i=r.fallback,o=e.mode,s=t.child,a=s.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&e.child!==s?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=hi(s,l),r.subtreeFlags=s.subtreeFlags&14680064),a!==null?i=hi(a,i):(i=io(i,o,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,o=t.child.memoizedState,o=o===null?ay(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~n,e.memoizedState=oy,r}return i=t.child,t=i.sibling,r=hi(i,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function Ov(t,e){return e=op({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function nu(t,e,n,r){return r!==null&&xv(r),Pa(e,t.child,null,n),t=Ov(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function B5(t,e,n,r,s,i,o){if(n)return e.flags&256?(e.flags&=-257,r=ym(Error(Q(422))),nu(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,s=e.mode,r=op({mode:"visible",children:r.children},s,0,null),i=io(i,s,o,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&Pa(e,t.child,null,o),e.child.memoizedState=ay(o),e.memoizedState=oy,i);if(!(e.mode&1))return nu(t,e,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(Q(419)),r=ym(i,r,void 0),nu(t,e,o,r)}if(a=(o&t.childLanes)!==0,En||a){if(r=Lt,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Es(t,s),Sr(r,t,s,-1))}return zv(),r=ym(Error(Q(421))),nu(t,e,o,r)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=eR.bind(null,t),s._reactRetry=e,null):(t=i.treeContext,Bn=ci(s.nextSibling),Wn=e,ot=!0,vr=null,t!==null&&(tr[nr++]=gs,tr[nr++]=ys,tr[nr++]=ho,gs=t.id,ys=t.overflow,ho=e),e=Ov(e,r.children),e.flags|=4096,e)}function Nk(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),ey(t.return,e,n)}function xm(t,e,n,r,s){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function vC(t,e,n){var r=e.pendingProps,s=r.revealOrder,i=r.tail;if(hn(t,e,r.children,n),r=lt.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Nk(t,n,e);else if(t.tag===19)Nk(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(et(lt,r),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(n=e.child,s=null;n!==null;)t=n.alternate,t!==null&&yf(t)===null&&(s=n),n=n.sibling;n=s,n===null?(s=e.child,e.child=null):(s=n.sibling,n.sibling=null),xm(e,!1,s,n,i);break;case"backwards":for(n=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&yf(t)===null){e.child=s;break}t=s.sibling,s.sibling=n,n=s,s=t}xm(e,!0,n,null,i);break;case"together":xm(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function zu(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function $s(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),mo|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(Q(153));if(e.child!==null){for(t=e.child,n=hi(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=hi(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function V5(t,e,n){switch(e.tag){case 3:yC(e),Ia();break;case 5:Zj(e);break;case 1:Mn(e.type)&&uf(e);break;case 4:jv(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,s=e.memoizedProps.value;et(pf,r._currentValue),r._currentValue=s;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(et(lt,lt.current&1),e.flags|=128,null):n&e.child.childLanes?xC(t,e,n):(et(lt,lt.current&1),t=$s(t,e,n),t!==null?t.sibling:null);et(lt,lt.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return vC(t,e,n);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),et(lt,lt.current),r)break;return null;case 22:case 23:return e.lanes=0,mC(t,e,n)}return $s(t,e,n)}var kC,ly,wC,bC;kC=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};ly=function(){};wC=function(t,e,n,r){var s=t.memoizedProps;if(s!==r){t=e.stateNode,Gi(qr.current);var i=null;switch(n){case"input":s=Mg(t,s),r=Mg(t,r),i=[];break;case"select":s=ut({},s,{value:void 0}),r=ut({},r,{value:void 0}),i=[];break;case"textarea":s=Ag(t,s),r=Ag(t,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=cf)}Ig(n,r);var o;n=null;for(c in s)if(!r.hasOwnProperty(c)&&s.hasOwnProperty(c)&&s[c]!=null)if(c==="style"){var a=s[c];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Nc.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var l=r[c];if(a=s!=null?s[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(i||(i=[]),i.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Nc.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&tt("scroll",t),i||a===l||(i=[])):(i=i||[]).push(c,l))}n&&(i=i||[]).push("style",n);var c=i;(e.updateQueue=c)&&(e.flags|=4)}};bC=function(t,e,n,r){n!==r&&(e.flags|=4)};function Ol(t,e){if(!ot)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function nn(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function W5(t,e,n){var r=e.pendingProps;switch(yv(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nn(e),null;case 1:return Mn(e.type)&&df(),nn(e),null;case 3:return r=e.stateNode,Da(),st($n),st(dn),_v(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(eu(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,vr!==null&&(gy(vr),vr=null))),ly(t,e),nn(e),null;case 5:Cv(e);var s=Gi(Lc.current);if(n=e.type,t!==null&&e.stateNode!=null)wC(t,e,n,r,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(Q(166));return nn(e),null}if(t=Gi(qr.current),eu(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[Br]=e,r[Dc]=i,t=(e.mode&1)!==0,n){case"dialog":tt("cancel",r),tt("close",r);break;case"iframe":case"object":case"embed":tt("load",r);break;case"video":case"audio":for(s=0;s<ql.length;s++)tt(ql[s],r);break;case"source":tt("error",r);break;case"img":case"image":case"link":tt("error",r),tt("load",r);break;case"details":tt("toggle",r);break;case"input":P0(r,i),tt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},tt("invalid",r);break;case"textarea":z0(r,i),tt("invalid",r)}Ig(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var a=i[o];o==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&Xd(r.textContent,a,t),s=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&Xd(r.textContent,a,t),s=["children",""+a]):Nc.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&tt("scroll",r)}switch(n){case"input":Zd(r),D0(r,i,!0);break;case"textarea":Zd(r),L0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=cf)}r=s,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=GS(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[Br]=e,t[Dc]=r,kC(t,e,!1,!1),e.stateNode=t;e:{switch(o=Pg(n,r),n){case"dialog":tt("cancel",t),tt("close",t),s=r;break;case"iframe":case"object":case"embed":tt("load",t),s=r;break;case"video":case"audio":for(s=0;s<ql.length;s++)tt(ql[s],t);s=r;break;case"source":tt("error",t),s=r;break;case"img":case"image":case"link":tt("error",t),tt("load",t),s=r;break;case"details":tt("toggle",t),s=r;break;case"input":P0(t,r),s=Mg(t,r),tt("invalid",t);break;case"option":s=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},s=ut({},r,{value:void 0}),tt("invalid",t);break;case"textarea":z0(t,r),s=Ag(t,r),tt("invalid",t);break;default:s=r}Ig(n,s),a=s;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?XS(t,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&YS(t,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Ec(t,l):typeof l=="number"&&Ec(t,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Nc.hasOwnProperty(i)?l!=null&&i==="onScroll"&&tt("scroll",t):l!=null&&nv(t,i,l,o))}switch(n){case"input":Zd(t),D0(t,r,!1);break;case"textarea":Zd(t),L0(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Si(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?Sa(t,!!r.multiple,i,!1):r.defaultValue!=null&&Sa(t,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=cf)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return nn(e),null;case 6:if(t&&e.stateNode!=null)bC(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(Q(166));if(n=Gi(Lc.current),Gi(qr.current),eu(e)){if(r=e.stateNode,n=e.memoizedProps,r[Br]=e,(i=r.nodeValue!==n)&&(t=Wn,t!==null))switch(t.tag){case 3:Xd(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Xd(r.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Br]=e,e.stateNode=r}return nn(e),null;case 13:if(st(lt),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(ot&&Bn!==null&&e.mode&1&&!(e.flags&128))Fj(),Ia(),e.flags|=98560,i=!1;else if(i=eu(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(Q(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Q(317));i[Br]=e}else Ia(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;nn(e),i=!1}else vr!==null&&(gy(vr),vr=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||lt.current&1?Et===0&&(Et=3):zv())),e.updateQueue!==null&&(e.flags|=4),nn(e),null);case 4:return Da(),ly(t,e),t===null&&Ic(e.stateNode.containerInfo),nn(e),null;case 10:return wv(e.type._context),nn(e),null;case 17:return Mn(e.type)&&df(),nn(e),null;case 19:if(st(lt),i=e.memoizedState,i===null)return nn(e),null;if(r=(e.flags&128)!==0,o=i.rendering,o===null)if(r)Ol(i,!1);else{if(Et!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=yf(t),o!==null){for(e.flags|=128,Ol(i,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)i=n,t=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,t=o.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return et(lt,lt.current&1|2),e.child}t=t.sibling}i.tail!==null&&yt()>La&&(e.flags|=128,r=!0,Ol(i,!1),e.lanes=4194304)}else{if(!r)if(t=yf(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Ol(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ot)return nn(e),null}else 2*yt()-i.renderingStartTime>La&&n!==1073741824&&(e.flags|=128,r=!0,Ol(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(n=i.last,n!==null?n.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=yt(),e.sibling=null,n=lt.current,et(lt,r?n&1|2:n&1),e):(nn(e),null);case 22:case 23:return Dv(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?zn&1073741824&&(nn(e),e.subtreeFlags&6&&(e.flags|=8192)):nn(e),null;case 24:return null;case 25:return null}throw Error(Q(156,e.tag))}function U5(t,e){switch(yv(e),e.tag){case 1:return Mn(e.type)&&df(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Da(),st($n),st(dn),_v(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Cv(e),null;case 13:if(st(lt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Q(340));Ia()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return st(lt),null;case 4:return Da(),null;case 10:return wv(e.type._context),null;case 22:case 23:return Dv(),null;case 24:return null;default:return null}}var ru=!1,sn=!1,Z5=typeof WeakSet=="function"?WeakSet:Set,fe=null;function va(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){pt(t,e,r)}else n.current=null}function cy(t,e,n){try{n()}catch(r){pt(t,e,r)}}var Ek=!1;function H5(t,e){if(Hg=of,t=Nj(),mv(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,u=0,f=t,h=null;t:for(;;){for(var m;f!==n||s!==0&&f.nodeType!==3||(a=o+s),f!==i||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(m=f.firstChild)!==null;)h=f,f=m;for(;;){if(f===t)break t;if(h===n&&++c===s&&(a=o),h===i&&++u===r&&(l=o),(m=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(qg={focusedElem:t,selectionRange:n},of=!1,fe=e;fe!==null;)if(e=fe,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,fe=t;else for(;fe!==null;){e=fe;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var p=g.memoizedProps,x=g.memoizedState,y=e.stateNode,v=y.getSnapshotBeforeUpdate(e.elementType===e.type?p:yr(e.type,p),x);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var k=e.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(w){pt(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,fe=t;break}fe=e.return}return g=Ek,Ek=!1,g}function dc(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&cy(e,n,i)}s=s.next}while(s!==r)}}function sp(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function dy(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function SC(t){var e=t.alternate;e!==null&&(t.alternate=null,SC(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Br],delete e[Dc],delete e[Gg],delete e[E5],delete e[$5])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function jC(t){return t.tag===5||t.tag===3||t.tag===4}function $k(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||jC(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function uy(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=cf));else if(r!==4&&(t=t.child,t!==null))for(uy(t,e,n),t=t.sibling;t!==null;)uy(t,e,n),t=t.sibling}function fy(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(fy(t,e,n),t=t.sibling;t!==null;)fy(t,e,n),t=t.sibling}var Ht=null,xr=!1;function Fs(t,e,n){for(n=n.child;n!==null;)CC(t,e,n),n=n.sibling}function CC(t,e,n){if(Hr&&typeof Hr.onCommitFiberUnmount=="function")try{Hr.onCommitFiberUnmount(Gh,n)}catch{}switch(n.tag){case 5:sn||va(n,e);case 6:var r=Ht,s=xr;Ht=null,Fs(t,e,n),Ht=r,xr=s,Ht!==null&&(xr?(t=Ht,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Ht.removeChild(n.stateNode));break;case 18:Ht!==null&&(xr?(t=Ht,n=n.stateNode,t.nodeType===8?um(t.parentNode,n):t.nodeType===1&&um(t,n),Oc(t)):um(Ht,n.stateNode));break;case 4:r=Ht,s=xr,Ht=n.stateNode.containerInfo,xr=!0,Fs(t,e,n),Ht=r,xr=s;break;case 0:case 11:case 14:case 15:if(!sn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&cy(n,e,o),s=s.next}while(s!==r)}Fs(t,e,n);break;case 1:if(!sn&&(va(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){pt(n,e,a)}Fs(t,e,n);break;case 21:Fs(t,e,n);break;case 22:n.mode&1?(sn=(r=sn)||n.memoizedState!==null,Fs(t,e,n),sn=r):Fs(t,e,n);break;default:Fs(t,e,n)}}function Mk(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Z5),e.forEach(function(r){var s=tR.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function pr(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=t,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:Ht=a.stateNode,xr=!1;break e;case 3:Ht=a.stateNode.containerInfo,xr=!0;break e;case 4:Ht=a.stateNode.containerInfo,xr=!0;break e}a=a.return}if(Ht===null)throw Error(Q(160));CC(i,o,s),Ht=null,xr=!1;var l=s.alternate;l!==null&&(l.return=null),s.return=null}catch(c){pt(s,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)_C(e,t),e=e.sibling}function _C(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(pr(e,t),Ar(t),r&4){try{dc(3,t,t.return),sp(3,t)}catch(p){pt(t,t.return,p)}try{dc(5,t,t.return)}catch(p){pt(t,t.return,p)}}break;case 1:pr(e,t),Ar(t),r&512&&n!==null&&va(n,n.return);break;case 5:if(pr(e,t),Ar(t),r&512&&n!==null&&va(n,n.return),t.flags&32){var s=t.stateNode;try{Ec(s,"")}catch(p){pt(t,t.return,p)}}if(r&4&&(s=t.stateNode,s!=null)){var i=t.memoizedProps,o=n!==null?n.memoizedProps:i,a=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&KS(s,i),Pg(a,o);var c=Pg(a,i);for(o=0;o<l.length;o+=2){var u=l[o],f=l[o+1];u==="style"?XS(s,f):u==="dangerouslySetInnerHTML"?YS(s,f):u==="children"?Ec(s,f):nv(s,u,f,c)}switch(a){case"input":Tg(s,i);break;case"textarea":JS(s,i);break;case"select":var h=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?Sa(s,!!i.multiple,m,!1):h!==!!i.multiple&&(i.defaultValue!=null?Sa(s,!!i.multiple,i.defaultValue,!0):Sa(s,!!i.multiple,i.multiple?[]:"",!1))}s[Dc]=i}catch(p){pt(t,t.return,p)}}break;case 6:if(pr(e,t),Ar(t),r&4){if(t.stateNode===null)throw Error(Q(162));s=t.stateNode,i=t.memoizedProps;try{s.nodeValue=i}catch(p){pt(t,t.return,p)}}break;case 3:if(pr(e,t),Ar(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Oc(e.containerInfo)}catch(p){pt(t,t.return,p)}break;case 4:pr(e,t),Ar(t);break;case 13:pr(e,t),Ar(t),s=t.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Iv=yt())),r&4&&Mk(t);break;case 22:if(u=n!==null&&n.memoizedState!==null,t.mode&1?(sn=(c=sn)||u,pr(e,t),sn=c):pr(e,t),Ar(t),r&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!u&&t.mode&1)for(fe=t,u=t.child;u!==null;){for(f=fe=u;fe!==null;){switch(h=fe,m=h.child,h.tag){case 0:case 11:case 14:case 15:dc(4,h,h.return);break;case 1:va(h,h.return);var g=h.stateNode;if(typeof g.componentWillUnmount=="function"){r=h,n=h.return;try{e=r,g.props=e.memoizedProps,g.state=e.memoizedState,g.componentWillUnmount()}catch(p){pt(r,n,p)}}break;case 5:va(h,h.return);break;case 22:if(h.memoizedState!==null){Ok(f);continue}}m!==null?(m.return=h,fe=m):Ok(f)}u=u.sibling}e:for(u=null,f=t;;){if(f.tag===5){if(u===null){u=f;try{s=f.stateNode,c?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=f.stateNode,l=f.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=QS("display",o))}catch(p){pt(t,t.return,p)}}}else if(f.tag===6){if(u===null)try{f.stateNode.nodeValue=c?"":f.memoizedProps}catch(p){pt(t,t.return,p)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===t)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;u===f&&(u=null),f=f.return}u===f&&(u=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:pr(e,t),Ar(t),r&4&&Mk(t);break;case 21:break;default:pr(e,t),Ar(t)}}function Ar(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(jC(n)){var r=n;break e}n=n.return}throw Error(Q(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Ec(s,""),r.flags&=-33);var i=$k(t);fy(t,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,a=$k(t);uy(t,a,o);break;default:throw Error(Q(161))}}catch(l){pt(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function q5(t,e,n){fe=t,NC(t)}function NC(t,e,n){for(var r=(t.mode&1)!==0;fe!==null;){var s=fe,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||ru;if(!o){var a=s.alternate,l=a!==null&&a.memoizedState!==null||sn;a=ru;var c=sn;if(ru=o,(sn=l)&&!c)for(fe=s;fe!==null;)o=fe,l=o.child,o.tag===22&&o.memoizedState!==null?Ak(s):l!==null?(l.return=o,fe=l):Ak(s);for(;i!==null;)fe=i,NC(i),i=i.sibling;fe=s,ru=a,sn=c}Tk(t)}else s.subtreeFlags&8772&&i!==null?(i.return=s,fe=i):Tk(t)}}function Tk(t){for(;fe!==null;){var e=fe;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:sn||sp(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!sn)if(n===null)r.componentDidMount();else{var s=e.elementType===e.type?n.memoizedProps:yr(e.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&mk(e,i,r);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}mk(e,o,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var f=u.dehydrated;f!==null&&Oc(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Q(163))}sn||e.flags&512&&dy(e)}catch(h){pt(e,e.return,h)}}if(e===t){fe=null;break}if(n=e.sibling,n!==null){n.return=e.return,fe=n;break}fe=e.return}}function Ok(t){for(;fe!==null;){var e=fe;if(e===t){fe=null;break}var n=e.sibling;if(n!==null){n.return=e.return,fe=n;break}fe=e.return}}function Ak(t){for(;fe!==null;){var e=fe;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{sp(4,e)}catch(l){pt(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var s=e.return;try{r.componentDidMount()}catch(l){pt(e,s,l)}}var i=e.return;try{dy(e)}catch(l){pt(e,i,l)}break;case 5:var o=e.return;try{dy(e)}catch(l){pt(e,o,l)}}}catch(l){pt(e,e.return,l)}if(e===t){fe=null;break}var a=e.sibling;if(a!==null){a.return=e.return,fe=a;break}fe=e.return}}var K5=Math.ceil,kf=Is.ReactCurrentDispatcher,Av=Is.ReactCurrentOwner,ir=Is.ReactCurrentBatchConfig,Ve=0,Lt=null,St=null,Gt=0,zn=0,ka=Di(0),Et=0,Wc=null,mo=0,ip=0,Rv=0,uc=null,Cn=null,Iv=0,La=1/0,fs=null,wf=!1,hy=null,ui=null,su=!1,ni=null,bf=0,fc=0,py=null,Lu=-1,Fu=0;function yn(){return Ve&6?yt():Lu!==-1?Lu:Lu=yt()}function fi(t){return t.mode&1?Ve&2&&Gt!==0?Gt&-Gt:T5.transition!==null?(Fu===0&&(Fu=uj()),Fu):(t=Je,t!==0||(t=window.event,t=t===void 0?16:xj(t.type)),t):1}function Sr(t,e,n,r){if(50<fc)throw fc=0,py=null,Error(Q(185));gd(t,n,r),(!(Ve&2)||t!==Lt)&&(t===Lt&&(!(Ve&2)&&(ip|=n),Et===4&&Ys(t,Gt)),Tn(t,r),n===1&&Ve===0&&!(e.mode&1)&&(La=yt()+500,tp&&zi()))}function Tn(t,e){var n=t.callbackNode;T3(t,e);var r=sf(t,t===Lt?Gt:0);if(r===0)n!==null&&V0(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&V0(n),e===1)t.tag===0?M5(Rk.bind(null,t)):Dj(Rk.bind(null,t)),_5(function(){!(Ve&6)&&zi()}),n=null;else{switch(fj(r)){case 1:n=av;break;case 4:n=cj;break;case 16:n=rf;break;case 536870912:n=dj;break;default:n=rf}n=IC(n,EC.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function EC(t,e){if(Lu=-1,Fu=0,Ve&6)throw Error(Q(327));var n=t.callbackNode;if(Ea()&&t.callbackNode!==n)return null;var r=sf(t,t===Lt?Gt:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Sf(t,r);else{e=r;var s=Ve;Ve|=2;var i=MC();(Lt!==t||Gt!==e)&&(fs=null,La=yt()+500,so(t,e));do try{Y5();break}catch(a){$C(t,a)}while(!0);kv(),kf.current=i,Ve=s,St!==null?e=0:(Lt=null,Gt=0,e=Et)}if(e!==0){if(e===2&&(s=Bg(t),s!==0&&(r=s,e=my(t,s))),e===1)throw n=Wc,so(t,0),Ys(t,r),Tn(t,yt()),n;if(e===6)Ys(t,r);else{if(s=t.current.alternate,!(r&30)&&!J5(s)&&(e=Sf(t,r),e===2&&(i=Bg(t),i!==0&&(r=i,e=my(t,i))),e===1))throw n=Wc,so(t,0),Ys(t,r),Tn(t,yt()),n;switch(t.finishedWork=s,t.finishedLanes=r,e){case 0:case 1:throw Error(Q(345));case 2:Zi(t,Cn,fs);break;case 3:if(Ys(t,r),(r&130023424)===r&&(e=Iv+500-yt(),10<e)){if(sf(t,0)!==0)break;if(s=t.suspendedLanes,(s&r)!==r){yn(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=Jg(Zi.bind(null,t,Cn,fs),e);break}Zi(t,Cn,fs);break;case 4:if(Ys(t,r),(r&4194240)===r)break;for(e=t.eventTimes,s=-1;0<r;){var o=31-br(r);i=1<<o,o=e[o],o>s&&(s=o),r&=~i}if(r=s,r=yt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*K5(r/1960))-r,10<r){t.timeoutHandle=Jg(Zi.bind(null,t,Cn,fs),r);break}Zi(t,Cn,fs);break;case 5:Zi(t,Cn,fs);break;default:throw Error(Q(329))}}}return Tn(t,yt()),t.callbackNode===n?EC.bind(null,t):null}function my(t,e){var n=uc;return t.current.memoizedState.isDehydrated&&(so(t,e).flags|=256),t=Sf(t,e),t!==2&&(e=Cn,Cn=n,e!==null&&gy(e)),t}function gy(t){Cn===null?Cn=t:Cn.push.apply(Cn,t)}function J5(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!_r(i(),s))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Ys(t,e){for(e&=~Rv,e&=~ip,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-br(e),r=1<<n;t[n]=-1,e&=~r}}function Rk(t){if(Ve&6)throw Error(Q(327));Ea();var e=sf(t,0);if(!(e&1))return Tn(t,yt()),null;var n=Sf(t,e);if(t.tag!==0&&n===2){var r=Bg(t);r!==0&&(e=r,n=my(t,r))}if(n===1)throw n=Wc,so(t,0),Ys(t,e),Tn(t,yt()),n;if(n===6)throw Error(Q(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Zi(t,Cn,fs),Tn(t,yt()),null}function Pv(t,e){var n=Ve;Ve|=1;try{return t(e)}finally{Ve=n,Ve===0&&(La=yt()+500,tp&&zi())}}function go(t){ni!==null&&ni.tag===0&&!(Ve&6)&&Ea();var e=Ve;Ve|=1;var n=ir.transition,r=Je;try{if(ir.transition=null,Je=1,t)return t()}finally{Je=r,ir.transition=n,Ve=e,!(Ve&6)&&zi()}}function Dv(){zn=ka.current,st(ka)}function so(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,C5(n)),St!==null)for(n=St.return;n!==null;){var r=n;switch(yv(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&df();break;case 3:Da(),st($n),st(dn),_v();break;case 5:Cv(r);break;case 4:Da();break;case 13:st(lt);break;case 19:st(lt);break;case 10:wv(r.type._context);break;case 22:case 23:Dv()}n=n.return}if(Lt=t,St=t=hi(t.current,null),Gt=zn=e,Et=0,Wc=null,Rv=ip=mo=0,Cn=uc=null,Ji!==null){for(e=0;e<Ji.length;e++)if(n=Ji[e],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}Ji=null}return t}function $C(t,e){do{var n=St;try{if(kv(),Pu.current=vf,xf){for(var r=ct.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}xf=!1}if(po=0,It=_t=ct=null,cc=!1,Fc=0,Av.current=null,n===null||n.return===null){Et=1,Wc=e,St=null;break}e:{var i=t,o=n.return,a=n,l=e;if(e=Gt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,f=u.tag;if(!(u.mode&1)&&(f===0||f===11||f===15)){var h=u.alternate;h?(u.updateQueue=h.updateQueue,u.memoizedState=h.memoizedState,u.lanes=h.lanes):(u.updateQueue=null,u.memoizedState=null)}var m=wk(o);if(m!==null){m.flags&=-257,bk(m,o,a,i,e),m.mode&1&&kk(i,c,e),e=m,l=c;var g=e.updateQueue;if(g===null){var p=new Set;p.add(l),e.updateQueue=p}else g.add(l);break e}else{if(!(e&1)){kk(i,c,e),zv();break e}l=Error(Q(426))}}else if(ot&&a.mode&1){var x=wk(o);if(x!==null){!(x.flags&65536)&&(x.flags|=256),bk(x,o,a,i,e),xv(za(l,a));break e}}i=l=za(l,a),Et!==4&&(Et=2),uc===null?uc=[i]:uc.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var y=fC(i,l,e);pk(i,y);break e;case 1:a=l;var v=i.type,k=i.stateNode;if(!(i.flags&128)&&(typeof v.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(ui===null||!ui.has(k)))){i.flags|=65536,e&=-e,i.lanes|=e;var w=hC(i,a,e);pk(i,w);break e}}i=i.return}while(i!==null)}OC(n)}catch(j){e=j,St===n&&n!==null&&(St=n=n.return);continue}break}while(!0)}function MC(){var t=kf.current;return kf.current=vf,t===null?vf:t}function zv(){(Et===0||Et===3||Et===2)&&(Et=4),Lt===null||!(mo&268435455)&&!(ip&268435455)||Ys(Lt,Gt)}function Sf(t,e){var n=Ve;Ve|=2;var r=MC();(Lt!==t||Gt!==e)&&(fs=null,so(t,e));do try{G5();break}catch(s){$C(t,s)}while(!0);if(kv(),Ve=n,kf.current=r,St!==null)throw Error(Q(261));return Lt=null,Gt=0,Et}function G5(){for(;St!==null;)TC(St)}function Y5(){for(;St!==null&&!b3();)TC(St)}function TC(t){var e=RC(t.alternate,t,zn);t.memoizedProps=t.pendingProps,e===null?OC(t):St=e,Av.current=null}function OC(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=U5(n,e),n!==null){n.flags&=32767,St=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Et=6,St=null;return}}else if(n=W5(n,e,zn),n!==null){St=n;return}if(e=e.sibling,e!==null){St=e;return}St=e=t}while(e!==null);Et===0&&(Et=5)}function Zi(t,e,n){var r=Je,s=ir.transition;try{ir.transition=null,Je=1,Q5(t,e,n,r)}finally{ir.transition=s,Je=r}return null}function Q5(t,e,n,r){do Ea();while(ni!==null);if(Ve&6)throw Error(Q(327));n=t.finishedWork;var s=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(Q(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(O3(t,i),t===Lt&&(St=Lt=null,Gt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||su||(su=!0,IC(rf,function(){return Ea(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=ir.transition,ir.transition=null;var o=Je;Je=1;var a=Ve;Ve|=4,Av.current=null,H5(t,n),_C(n,t),x5(qg),of=!!Hg,qg=Hg=null,t.current=n,q5(n),S3(),Ve=a,Je=o,ir.transition=i}else t.current=n;if(su&&(su=!1,ni=t,bf=s),i=t.pendingLanes,i===0&&(ui=null),_3(n.stateNode),Tn(t,yt()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)s=e[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(wf)throw wf=!1,t=hy,hy=null,t;return bf&1&&t.tag!==0&&Ea(),i=t.pendingLanes,i&1?t===py?fc++:(fc=0,py=t):fc=0,zi(),null}function Ea(){if(ni!==null){var t=fj(bf),e=ir.transition,n=Je;try{if(ir.transition=null,Je=16>t?16:t,ni===null)var r=!1;else{if(t=ni,ni=null,bf=0,Ve&6)throw Error(Q(331));var s=Ve;for(Ve|=4,fe=t.current;fe!==null;){var i=fe,o=i.child;if(fe.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(fe=c;fe!==null;){var u=fe;switch(u.tag){case 0:case 11:case 15:dc(8,u,i)}var f=u.child;if(f!==null)f.return=u,fe=f;else for(;fe!==null;){u=fe;var h=u.sibling,m=u.return;if(SC(u),u===c){fe=null;break}if(h!==null){h.return=m,fe=h;break}fe=m}}}var g=i.alternate;if(g!==null){var p=g.child;if(p!==null){g.child=null;do{var x=p.sibling;p.sibling=null,p=x}while(p!==null)}}fe=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,fe=o;else e:for(;fe!==null;){if(i=fe,i.flags&2048)switch(i.tag){case 0:case 11:case 15:dc(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,fe=y;break e}fe=i.return}}var v=t.current;for(fe=v;fe!==null;){o=fe;var k=o.child;if(o.subtreeFlags&2064&&k!==null)k.return=o,fe=k;else e:for(o=v;fe!==null;){if(a=fe,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:sp(9,a)}}catch(j){pt(a,a.return,j)}if(a===o){fe=null;break e}var w=a.sibling;if(w!==null){w.return=a.return,fe=w;break e}fe=a.return}}if(Ve=s,zi(),Hr&&typeof Hr.onPostCommitFiberRoot=="function")try{Hr.onPostCommitFiberRoot(Gh,t)}catch{}r=!0}return r}finally{Je=n,ir.transition=e}}return!1}function Ik(t,e,n){e=za(n,e),e=fC(t,e,1),t=di(t,e,1),e=yn(),t!==null&&(gd(t,1,e),Tn(t,e))}function pt(t,e,n){if(t.tag===3)Ik(t,t,n);else for(;e!==null;){if(e.tag===3){Ik(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ui===null||!ui.has(r))){t=za(n,t),t=hC(e,t,1),e=di(e,t,1),t=yn(),e!==null&&(gd(e,1,t),Tn(e,t));break}}e=e.return}}function X5(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=yn(),t.pingedLanes|=t.suspendedLanes&n,Lt===t&&(Gt&n)===n&&(Et===4||Et===3&&(Gt&130023424)===Gt&&500>yt()-Iv?so(t,0):Rv|=n),Tn(t,e)}function AC(t,e){e===0&&(t.mode&1?(e=Kd,Kd<<=1,!(Kd&130023424)&&(Kd=4194304)):e=1);var n=yn();t=Es(t,e),t!==null&&(gd(t,e,n),Tn(t,n))}function eR(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),AC(t,n)}function tR(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(Q(314))}r!==null&&r.delete(e),AC(t,n)}var RC;RC=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||$n.current)En=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return En=!1,V5(t,e,n);En=!!(t.flags&131072)}else En=!1,ot&&e.flags&1048576&&zj(e,hf,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;zu(t,e),t=e.pendingProps;var s=Ra(e,dn.current);Na(e,n),s=Ev(null,e,r,t,s,n);var i=$v();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Mn(r)?(i=!0,uf(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Sv(e),s.updater=rp,e.stateNode=s,s._reactInternals=e,ny(e,r,t,n),e=iy(null,e,r,!0,i,n)):(e.tag=0,ot&&i&&gv(e),hn(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(zu(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=rR(r),t=yr(r,t),s){case 0:e=sy(null,e,r,t,n);break e;case 1:e=Ck(null,e,r,t,n);break e;case 11:e=Sk(null,e,r,t,n);break e;case 14:e=jk(null,e,r,yr(r.type,t),n);break e}throw Error(Q(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:yr(r,s),sy(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:yr(r,s),Ck(t,e,r,s,n);case 3:e:{if(yC(e),t===null)throw Error(Q(387));r=e.pendingProps,i=e.memoizedState,s=i.element,Uj(t,e),gf(e,r,null,n);var o=e.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=za(Error(Q(423)),e),e=_k(t,e,r,n,s);break e}else if(r!==s){s=za(Error(Q(424)),e),e=_k(t,e,r,n,s);break e}else for(Bn=ci(e.stateNode.containerInfo.firstChild),Wn=e,ot=!0,vr=null,n=Vj(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ia(),r===s){e=$s(t,e,n);break e}hn(t,e,r,n)}e=e.child}return e;case 5:return Zj(e),t===null&&Xg(e),r=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,Kg(r,s)?o=null:i!==null&&Kg(r,i)&&(e.flags|=32),gC(t,e),hn(t,e,o,n),e.child;case 6:return t===null&&Xg(e),null;case 13:return xC(t,e,n);case 4:return jv(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Pa(e,null,r,n):hn(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:yr(r,s),Sk(t,e,r,s,n);case 7:return hn(t,e,e.pendingProps,n),e.child;case 8:return hn(t,e,e.pendingProps.children,n),e.child;case 12:return hn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,et(pf,r._currentValue),r._currentValue=o,i!==null)if(_r(i.value,o)){if(i.children===s.children&&!$n.current){e=$s(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=ks(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),ey(i.return,n,e),a.lanes|=n;break}l=l.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(Q(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),ey(o,n,e),o=i.sibling}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}hn(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,Na(e,n),s=or(s),r=r(s),e.flags|=1,hn(t,e,r,n),e.child;case 14:return r=e.type,s=yr(r,e.pendingProps),s=yr(r.type,s),jk(t,e,r,s,n);case 15:return pC(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:yr(r,s),zu(t,e),e.tag=1,Mn(r)?(t=!0,uf(e)):t=!1,Na(e,n),uC(e,r,s),ny(e,r,s,n),iy(null,e,r,!0,t,n);case 19:return vC(t,e,n);case 22:return mC(t,e,n)}throw Error(Q(156,e.tag))};function IC(t,e){return lj(t,e)}function nR(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,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 sr(t,e,n,r){return new nR(t,e,n,r)}function Lv(t){return t=t.prototype,!(!t||!t.isReactComponent)}function rR(t){if(typeof t=="function")return Lv(t)?1:0;if(t!=null){if(t=t.$$typeof,t===sv)return 11;if(t===iv)return 14}return 2}function hi(t,e){var n=t.alternate;return n===null?(n=sr(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Bu(t,e,n,r,s,i){var o=2;if(r=t,typeof t=="function")Lv(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case da:return io(n.children,s,i,e);case rv:o=8,s|=8;break;case _g:return t=sr(12,n,e,s|2),t.elementType=_g,t.lanes=i,t;case Ng:return t=sr(13,n,e,s),t.elementType=Ng,t.lanes=i,t;case Eg:return t=sr(19,n,e,s),t.elementType=Eg,t.lanes=i,t;case ZS:return op(n,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case WS:o=10;break e;case US:o=9;break e;case sv:o=11;break e;case iv:o=14;break e;case Ws:o=16,r=null;break e}throw Error(Q(130,t==null?t:typeof t,""))}return e=sr(o,n,e,s),e.elementType=t,e.type=r,e.lanes=i,e}function io(t,e,n,r){return t=sr(7,t,r,e),t.lanes=n,t}function op(t,e,n,r){return t=sr(22,t,r,e),t.elementType=ZS,t.lanes=n,t.stateNode={isHidden:!1},t}function vm(t,e,n){return t=sr(6,t,null,e),t.lanes=n,t}function km(t,e,n){return e=sr(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function sR(t,e,n,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=em(0),this.expirationTimes=em(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=em(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Fv(t,e,n,r,s,i,o,a,l){return t=new sR(t,e,n,a,l),e===1?(e=1,i===!0&&(e|=8)):e=0,i=sr(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sv(i),t}function iR(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ca,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function PC(t){if(!t)return ji;t=t._reactInternals;e:{if(Po(t)!==t||t.tag!==1)throw Error(Q(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Mn(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Q(171))}if(t.tag===1){var n=t.type;if(Mn(n))return Pj(t,n,e)}return e}function DC(t,e,n,r,s,i,o,a,l){return t=Fv(n,r,!0,t,s,i,o,a,l),t.context=PC(null),n=t.current,r=yn(),s=fi(n),i=ks(r,s),i.callback=e??null,di(n,i,s),t.current.lanes=s,gd(t,s,r),Tn(t,r),t}function ap(t,e,n,r){var s=e.current,i=yn(),o=fi(s);return n=PC(n),e.context===null?e.context=n:e.pendingContext=n,e=ks(i,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=di(s,e,o),t!==null&&(Sr(t,s,o,i),Iu(t,s,o)),o}function jf(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Pk(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Bv(t,e){Pk(t,e),(t=t.alternate)&&Pk(t,e)}function oR(){return null}var zC=typeof reportError=="function"?reportError:function(t){console.error(t)};function Vv(t){this._internalRoot=t}lp.prototype.render=Vv.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(Q(409));ap(t,e,null,null)};lp.prototype.unmount=Vv.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;go(function(){ap(null,t,null,null)}),e[Ns]=null}};function lp(t){this._internalRoot=t}lp.prototype.unstable_scheduleHydration=function(t){if(t){var e=mj();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Gs.length&&e!==0&&e<Gs[n].priority;n++);Gs.splice(n,0,t),n===0&&yj(t)}};function Wv(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function cp(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Dk(){}function aR(t,e,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var c=jf(o);i.call(c)}}var o=DC(e,r,t,0,null,!1,!1,"",Dk);return t._reactRootContainer=o,t[Ns]=o.current,Ic(t.nodeType===8?t.parentNode:t),go(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof r=="function"){var a=r;r=function(){var c=jf(l);a.call(c)}}var l=Fv(t,0,!1,null,null,!1,!1,"",Dk);return t._reactRootContainer=l,t[Ns]=l.current,Ic(t.nodeType===8?t.parentNode:t),go(function(){ap(e,l,n,r)}),l}function dp(t,e,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var a=s;s=function(){var l=jf(o);a.call(l)}}ap(e,o,t,s)}else o=aR(n,e,t,s,r);return jf(o)}hj=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Hl(e.pendingLanes);n!==0&&(lv(e,n|1),Tn(e,yt()),!(Ve&6)&&(La=yt()+500,zi()))}break;case 13:go(function(){var r=Es(t,1);if(r!==null){var s=yn();Sr(r,t,1,s)}}),Bv(t,1)}};cv=function(t){if(t.tag===13){var e=Es(t,134217728);if(e!==null){var n=yn();Sr(e,t,134217728,n)}Bv(t,134217728)}};pj=function(t){if(t.tag===13){var e=fi(t),n=Es(t,e);if(n!==null){var r=yn();Sr(n,t,e,r)}Bv(t,e)}};mj=function(){return Je};gj=function(t,e){var n=Je;try{return Je=t,e()}finally{Je=n}};zg=function(t,e,n){switch(e){case"input":if(Tg(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var s=ep(r);if(!s)throw Error(Q(90));qS(r),Tg(r,s)}}}break;case"textarea":JS(t,n);break;case"select":e=n.value,e!=null&&Sa(t,!!n.multiple,e,!1)}};nj=Pv;rj=go;var lR={usingClientEntryPoint:!1,Events:[xd,pa,ep,ej,tj,Pv]},Al={findFiberByHostInstance:Ki,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},cR={bundleType:Al.bundleType,version:Al.version,rendererPackageName:Al.rendererPackageName,rendererConfig:Al.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Is.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=oj(t),t===null?null:t.stateNode},findFiberByHostInstance:Al.findFiberByHostInstance||oR,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var iu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!iu.isDisabled&&iu.supportsFiber)try{Gh=iu.inject(cR),Hr=iu}catch{}}Kn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lR;Kn.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Wv(e))throw Error(Q(200));return iR(t,e,null,n)};Kn.createRoot=function(t,e){if(!Wv(t))throw Error(Q(299));var n=!1,r="",s=zC;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=Fv(t,1,!1,null,null,n,!1,r,s),t[Ns]=e.current,Ic(t.nodeType===8?t.parentNode:t),new Vv(e)};Kn.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(Q(188)):(t=Object.keys(t).join(","),Error(Q(268,t)));return t=oj(e),t=t===null?null:t.stateNode,t};Kn.flushSync=function(t){return go(t)};Kn.hydrate=function(t,e,n){if(!cp(e))throw Error(Q(200));return dp(null,t,e,!0,n)};Kn.hydrateRoot=function(t,e,n){if(!Wv(t))throw Error(Q(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=zC;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=DC(e,null,t,1,n??null,s,!1,i,o),t[Ns]=e.current,Ic(t),r)for(t=0;t<r.length;t++)n=r[t],s=n._getVersion,s=s(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,s]:e.mutableSourceEagerHydrationData.push(n,s);return new lp(e)};Kn.render=function(t,e,n){if(!cp(e))throw Error(Q(200));return dp(null,t,e,!1,n)};Kn.unmountComponentAtNode=function(t){if(!cp(t))throw Error(Q(40));return t._reactRootContainer?(go(function(){dp(null,null,t,!1,function(){t._reactRootContainer=null,t[Ns]=null})}),!0):!1};Kn.unstable_batchedUpdates=Pv;Kn.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!cp(n))throw Error(Q(200));if(t==null||t._reactInternals===void 0)throw Error(Q(38));return dp(t,e,n,!1,r)};Kn.version="18.3.1-next-f1338f8080-20240426";function LC(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(LC)}catch(t){console.error(t)}}LC(),LS.exports=Kn;var kd=LS.exports;const dR=NS(kd);var FC,zk=kd;FC=zk.createRoot,zk.hydrateRoot;function yo(t,e=8){if(t.length<2)return"";let n=`M ${t[0].x} ${t[0].y}`;for(let s=1;s<t.length-1;s++){const i=t[s-1],o=t[s],a=t[s+1],l=Math.hypot(o.x-i.x,o.y-i.y),c=Math.hypot(a.x-o.x,a.y-o.y),u=Math.min(e,l/2,c/2);if(u<.5){n+=` L ${o.x} ${o.y}`;continue}const f={x:o.x-(o.x-i.x)/l*u,y:o.y-(o.y-i.y)/l*u},h={x:o.x+(a.x-o.x)/c*u,y:o.y+(a.y-o.y)/c*u};n+=` L ${f.x} ${f.y} Q ${o.x} ${o.y} ${h.x} ${h.y}`}const r=t[t.length-1];return`${n} L ${r.x} ${r.y}`}function BC(t,e){if(t.length<2||e<=0)return t;const n=t.slice(),r=n[n.length-2],s=n[n.length-1],i=Math.hypot(s.x-r.x,s.y-r.y);return i<=e||(n[n.length-1]={x:s.x-(s.x-r.x)/i*e,y:s.y-(s.y-r.y)/i*e}),n}function VC(t){const e=t[t.length-2],n=t[t.length-1];return Math.atan2(n.y-e.y,n.x-e.x)}function uR(t){const e=t[1],n=t[0];return Math.atan2(n.y-e.y,n.x-e.x)}function fR(t){let e=0,n=-1;for(let i=0;i<t.length-1;i++){const o=Math.hypot(t[i+1].x-t[i].x,t[i+1].y-t[i].y);o>n&&(n=o,e=i)}const r=t[e],s=t[e+1]??r;return{x:(r.x+s.x)/2,y:(r.y+s.y)/2,horizontal:Math.abs(s.x-r.x)>=Math.abs(s.y-r.y)}}function Ci(t){if(t.length===0)return{x:0,y:0,w:0,h:0};const e=Math.min(...t.map(i=>i.x)),n=Math.min(...t.map(i=>i.y)),r=Math.max(...t.map(i=>i.x+i.w)),s=Math.max(...t.map(i=>i.y+i.h));return{x:e,y:n,w:r-e,h:s-n}}const hR=(t,e,n,r)=>t.length*e*(r==="mono"?.6:n>=600?.56:.52);let pR={sans:'"Hanken Grotesk Variable", ui-sans-serif, system-ui, sans-serif',mono:'"JetBrains Mono Variable", ui-monospace, monospace'};function mR(){if(typeof document>"u")return;const t=document.createElement("canvas").getContext("2d");if(t)return(e,n,r,s)=>(t.font=`${r} ${n}px ${pR[s]}`,t.measureText(e).width)}let Lk;function Te(t,e=13,n=400,r="sans"){return Lk??(Lk=mR()??hR),Lk(t,e,n,r)}function Cf(t,e,n=13,r=400,s=2){const i=t.split(/\s+/).filter(Boolean),o=[];let a="";for(const u of i){const f=a?`${a} ${u}`:u;Te(f,n,r)<=e||!a?a=f:(o.push(a),a=u)}if(a&&o.push(a),o.length<=s)return o;const l=o.slice(0,s);let c=l[s-1];for(;c.length>1&&Te(`${c}…`,n,r)>e;)c=c.slice(0,-1).trimEnd();return l[s-1]=`${c}…`,l}function Nt(t,e,n=13,r=400,s="sans"){if(Te(t,n,r,s)<=e)return t;let i=t;for(;i.length>1&&Te(`${i}…`,n,r,s)>e;)i=i.slice(0,-1);return`${i.trimEnd()}…`}const gR="modulepreload",yR=function(t){return"/"+t},Fk={},Uv=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(l=>{if(l=yR(l),l in Fk)return;Fk[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":gR,c||(f.as="script"),f.crossOrigin="",f.href=l,a&&f.setAttribute("nonce",a),document.head.appendChild(f),c)return new Promise((h,m)=>{f.addEventListener("load",h),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})};let xR;const vR=()=>xR??(xR=Uv(()=>import("./elk.bundled-Bw5WzyyE.js").then(t=>t.e),[]).then(t=>new t.default)),wd={"elk.algorithm":"layered","elk.edgeRouting":"ORTHOGONAL","elk.layered.nodePlacement.strategy":"NETWORK_SIMPLEX","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.layered.considerModelOrder.strategy":"NODES_AND_EDGES"};async function bd(t){var a;const e=await(await vR()).layout(t),n=new Map,r=new Map([[e.id,{x:0,y:0}]]),s=(l,c,u,f)=>{var g;const h=c+(l.x??0),m=u+(l.y??0);r.set(l.id,{x:h,y:m}),n.set(l.id,{id:l.id,parent:f,x:h,y:m,w:l.width??0,h:l.height??0}),(g=l.children)==null||g.forEach(p=>s(p,h,m,l.id))};(a=e.children)==null||a.forEach(l=>s(l,0,0));const i=new Map,o=l=>{var c,u;(c=l.edges)==null||c.forEach(f=>{var v;const h=f.container??l.id,m=r.get(h)??{x:0,y:0},g=k=>({x:k.x+m.x,y:k.y+m.y}),p=(v=f.sections)==null?void 0:v[0],x=p?[p.startPoint,...p.bendPoints??[],p.endPoint].map(g):[],y=(f.labels??[]).map(k=>({text:k.text??"",x:(k.x??0)+m.x,y:(k.y??0)+m.y,w:k.width??0,h:k.height??0}));i.set(f.id,{id:f.id,points:x,labels:y})}),(u=l.children)==null||u.forEach(o)};return o(e),{width:e.width??0,height:e.height??0,nodes:n,edges:i}}var Be;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Be||(Be={}));var Bk;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Bk||(Bk={}));const he=Be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zs=t=>{switch(typeof t){case"undefined":return he.undefined;case"string":return he.string;case"number":return Number.isNaN(t)?he.nan:he.number;case"boolean":return he.boolean;case"function":return he.function;case"bigint":return he.bigint;case"symbol":return he.symbol;case"object":return Array.isArray(t)?he.array:t===null?he.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?he.promise:typeof Map<"u"&&t instanceof Map?he.map:typeof Set<"u"&&t instanceof Set?he.set:typeof Date<"u"&&t instanceof Date?he.date:he.object;default:return he.unknown}},X=Be.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);let xo=class WC extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),r}static assert(e){if(!(e instanceof WC))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Be.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};xo.create=t=>new xo(t);const yy=(t,e)=>{let n;switch(t.code){case X.invalid_type:t.received===he.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case X.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Be.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:n=`Unrecognized key(s) in object: ${Be.joinValues(t.keys,", ")}`;break;case X.invalid_union:n="Invalid input";break;case X.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Be.joinValues(t.options)}`;break;case X.invalid_enum_value:n=`Invalid enum value. Expected ${Be.joinValues(t.options)}, received '${t.received}'`;break;case X.invalid_arguments:n="Invalid function arguments";break;case X.invalid_return_type:n="Invalid function return type";break;case X.invalid_date:n="Invalid date";break;case X.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Be.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case X.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case X.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case X.custom:n="Invalid input";break;case X.invalid_intersection_types:n="Intersection results could not be merged";break;case X.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case X.not_finite:n="Number must be finite";break;default:n=e.defaultError,Be.assertNever(t)}return{message:n}};let kR=yy;function wR(){return kR}const bR=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function ie(t,e){const n=wR(),r=bR({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===yy?void 0:yy].filter(s=>!!s)});t.common.issues.push(r)}let Hn=class UC{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return je;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return UC.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return je;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}};const je=Object.freeze({status:"aborted"}),Kl=t=>({status:"dirty",value:t}),cr=t=>({status:"valid",value:t}),Vk=t=>t.status==="aborted",Wk=t=>t.status==="dirty",Fa=t=>t.status==="valid",_f=t=>typeof Promise<"u"&&t instanceof Promise;var ge;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ge||(ge={}));let Jr=class{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const Uk=(t,e)=>{if(Fa(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new xo(t.common.issues);return this._error=n,this._error}}};function Oe(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}let Le=class{get description(){return this._def.description}_getType(e){return Zs(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Zs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Hn,ctx:{common:e.parent.common,data:e.data,parsedType:Zs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(_f(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Zs(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Uk(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Zs(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return Fa(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>Fa(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Zs(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(_f(s)?s:Promise.resolve(s));return Uk(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:X.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new vo({schema:this,typeName:Ce.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ws.create(this,this._def)}nullable(){return ko.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ba.create(this)}promise(){return Af.create(this,this._def)}or(e){return Ef.create([this,e],this._def)}and(e){return $f.create(this,e,this._def)}transform(e){return new vo({...Oe(this._def),schema:this,typeName:Ce.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Rf({...Oe(this._def),innerType:this,defaultValue:n,typeName:Ce.ZodDefault})}brand(){return new GC({typeName:Ce.ZodBranded,type:this,...Oe(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new If({...Oe(this._def),innerType:this,catchValue:n,typeName:Ce.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return ZR.create(this,e)}readonly(){return Pf.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const SR=/^c[^\s-]{8,}$/i,jR=/^[0-9a-z]+$/,CR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,_R=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,NR=/^[a-z0-9_-]{21}$/i,ER=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$R=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,MR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,TR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let wm;const OR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,AR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,RR=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,IR=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,PR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,DR=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ZC="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",zR=new RegExp(`^${ZC}$`);function HC(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function LR(t){return new RegExp(`^${HC(t)}$`)}function FR(t){let e=`${ZC}T${HC(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function BR(t,e){return!!((e==="v4"||!e)&&OR.test(t)||(e==="v6"||!e)&&RR.test(t))}function VR(t,e){if(!ER.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function WR(t,e){return!!((e==="v4"||!e)&&AR.test(t)||(e==="v6"||!e)&&IR.test(t))}let Nf=class Jl extends Le{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==he.string){const i=this._getOrReturnCtx(e);return ie(i,{code:X.invalid_type,expected:he.string,received:i.parsedType}),je}const r=new Hn;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),ie(s,{code:X.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),ie(s,{code:X.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?ie(s,{code:X.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&ie(s,{code:X.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")MR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"email",code:X.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")wm||(wm=new RegExp(TR,"u")),wm.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"emoji",code:X.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")_R.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"uuid",code:X.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")NR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"nanoid",code:X.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")SR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"cuid",code:X.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")jR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"cuid2",code:X.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")CR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"ulid",code:X.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),ie(s,{validation:"url",code:X.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"regex",code:X.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),ie(s,{code:X.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),ie(s,{code:X.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),ie(s,{code:X.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?FR(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{code:X.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?zR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{code:X.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?LR(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{code:X.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?$R.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"duration",code:X.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?BR(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"ip",code:X.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?VR(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"jwt",code:X.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?WR(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"cidr",code:X.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?PR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"base64",code:X.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?DR.test(e.data)||(s=this._getOrReturnCtx(e,s),ie(s,{validation:"base64url",code:X.invalid_string,message:i.message}),r.dirty()):Be.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:X.invalid_string,...ge.errToObj(r)})}_addCheck(e){return new Jl({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ge.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ge.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ge.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ge.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ge.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ge.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ge.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ge.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ge.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ge.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ge.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ge.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ge.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...ge.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...ge.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ge.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...ge.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...ge.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...ge.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...ge.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...ge.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...ge.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...ge.errToObj(n)})}nonempty(e){return this.min(1,ge.errToObj(e))}trim(){return new Jl({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Jl({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Jl({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Nf.create=t=>new Nf({checks:[],typeName:Ce.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Oe(t)});function UR(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}let xy=class vy extends Le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==he.number){const i=this._getOrReturnCtx(e);return ie(i,{code:X.invalid_type,expected:he.number,received:i.parsedType}),je}let r;const s=new Hn;for(const i of this._def.checks)i.kind==="int"?Be.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ie(r,{code:X.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ie(r,{code:X.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ie(r,{code:X.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?UR(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),ie(r,{code:X.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ie(r,{code:X.not_finite,message:i.message}),s.dirty()):Be.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ge.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ge.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ge.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ge.toString(n))}setLimit(e,n,r,s){return new vy({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ge.toString(s)}]})}_addCheck(e){return new vy({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ge.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ge.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ge.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ge.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ge.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ge.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ge.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ge.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ge.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Be.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};xy.create=t=>new xy({checks:[],typeName:Ce.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Oe(t)});let Zk=class ky extends Le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==he.bigint)return this._getInvalidInput(e);let r;const s=new Hn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ie(r,{code:X.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ie(r,{code:X.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ie(r,{code:X.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Be.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return ie(n,{code:X.invalid_type,expected:he.bigint,received:n.parsedType}),je}gte(e,n){return this.setLimit("min",e,!0,ge.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ge.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ge.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ge.toString(n))}setLimit(e,n,r,s){return new ky({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ge.toString(s)}]})}_addCheck(e){return new ky({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ge.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ge.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ge.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ge.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ge.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Zk.create=t=>new Zk({checks:[],typeName:Ce.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Oe(t)});let wy=class extends Le{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==he.boolean){const r=this._getOrReturnCtx(e);return ie(r,{code:X.invalid_type,expected:he.boolean,received:r.parsedType}),je}return cr(e.data)}};wy.create=t=>new wy({typeName:Ce.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Oe(t)});let Hk=class qC extends Le{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==he.date){const i=this._getOrReturnCtx(e);return ie(i,{code:X.invalid_type,expected:he.date,received:i.parsedType}),je}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return ie(i,{code:X.invalid_date}),je}const r=new Hn;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),ie(s,{code:X.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),ie(s,{code:X.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Be.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new qC({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ge.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ge.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Hk.create=t=>new Hk({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Ce.ZodDate,...Oe(t)});let qk=class extends Le{_parse(e){if(this._getType(e)!==he.symbol){const r=this._getOrReturnCtx(e);return ie(r,{code:X.invalid_type,expected:he.symbol,received:r.parsedType}),je}return cr(e.data)}};qk.create=t=>new qk({typeName:Ce.ZodSymbol,...Oe(t)});let by=class extends Le{_parse(e){if(this._getType(e)!==he.undefined){const r=this._getOrReturnCtx(e);return ie(r,{code:X.invalid_type,expected:he.undefined,received:r.parsedType}),je}return cr(e.data)}};by.create=t=>new by({typeName:Ce.ZodUndefined,...Oe(t)});let Sy=class extends Le{_parse(e){if(this._getType(e)!==he.null){const r=this._getOrReturnCtx(e);return ie(r,{code:X.invalid_type,expected:he.null,received:r.parsedType}),je}return cr(e.data)}};Sy.create=t=>new Sy({typeName:Ce.ZodNull,...Oe(t)});let Kk=class extends Le{constructor(){super(...arguments),this._any=!0}_parse(e){return cr(e.data)}};Kk.create=t=>new Kk({typeName:Ce.ZodAny,...Oe(t)});let jy=class extends Le{constructor(){super(...arguments),this._unknown=!0}_parse(e){return cr(e.data)}};jy.create=t=>new jy({typeName:Ce.ZodUnknown,...Oe(t)});let _i=class extends Le{_parse(e){const n=this._getOrReturnCtx(e);return ie(n,{code:X.invalid_type,expected:he.never,received:n.parsedType}),je}};_i.create=t=>new _i({typeName:Ce.ZodNever,...Oe(t)});let Jk=class extends Le{_parse(e){if(this._getType(e)!==he.undefined){const r=this._getOrReturnCtx(e);return ie(r,{code:X.invalid_type,expected:he.void,received:r.parsedType}),je}return cr(e.data)}};Jk.create=t=>new Jk({typeName:Ce.ZodVoid,...Oe(t)});let Ba=class Vu extends Le{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==he.array)return ie(n,{code:X.invalid_type,expected:he.array,received:n.parsedType}),je;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(ie(n,{code:o?X.too_big:X.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(ie(n,{code:X.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(ie(n,{code:X.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new Jr(n,o,n.path,a)))).then(o=>Hn.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new Jr(n,o,n.path,a)));return Hn.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Vu({...this._def,minLength:{value:e,message:ge.toString(n)}})}max(e,n){return new Vu({...this._def,maxLength:{value:e,message:ge.toString(n)}})}length(e,n){return new Vu({...this._def,exactLength:{value:e,message:ge.toString(n)}})}nonempty(e){return this.min(1,e)}};Ba.create=(t,e)=>new Ba({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ce.ZodArray,...Oe(e)});function Yo(t){if(t instanceof Ms){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=ws.create(Yo(r))}return new Ms({...t._def,shape:()=>e})}else return t instanceof Ba?new Ba({...t._def,type:Yo(t.element)}):t instanceof ws?ws.create(Yo(t.unwrap())):t instanceof ko?ko.create(Yo(t.unwrap())):t instanceof Uc?Uc.create(t.items.map(e=>Yo(e))):t}let Ms=class mr extends Le{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Be.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==he.object){const c=this._getOrReturnCtx(e);return ie(c,{code:X.invalid_type,expected:he.object,received:c.parsedType}),je}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof _i&&this._def.unknownKeys==="strip"))for(const c in s.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=i[c],f=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Jr(s,f,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof _i){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")a.length>0&&(ie(s,{code:X.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const f=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Jr(s,f,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const f=await u.key,h=await u.value;c.push({key:f,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>Hn.mergeObjectSync(r,c)):Hn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ge.errToObj,new mr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:ge.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new mr({...this._def,unknownKeys:"strip"})}passthrough(){return new mr({...this._def,unknownKeys:"passthrough"})}extend(e){return new mr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new mr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ce.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new mr({...this._def,catchall:e})}pick(e){const n={};for(const r of Be.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new mr({...this._def,shape:()=>n})}omit(e){const n={};for(const r of Be.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new mr({...this._def,shape:()=>n})}deepPartial(){return Yo(this)}partial(e){const n={};for(const r of Be.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new mr({...this._def,shape:()=>n})}required(e){const n={};for(const r of Be.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof ws;)i=i._def.innerType;n[r]=i}return new mr({...this._def,shape:()=>n})}keyof(){return JC(Be.objectKeys(this.shape))}};Ms.create=(t,e)=>new Ms({shape:()=>t,unknownKeys:"strip",catchall:_i.create(),typeName:Ce.ZodObject,...Oe(e)});Ms.strictCreate=(t,e)=>new Ms({shape:()=>t,unknownKeys:"strict",catchall:_i.create(),typeName:Ce.ZodObject,...Oe(e)});Ms.lazycreate=(t,e)=>new Ms({shape:t,unknownKeys:"strip",catchall:_i.create(),typeName:Ce.ZodObject,...Oe(e)});let Ef=class extends Le{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new xo(a.ctx.common.issues));return ie(n,{code:X.invalid_union,unionErrors:o}),je}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new xo(l));return ie(n,{code:X.invalid_union,unionErrors:a}),je}}get options(){return this._def.options}};Ef.create=(t,e)=>new Ef({options:t,typeName:Ce.ZodUnion,...Oe(e)});const ds=t=>t instanceof Tf?ds(t.schema):t instanceof vo?ds(t.innerType()):t instanceof Of?[t.value]:t instanceof up?t.options:t instanceof Ey?Be.objectValues(t.enum):t instanceof Rf?ds(t._def.innerType):t instanceof by?[void 0]:t instanceof Sy?[null]:t instanceof ws?[void 0,...ds(t.unwrap())]:t instanceof ko?[null,...ds(t.unwrap())]:t instanceof GC||t instanceof Pf?ds(t.unwrap()):t instanceof If?ds(t._def.innerType):[];class Zv extends Le{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==he.object)return ie(n,{code:X.invalid_type,expected:he.object,received:n.parsedType}),je;const r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(ie(n,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),je)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const i of n){const o=ds(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new Zv({typeName:Ce.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...Oe(r)})}}function Cy(t,e){const n=Zs(t),r=Zs(e);if(t===e)return{valid:!0,data:t};if(n===he.object&&r===he.object){const s=Be.objectKeys(e),i=Be.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const l=Cy(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===he.array&&r===he.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],l=Cy(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===he.date&&r===he.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}let $f=class extends Le{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Vk(i)||Vk(o))return je;const a=Cy(i.value,o.value);return a.valid?((Wk(i)||Wk(o))&&n.dirty(),{status:n.value,value:a.data}):(ie(r,{code:X.invalid_intersection_types}),je)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};$f.create=(t,e,n)=>new $f({left:t,right:e,typeName:Ce.ZodIntersection,...Oe(n)});let Uc=class KC extends Le{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==he.array)return ie(r,{code:X.invalid_type,expected:he.array,received:r.parsedType}),je;if(r.data.length<this._def.items.length)return ie(r,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),je;!this._def.rest&&r.data.length>this._def.items.length&&(ie(r,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Jr(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>Hn.mergeArray(n,o)):Hn.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new KC({...this._def,rest:e})}};Uc.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Uc({items:t,typeName:Ce.ZodTuple,rest:null,...Oe(e)})};class Mf extends Le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==he.object)return ie(r,{code:X.invalid_type,expected:he.object,received:r.parsedType}),je;const s=[],i=this._def.keyType,o=this._def.valueType;for(const a in r.data)s.push({key:i._parse(new Jr(r,a,r.path,a)),value:o._parse(new Jr(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Hn.mergeObjectAsync(n,s):Hn.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Le?new Mf({keyType:e,valueType:n,typeName:Ce.ZodRecord,...Oe(r)}):new Mf({keyType:Nf.create(),valueType:e,typeName:Ce.ZodRecord,...Oe(n)})}}let Gk=class extends Le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==he.map)return ie(r,{code:X.invalid_type,expected:he.map,received:r.parsedType}),je;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new Jr(r,a,r.path,[c,"key"])),value:i._parse(new Jr(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return je;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return je;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}};Gk.create=(t,e,n)=>new Gk({valueType:e,keyType:t,typeName:Ce.ZodMap,...Oe(n)});let Yk=class _y extends Le{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==he.set)return ie(r,{code:X.invalid_type,expected:he.set,received:r.parsedType}),je;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(ie(r,{code:X.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(ie(r,{code:X.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return je;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new Jr(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new _y({...this._def,minSize:{value:e,message:ge.toString(n)}})}max(e,n){return new _y({...this._def,maxSize:{value:e,message:ge.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Yk.create=(t,e)=>new Yk({valueType:t,minSize:null,maxSize:null,typeName:Ce.ZodSet,...Oe(e)});let Tf=class extends Le{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};Tf.create=(t,e)=>new Tf({getter:t,typeName:Ce.ZodLazy,...Oe(e)});let Of=class extends Le{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ie(n,{received:n.data,code:X.invalid_literal,expected:this._def.value}),je}return{status:"valid",value:e.data}}get value(){return this._def.value}};Of.create=(t,e)=>new Of({value:t,typeName:Ce.ZodLiteral,...Oe(e)});function JC(t,e){return new up({values:t,typeName:Ce.ZodEnum,...Oe(e)})}let up=class Ny extends Le{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return ie(n,{expected:Be.joinValues(r),received:n.parsedType,code:X.invalid_type}),je}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return ie(n,{received:n.data,code:X.invalid_enum_value,options:r}),je}return cr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Ny.create(e,{...this._def,...n})}exclude(e,n=this._def){return Ny.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};up.create=JC;let Ey=class extends Le{_parse(e){const n=Be.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==he.string&&r.parsedType!==he.number){const s=Be.objectValues(n);return ie(r,{expected:Be.joinValues(s),received:r.parsedType,code:X.invalid_type}),je}if(this._cache||(this._cache=new Set(Be.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=Be.objectValues(n);return ie(r,{received:r.data,code:X.invalid_enum_value,options:s}),je}return cr(e.data)}get enum(){return this._def.values}};Ey.create=(t,e)=>new Ey({values:t,typeName:Ce.ZodNativeEnum,...Oe(e)});let Af=class extends Le{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==he.promise&&n.common.async===!1)return ie(n,{code:X.invalid_type,expected:he.promise,received:n.parsedType}),je;const r=n.parsedType===he.promise?n.data:Promise.resolve(n.data);return cr(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Af.create=(t,e)=>new Af({type:t,typeName:Ce.ZodPromise,...Oe(e)});let vo=class extends Le{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{ie(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return je;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?je:l.status==="dirty"||n.value==="dirty"?Kl(l.value):l});{if(n.value==="aborted")return je;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?je:a.status==="dirty"||n.value==="dirty"?Kl(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?je:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?je:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Fa(o))return je;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Fa(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):je);Be.assertNever(s)}};vo.create=(t,e,n)=>new vo({schema:t,typeName:Ce.ZodEffects,effect:e,...Oe(n)});vo.createWithPreprocess=(t,e,n)=>new vo({schema:e,effect:{type:"preprocess",transform:t},typeName:Ce.ZodEffects,...Oe(n)});let ws=class extends Le{_parse(e){return this._getType(e)===he.undefined?cr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ws.create=(t,e)=>new ws({innerType:t,typeName:Ce.ZodOptional,...Oe(e)});let ko=class extends Le{_parse(e){return this._getType(e)===he.null?cr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ko.create=(t,e)=>new ko({innerType:t,typeName:Ce.ZodNullable,...Oe(e)});let Rf=class extends Le{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===he.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Rf.create=(t,e)=>new Rf({innerType:t,typeName:Ce.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Oe(e)});let If=class extends Le{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return _f(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new xo(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new xo(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};If.create=(t,e)=>new If({innerType:t,typeName:Ce.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Oe(e)});let Qk=class extends Le{_parse(e){if(this._getType(e)!==he.nan){const r=this._getOrReturnCtx(e);return ie(r,{code:X.invalid_type,expected:he.nan,received:r.parsedType}),je}return{status:"valid",value:e.data}}};Qk.create=t=>new Qk({typeName:Ce.ZodNaN,...Oe(t)});let GC=class extends Le{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},ZR=class YC extends Le{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?je:i.status==="dirty"?(n.dirty(),Kl(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?je:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new YC({in:e,out:n,typeName:Ce.ZodPipeline})}},Pf=class extends Le{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Fa(s)&&(s.value=Object.freeze(s.value)),s);return _f(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};Pf.create=(t,e)=>new Pf({innerType:t,typeName:Ce.ZodReadonly,...Oe(e)});var Ce;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ce||(Ce={}));const W=Nf.create,On=xy.create,jr=wy.create,QC=jy.create;_i.create;const ue=Ba.create,be=Ms.create,Do=Ef.create,Hv=Zv.create;$f.create;Uc.create;const Qs=Mf.create,XC=Tf.create,un=Of.create,mt=up.create;Af.create;ws.create;ko.create;const se=W().regex(/^[a-z0-9][a-z0-9-_.]*$/,'Identifiers use lowercase letters, digits, "-", "_" and "."'),e_=be({path:W(),line:On().int().positive().optional(),symbol:W().optional(),repository:W().optional()}),t_=Qs(W(),Do([W(),On(),jr()])),Sd=Qs(W(),QC()),n_=W().regex(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/,'Extension kinds look like "extension/kind"'),r_=mt(["person","system","web-app","service","gateway","database","cache","queue","external","module","interface","library"]),HR=Do([r_,n_]),Df=be({id:se,kind:HR,name:W().min(1),summary:W(),description:W().optional(),parent:se.optional(),technology:W().optional(),tags:ue(W()).default([]),sourceRefs:ue(e_).default([]),metadata:t_.default({}),ext:Sd.default({})}),s_=mt(["uses","calls","reads","writes","reads-writes","publishes","subscribes","depends-on","implements"]),qR=Do([s_,n_]),zf=be({id:se,kind:qR,source:se,target:se,label:W(),description:W().optional(),protocol:W().optional(),data:ue(se).default([]),metadata:t_.default({}),ext:Sd.default({})}),KR=be({name:W(),type:W(),description:W().optional(),primaryKey:jr().default(!1),nullable:jr().default(!1),unique:jr().default(!1),references:be({dataType:se,field:W()}).optional()}),JR=mt(["table","record","event","document"]),GR=be({id:se,kind:JR,name:W(),summary:W(),description:W().optional(),fields:ue(KR).default([]),ownedBy:se.optional(),storedIn:se.optional(),sourceRefs:ue(e_).default([]),ext:Sd.default({})}),Xk=mt(["one","zero-or-one","many","one-or-many"]),YR=be({id:se,from:se,to:se,fromCardinality:Xk,toCardinality:Xk,label:W(),via:W().optional(),logical:jr().default(!1)}),QR=be({id:se,source:se,target:se,data:ue(se).min(1),label:W(),description:W().optional(),via:se.optional()}),XR=mt(["call","return","async","self"]),eI=be({type:un("message"),id:se,kind:XR,from:se,to:se,label:W(),description:W().optional(),relationship:se.optional(),data:ue(se).default([])}),tI=XC(()=>be({type:un("fragment"),id:se,kind:mt(["alt","opt","loop","par"]),label:W(),branches:ue(be({guard:W(),steps:ue(i_)})).min(1)})),i_=XC(()=>Do([eI,tI])),nI=be({kind:un("interaction"),id:se,name:W(),summary:W(),description:W().optional(),participants:ue(se).min(2),steps:ue(i_).min(1)}),rI=be({id:se,kind:mt(["start","end","action","decision","merge","fork","join"]),label:W(),description:W().optional(),performedBy:se.optional(),outcome:mt(["success","failure"]).optional()}),sI=be({id:se,from:se,to:se,guard:W().optional()}),iI=be({kind:un("process"),id:se,name:W(),summary:W(),description:W().optional(),nodes:ue(rI).min(2),flows:ue(sI).min(1)}),oI=be({id:se,kind:mt(["initial","normal","final"]),name:W(),description:W().optional(),entryActions:ue(W()).default([]),outcome:mt(["success","failure","neutral"]).default("neutral")}),o_=be({id:se,from:se,to:se,event:W(),guard:W().optional(),actions:ue(W()).default([]),description:W().optional(),triggeredBy:se.optional()}),aI=be({kind:un("state-machine"),id:se,name:W(),summary:W(),description:W().optional(),subject:se.optional(),owner:se.optional(),states:ue(oI).min(2),transitions:ue(o_).min(1)}),lI=Hv("kind",[nI,iI,aI]),cI=be({id:se,name:W(),summary:W(),area:W(),actors:ue(se).min(1),supporting:ue(se).default([]),realizedBy:ue(se).default([]),behaviors:ue(se).default([]),includes:ue(se).default([]),ext:Sd.default({})}),dI=be({entities:ue(Df).default([]),relationships:ue(zf).default([]),dataTypes:ue(GR).default([]),dataRelations:ue(YR).default([]),dataFlows:ue(QR).default([]),behaviors:ue(lI).default([]),capabilities:ue(cI).default([])});mt(["extension","map","architecture","sequence","dataflow","activity","erd","state","usecase","dependency"]);const ew=["overview","behavior","data","structure","capabilities"],a_=W().min(1),l_=mt(["right","down"]),uI=be({x:On(),y:On()}),ts=be({id:se,title:W(),description:W(),category:a_,positions:Qs(W(),uI).default({}),ext:Sd.default({})}),c_=be({id:se,label:W(),description:W().optional(),members:ue(se)}),d_=ts.extend({type:un("architecture"),entities:ue(se).min(1),relationships:ue(se).optional(),groups:ue(c_).default([]),collapsed:ue(se).default([]),layout:be({direction:l_.default("right")}).default({})}),u_=ts.extend({type:un("map"),entities:ue(se).min(1),relationships:ue(se).optional(),passThrough:ue(se).default([]),collapsed:ue(se).default([]),layout:be({direction:l_.default("right")}).default({})}),f_=ts.extend({type:un("sequence"),interaction:se}),h_=ts.extend({type:un("dataflow"),flows:ue(se).min(1),showControlFlow:jr().default(!0)}),p_=ts.extend({type:un("activity"),process:se,swimlanes:jr().default(!0)}),m_=ts.extend({type:un("erd"),dataTypes:ue(se).min(1),groupByStore:jr().default(!0),fieldLimit:On().int().positive().default(6)}),g_=ts.extend({type:un("state"),stateMachine:se}),y_=ts.extend({type:un("usecase"),capabilities:ue(se).min(1)}),x_=ts.extend({type:un("dependency"),entities:ue(se).min(1),relationships:ue(se).optional(),layers:ue(c_).min(1)}),fI=ts.extend({type:un("extension"),extension:W().regex(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/),entities:ue(se).default([]),data:QC()}),hI=Hv("type",[d_,u_,f_,h_,p_,m_,g_,y_,x_,fI]),ss={id:se.optional(),title:W().optional(),description:W().default(""),category:a_.default("walkthrough")},v_=Hv("type",[u_.extend(ss),f_.extend(ss),g_.extend(ss),p_.extend(ss),d_.extend(ss),h_.extend(ss),m_.extend(ss),y_.extend(ss),x_.extend(ss)]),pI=mt(["lapis","malachite","ochre","umber","tyrian","slate","poney","verdigris"]),fp=Do([pI,W().regex(/^#[0-9a-fA-F]{6}$/)]),mI=mt(["card","cylinder","person","stack","frame","chip"]),gI=be({shape:mI,tone:fp,icon:W(),label:W()}),yI=be({pattern:mt(["solid","dashed","dotted"]),head:mt(["arrow","open-arrow","none","triangle"])}),tw=be({tone:fp.optional(),icon:W().optional(),width:On().positive().optional(),height:On().positive().optional(),emphasis:jr().optional()}),xI=be({kinds:Qs(W(),gI),relationships:Qs(W(),yI),elements:Qs(W(),tw).default({}),views:Qs(W(),Qs(W(),tw)).default({})}),Va=W().regex(/^[a-zA-Z]+:[a-z0-9][a-z0-9-_.:#]*$/,'A ref looks like "entity:order-service"'),vI=mt(["new","changed","removed"]),kI=be({ref:Va,state:vI,note:W().optional()}),wI=be({kind:mt(["add","del","ctx"]),old:On().int().positive().optional(),new:On().int().positive().optional(),text:W()}),bI=be({header:W().optional(),lines:ue(wI).min(1)}),SI=be({path:W(),title:W().optional(),hunks:ue(bI).min(1).optional(),start:On().int().positive().optional(),text:W().optional(),notes:ue(be({line:On().int().positive(),text:W()})).default([])}).refine(t=>t.hunks?t.text===void 0&&t.start===void 0:t.text!==void 0&&t.start!==void 0,{message:'Give "hunks" (a diff), or "start" and "text" (an excerpt), not both'}).transform(({start:t,text:e,hunks:n,...r})=>({...r,hunks:n??[{lines:e.replace(/\n$/,"").split(`
41
- `).map((s,i)=>({kind:"ctx",new:t+i,text:s}))}]})),k_=mt(["look","routine"]),jI=mt(["flow","attention","hot-path","slow","failing","blocked"]),CI=be({target:Va,as:jI,tone:fp.optional()}),_I=be({target:Va,text:W().min(1),tone:fp.optional()}),NI=be({ref:Va,caption:W().optional()}),EI=be({id:se,title:W(),text:W(),risk:k_.default("routine"),view:Do([se,v_]).optional(),focus:ue(Va).default([]),callouts:ue(be({target:Va,text:W()})).default([]),cases:ue(be({when:W(),then:W(),note:W().optional()})).default([]),proof:ue(be({text:W(),source:W().optional(),test:W().optional(),missing:jr().default(!1)})).default([]),question:W().optional(),questions:ue(W()).default([]),code:ue(SI).default([]),trace:ue(NI).default([]),effects:ue(CI).default([]),badges:ue(_I).default([])}),$I=mt(["change","tour"]),MI=be({id:se,kind:$I.default("change"),title:W(),summary:W(),source:be({kind:W(),ref:W().optional(),head:W().optional(),url:W().optional(),repository:W().optional(),base:W().optional(),author:W().optional(),files:On().int().nonnegative().optional(),added:On().int().nonnegative().optional(),removed:On().int().nonnegative().optional()}).optional(),story:be({text:W(),before:W().optional(),after:W().optional()}),overview:Do([se,v_]).optional(),verdict:be({risk:k_,facts:ue(be({label:W(),value:W()})).default([]),findings:ue(be({text:W(),severity:mt(["risk","note"]).default("risk"),scene:se.optional()})).default([])}).optional(),marks:ue(kI).default([]),removed:be({entities:ue(Df).default([]),relationships:ue(zf).default([]),transitions:ue(be({stateMachine:se,transition:o_})).default([])}).default({}),scenes:ue(EI).min(1)}),w_={kinds:{person:{shape:"person",tone:"slate",icon:"user-round",label:"Person"},system:{shape:"frame",tone:"slate",icon:"boxes",label:"Software system"},"web-app":{shape:"card",tone:"tyrian",icon:"app-window",label:"Web app"},gateway:{shape:"card",tone:"slate",icon:"route",label:"Gateway"},service:{shape:"card",tone:"lapis",icon:"server",label:"Service"},database:{shape:"cylinder",tone:"malachite",icon:"database",label:"Database"},cache:{shape:"cylinder",tone:"verdigris",icon:"zap",label:"Cache"},queue:{shape:"stack",tone:"ochre",icon:"waypoints",label:"Event bus"},external:{shape:"card",tone:"umber",icon:"globe",label:"External system"},module:{shape:"chip",tone:"lapis",icon:"box",label:"Module"},interface:{shape:"chip",tone:"tyrian",icon:"plug",label:"Interface"},library:{shape:"chip",tone:"slate",icon:"library",label:"Library"}},relationships:{uses:{pattern:"solid",head:"arrow"},calls:{pattern:"solid",head:"arrow"},reads:{pattern:"solid",head:"arrow"},writes:{pattern:"solid",head:"arrow"},"reads-writes":{pattern:"solid",head:"none"},publishes:{pattern:"dashed",head:"open-arrow"},subscribes:{pattern:"dashed",head:"open-arrow"},"depends-on":{pattern:"solid",head:"arrow"},implements:{pattern:"dashed",head:"triangle"}},elements:{},views:{}},b_="0.1.0",TI=be({id:se,name:W(),description:W().default(""),repository:W().optional(),defaultView:se.optional()}),OI=be({name:W().regex(/^[a-z][a-z0-9-]*$/),version:W(),required:jr().default(!1)}),AI=be({poneyVersion:un(b_),project:TI,extensions:ue(OI).default([]),model:dI.default({}),views:ue(hI).default([]),walkthroughs:ue(MI).default([]),presentation:xI.default(w_)}),RI=AI.transform(t=>{const e=[...t.views],n=(s,i,o)=>{if(s===void 0||typeof s=="string")return s;const a={...s,id:s.id??i,title:s.title??o};return e.push(a),a.id},r=t.walkthroughs.map(s=>({...s,overview:n(s.overview,`${s.id}.overview`,s.title),scenes:s.scenes.map(i=>({...i,view:n(i.view,`${s.id}.${i.id}`,i.title)}))}));return{...t,views:e,walkthroughs:r}});function nw(t){const e=t.indexOf("/");return e>0?t.slice(0,e):void 0}function Wr(t,e,n){var o,a;const r=(o=t.facets)==null?void 0:o[e],s=(a=n==null?void 0:n.ext)==null?void 0:a[t.name];if(!r||s===void 0)return;const i=r.safeParse(s);return i.success?i.data:void 0}const II={shape:"card",tone:"slate",icon:"box",label:"Element"};class PI{constructor(e){en(this,"entities",new Map);en(this,"relationships",new Map);en(this,"dataTypes",new Map);en(this,"dataRelations",new Map);en(this,"dataFlows",new Map);en(this,"behaviors",new Map);en(this,"capabilities",new Map);en(this,"views",new Map);en(this,"out",new Map);en(this,"in",new Map);en(this,"kids",new Map);en(this,"flatCache",new Map);en(this,"outgoing",e=>this.out.get(e)??[]);en(this,"incoming",e=>this.in.get(e)??[]);en(this,"children",e=>this.kids.get(e)??[]);this.doc=e;const n=e.model;n.entities.forEach(r=>this.entities.set(r.id,r)),n.relationships.forEach(r=>{this.relationships.set(r.id,r),Rl(this.out,r.source,r),Rl(this.in,r.target,r)}),n.dataTypes.forEach(r=>this.dataTypes.set(r.id,r)),n.dataRelations.forEach(r=>this.dataRelations.set(r.id,r)),n.dataFlows.forEach(r=>this.dataFlows.set(r.id,r)),n.behaviors.forEach(r=>this.behaviors.set(r.id,r)),n.capabilities.forEach(r=>this.capabilities.set(r.id,r)),n.entities.forEach(r=>r.parent&&Rl(this.kids,r.parent,r)),e.views.forEach(r=>this.views.set(r.id,r))}ancestors(e){var s;const n=[];let r=(s=this.entities.get(e))==null?void 0:s.parent;for(;r;){const i=this.entities.get(r);if(!i)break;n.push(i),r=i.parent}return n}style(e,n){var l;const r=typeof e=="string"?this.entities.get(e):e,s=this.doc.presentation,i=(r&&s.kinds[r.kind])??II,o=(r?s.elements[r.id]:void 0)??{},a=(r&&n?(l=s.views[n])==null?void 0:l[r.id]:void 0)??{};return{...i,tone:a.tone??o.tone??i.tone,icon:a.icon??o.icon??i.icon,emphasis:a.emphasis??o.emphasis??!1}}interaction(e){const n=this.behaviors.get(e);return(n==null?void 0:n.kind)==="interaction"?n:void 0}process(e){const n=this.behaviors.get(e);return(n==null?void 0:n.kind)==="process"?n:void 0}stateMachine(e){const n=this.behaviors.get(e);return(n==null?void 0:n.kind)==="state-machine"?n:void 0}messages(e){const n=this.flatCache.get(e);if(n)return n;const r=[],s=(o,a)=>{for(const l of o)l.type==="message"?r.push({message:l,number:r.length+1,context:a}):l.branches.forEach(c=>s(c.steps,[...a,{fragment:l,guard:c.guard}]))},i=this.interaction(e);return i&&s(i.steps,[]),this.flatCache.set(e,r),r}findFragment(e,n){let r;const s=o=>o.forEach(a=>{a.type==="fragment"&&(a.id===n&&(r=a),a.branches.forEach(l=>s(l.steps)))}),i=this.interaction(e);return i&&s(i.steps),r}behaviorsInvolving(e){return this.doc.model.behaviors.filter(n=>n.kind==="interaction"?n.participants.includes(e):n.kind==="process"?n.nodes.some(r=>r.performedBy===e):n.owner===e||n.transitions.some(r=>r.triggeredBy===e))}dataOf(e){const n=new Map,r=new Map;for(const i of this.doc.model.dataFlows)i.target===e&&i.data.forEach(o=>Rl(n,o,i)),i.source===e&&i.data.forEach(o=>Rl(r,o,i));const s=this.doc.model.dataTypes.filter(i=>i.ownedBy===e||i.storedIn===e);return{consumed:n,produced:r,owned:s}}capabilitiesOf(e){return this.doc.model.capabilities.filter(n=>n.actors.includes(e)||n.supporting.includes(e)||n.realizedBy.includes(e))}usagesOfData(e){const n=this.doc.model.dataFlows.filter(a=>a.data.includes(e)),r=this.doc.model.relationships.filter(a=>a.data.includes(e)),s=[];for(const a of this.doc.model.behaviors)if(a.kind==="interaction")for(const l of this.messages(a.id))l.message.data.includes(e)&&s.push({interaction:a,item:l});const i=this.doc.model.behaviors.filter(a=>a.kind==="state-machine"&&a.subject===e),o=this.doc.model.dataRelations.filter(a=>a.from===e||a.to===e);return{flows:n,relationships:r,messages:s,lifecycles:i,relations:o}}messagesAlong(e){const n=[];for(const r of this.doc.model.behaviors)if(r.kind==="interaction")for(const s of this.messages(r.id))s.message.relationship===e&&n.push({interaction:r,item:s});return n}viewShows(e,n){var r;switch(e.type){case"architecture":case"map":case"dependency":{if(n.kind==="entity")return e.entities.includes(n.id);if(n.kind==="relationship"){const s=this.relationships.get(n.id);return s?e.relationships?e.relationships.includes(s.id):e.type==="map"&&(e.passThrough.includes(s.source)||e.passThrough.includes(s.target))?!0:e.entities.includes(s.source)&&e.entities.includes(s.target):!1}return n.kind==="group"?n.view===e.id&&e.type!=="map":!1}case"sequence":{const s=this.messages(e.interaction);return n.kind==="entity"?!!((r=this.interaction(e.interaction))!=null&&r.participants.includes(n.id)):n.kind==="behavior"?n.id===e.interaction:n.kind==="message"||n.kind==="fragment"?n.behavior===e.interaction:n.kind==="relationship"?s.some(i=>i.message.relationship===n.id):n.kind==="dataType"?s.some(i=>i.message.data.includes(n.id)):!1}case"dataflow":{const s=e.flows.map(i=>this.dataFlows.get(i)).filter(wo);return n.kind==="entity"?s.some(i=>i.source===n.id||i.target===n.id):n.kind==="dataFlow"?e.flows.includes(n.id):n.kind==="dataType"?s.some(i=>i.data.includes(n.id)):n.kind==="relationship"?s.some(i=>i.via===n.id):!1}case"activity":{const s=this.process(e.process);return n.kind==="entity"?!!(s!=null&&s.nodes.some(i=>i.performedBy===n.id)):n.kind==="behavior"?n.id===e.process:n.kind==="activityNode"||n.kind==="activityFlow"?n.behavior===e.process:!1}case"erd":{if(n.kind==="dataType")return e.dataTypes.includes(n.id);if(n.kind==="dataRelation"){const s=this.dataRelations.get(n.id);return!!s&&e.dataTypes.includes(s.from)&&e.dataTypes.includes(s.to)}return n.kind==="entity"?e.dataTypes.some(s=>{var i;return((i=this.dataTypes.get(s))==null?void 0:i.storedIn)===n.id}):!1}case"state":{const s=this.stateMachine(e.stateMachine);return s?n.kind==="behavior"?n.id===s.id:n.kind==="state"||n.kind==="transition"?n.behavior===s.id:n.kind==="entity"?s.transitions.some(i=>i.triggeredBy===n.id):n.kind==="dataType"?n.id===s.subject:!1:!1}case"extension":return n.kind==="entity"&&e.entities.includes(n.id);case"usecase":{const s=e.capabilities.map(i=>this.capabilities.get(i)).filter(wo);return n.kind==="capability"?e.capabilities.includes(n.id):n.kind==="entity"?s.some(i=>i.actors.includes(n.id)||i.supporting.includes(n.id)):!1}}}viewsShowing(e){return this.doc.views.filter(n=>this.viewShows(n,e))}bestViewFor(e,n){const r=n?this.views.get(n):void 0;if(r&&this.viewShows(r,e))return r;const s=this.viewsShowing(e),i=["architecture","dependency","sequence","state","activity","dataflow","erd","usecase","map","extension"];return s.sort((o,a)=>{const l=i.indexOf(o.type)-i.indexOf(a.type);if(l!==0)return l;const c=o.type==="architecture"?o.collapsed.length:0,u=a.type==="architecture"?a.collapsed.length:0;return c-u})[0]}viewsForBehavior(e){return this.doc.views.filter(n=>n.type==="sequence"&&n.interaction===e||n.type==="activity"&&n.process===e||n.type==="state"&&n.stateMachine===e)}exists(e){var n,r,s,i;switch(e.kind){case"entity":return this.entities.has(e.id);case"relationship":return this.relationships.has(e.id);case"dataType":{const o=this.dataTypes.get(e.id);return!!o&&(!e.field||o.fields.some(a=>a.name===e.field))}case"dataRelation":return this.dataRelations.has(e.id);case"dataFlow":return this.dataFlows.has(e.id);case"capability":return this.capabilities.has(e.id);case"behavior":return this.behaviors.has(e.id);case"message":return this.messages(e.behavior).some(o=>o.message.id===e.id);case"fragment":return!!this.findFragment(e.behavior,e.id);case"activityNode":return!!((n=this.process(e.behavior))!=null&&n.nodes.some(o=>o.id===e.id));case"activityFlow":return!!((r=this.process(e.behavior))!=null&&r.flows.some(o=>o.id===e.id));case"state":return!!((s=this.stateMachine(e.behavior))!=null&&s.states.some(o=>o.id===e.id));case"transition":return!!((i=this.stateMachine(e.behavior))!=null&&i.transitions.some(o=>o.id===e.id));case"group":{const o=this.views.get(e.view);return((o==null?void 0:o.type)==="architecture"?o.groups:(o==null?void 0:o.type)==="dependency"?o.layers:[]).some(l=>l.id===e.id)}}}describe(e){var n,r,s,i,o,a,l,c,u,f,h,m,g;switch(e.kind){case"entity":{const p=this.entities.get(e.id);return{title:(p==null?void 0:p.name)??e.id,kind:p?this.style(p).label:"Entity",summary:p==null?void 0:p.summary}}case"relationship":{const p=this.relationships.get(e.id);if(!p)return{title:e.id,kind:"Relationship"};const x=((n=this.entities.get(p.source))==null?void 0:n.name)??p.source,y=((r=this.entities.get(p.target))==null?void 0:r.name)??p.target;return{title:`${x} → ${y}`,kind:p.protocol?`Connection · ${p.protocol}`:"Connection",summary:p.label}}case"group":{const p=this.views.get(e.view),y=((p==null?void 0:p.type)==="architecture"?p.groups:(p==null?void 0:p.type)==="dependency"?p.layers:[]).find(v=>v.id===e.id);return{title:(y==null?void 0:y.label)??e.id,kind:"Group",summary:y==null?void 0:y.description}}case"dataType":{const p=this.dataTypes.get(e.id);if(e.field){const x=p==null?void 0:p.fields.find(y=>y.name===e.field);return{title:`${(p==null?void 0:p.name)??e.id}.${e.field}`,kind:`Field · ${(x==null?void 0:x.type)??""}`,summary:x==null?void 0:x.description}}return{title:(p==null?void 0:p.name)??e.id,kind:p?DI(p.kind):"Data",summary:p==null?void 0:p.summary}}case"dataRelation":{const p=this.dataRelations.get(e.id);return p?{title:`${(s=this.dataTypes.get(p.from))==null?void 0:s.name} ${p.label} ${(i=this.dataTypes.get(p.to))==null?void 0:i.name}`,kind:p.logical?"Logical relation":"Foreign key"}:{title:e.id,kind:"Relation"}}case"dataFlow":{const p=this.dataFlows.get(e.id);return p?{title:p.label,kind:"Data flow",summary:`${(o=this.entities.get(p.source))==null?void 0:o.name} → ${(a=this.entities.get(p.target))==null?void 0:a.name}`}:{title:e.id,kind:"Data flow"}}case"message":{const p=this.messages(e.behavior).find(y=>y.message.id===e.id);if(!p)return{title:e.id,kind:"Message"};const x=p.message;return{title:x.label,kind:`Message ${p.number}`,summary:`${(l=this.entities.get(x.from))==null?void 0:l.name} → ${(c=this.entities.get(x.to))==null?void 0:c.name}`}}case"fragment":{const p=this.findFragment(e.behavior,e.id);return{title:(p==null?void 0:p.label)??e.id,kind:p?jd(p.kind):"Fragment",summary:p==null?void 0:p.branches.map(x=>x.guard).join(" · ")}}case"activityNode":{const p=(u=this.process(e.behavior))==null?void 0:u.nodes.find(x=>x.id===e.id);return{title:(p==null?void 0:p.label)??e.id,kind:p?zI(p.kind):"Step",summary:p==null?void 0:p.description}}case"activityFlow":{const p=this.process(e.behavior),x=p==null?void 0:p.flows.find(k=>k.id===e.id),y=(f=p==null?void 0:p.nodes.find(k=>k.id===(x==null?void 0:x.from)))==null?void 0:f.label,v=(h=p==null?void 0:p.nodes.find(k=>k.id===(x==null?void 0:x.to)))==null?void 0:h.label;return{title:x!=null&&x.guard?`${x.guard}: ${v}`:`${y} → ${v}`,kind:"Flow"}}case"state":{const p=(m=this.stateMachine(e.behavior))==null?void 0:m.states.find(x=>x.id===e.id);return{title:(p==null?void 0:p.name)??e.id,kind:"State",summary:p==null?void 0:p.description}}case"transition":{const p=(g=this.stateMachine(e.behavior))==null?void 0:g.transitions.find(x=>x.id===e.id);return{title:(p==null?void 0:p.event)??e.id,kind:"Transition",summary:p!=null&&p.guard?`Only when ${p.guard}`:p==null?void 0:p.description}}case"capability":{const p=this.capabilities.get(e.id);return{title:(p==null?void 0:p.name)??e.id,kind:`Use case · ${(p==null?void 0:p.area)??""}`,summary:p==null?void 0:p.summary}}case"behavior":{const p=this.behaviors.get(e.id);return{title:(p==null?void 0:p.name)??e.id,kind:p?LI(p.kind):"Behavior",summary:p==null?void 0:p.summary}}}}}const rw=new WeakMap;function ft(t){let e=rw.get(t);return e||(e=new PI(t),rw.set(t,e)),e}function Rl(t,e,n){const r=t.get(e);r?r.push(n):t.set(e,[n])}function wo(t){return t!=null}function DI(t){return{table:"Table",record:"Record",event:"Event",document:"Document"}[t]}function jd(t){return{alt:"Alternatives",opt:"Optional",loop:"Loop",par:"In parallel"}[t]}function zI(t){return{start:"Start",end:"End",action:"Action",decision:"Decision",merge:"Merge",fork:"Parallel split",join:"Parallel join"}[t]}function LI(t){return{interaction:"Interaction",process:"Process","state-machine":"Lifecycle"}[t]}function de(t){switch(t.kind){case"group":return`group:${t.view}:${t.id}`;case"dataType":return t.field?`dataType:${t.id}#${t.field}`:`dataType:${t.id}`;case"message":case"fragment":case"activityNode":case"activityFlow":case"state":case"transition":return`${t.kind}:${t.behavior}:${t.id}`;default:return`${t.kind}:${t.id}`}}function an(t){const[e,...n]=t.split(":"),r=n.join(":");if(!r)return null;switch(e){case"entity":case"relationship":case"capability":case"dataFlow":case"dataRelation":case"behavior":return{kind:e,id:r};case"dataType":{const[s,i]=r.split("#");return i?{kind:e,id:s,field:i}:{kind:e,id:s}}case"group":return n.length>=2?{kind:e,view:n[0],id:n.slice(1).join(":")}:null;case"message":case"fragment":case"state":case"transition":case"activityNode":case"activityFlow":return n.length>=2?{kind:e,behavior:n[0],id:n.slice(1).join(":")}:null;default:return null}}function FI(t,e,n=3){var i;const r=[];for(const o of e){const a=BI(t,o),l=Math.max(2,Math.floor(Math.max(t.length,o.length)/3));(a<=l||o.includes(t)||t.includes(o))&&r.push([a,o])}r.sort((o,a)=>o[0]-a[0]);const s=((i=r[0])==null?void 0:i[0])??0;return r.filter(([o])=>o<=s+1).slice(0,n).map(([,o])=>o)}function BI(t,e){const n=Array.from({length:e.length+1},(r,s)=>s);for(let r=1;r<=t.length;r++){let s=n[0];n[0]=r;for(let i=1;i<=e.length;i++){const o=n[i];n[i]=Math.min(n[i]+1,n[i-1]+1,s+(t[r-1]===e[i-1]?0:1)),s=o}}return n[e.length]}const Vs=(t,e,n)=>{const r=FI(t,e);return r.length?`Did you mean ${r.map(s=>`"${s}"`).join(" or ")}?`:`Add a ${n} with this id, or use an existing one.`};function yl(t,e={}){const n=RI.safeParse(t);if(!n.success)return{ok:!1,issues:n.error.issues.map(s=>({path:s.path.join("."),message:s.message,severity:"error",hint:VI(s)}))};const r=[...S_(n.data),...WI(n.data,e.extensions??[])];return r.some(s=>s.severity==="error")?{ok:!1,document:n.data,issues:r}:{ok:!0,document:n.data,issues:r}}function VI(t){const e=t;if(e.code==="invalid_union_discriminator"&&Array.isArray(e.options))return`Use one of: ${e.options.join(", ")}.`;if(e.code==="invalid_enum_value"&&Array.isArray(e.options))return`Use one of: ${e.options.join(", ")}.`;if(e.code==="invalid_type"&&e.received==="undefined")return`Add "${e.path[e.path.length-1]}".`;if(e.code==="unrecognized_keys"&&Array.isArray(e.keys))return`Remove ${e.keys.map(n=>`"${n}"`).join(", ")}: this place has no such field.`;if(e.code==="invalid_string"&&/lowercase|ref/.test(e.message))return'Ids are lowercase letters, digits, "-", "_" and ".", e.g. "order-service".'}function S_(t){const e=[],n=t.model,r=(p,x,y)=>e.push({path:p,message:x,severity:"error",...y?{hint:y}:{}}),s=(p,x)=>{const y=new Map;return p.forEach((v,k)=>{y.has(v.id)&&r(`${x}.${k}.id`,`Duplicate id "${v.id}"`),y.set(v.id,v)}),y},i=s(n.entities,"model.entities"),o=s(n.relationships,"model.relationships"),a=s(n.dataTypes,"model.dataTypes");s(n.dataRelations,"model.dataRelations"),s(n.dataFlows,"model.dataFlows");const l=s(n.behaviors,"model.behaviors"),c=s(n.capabilities,"model.capabilities");s(t.views,"views");const u=(p,x)=>{p!==void 0&&!i.has(p)&&r(x,`Unknown entity "${p}"`,Vs(p,i.keys(),"entity to model.entities"))},f=(p,x)=>{p!==void 0&&!a.has(p)&&r(x,`Unknown data type "${p}"`,Vs(p,a.keys(),"data type to model.dataTypes"))},h=(p,x)=>{p!==void 0&&!o.has(p)&&r(x,`Unknown relationship "${p}"`,Vs(p,o.keys(),"relationship to model.relationships"))};n.entities.forEach((p,x)=>{u(p.parent,`model.entities.${x}.parent`);const y=new Set([p.id]);let v=p.parent?i.get(p.parent):void 0;for(;v;){if(y.has(v.id)){r(`model.entities.${x}.parent`,`Containment cycle through "${v.id}"`);break}y.add(v.id),v=v.parent?i.get(v.parent):void 0}}),n.relationships.forEach((p,x)=>{u(p.source,`model.relationships.${x}.source`),u(p.target,`model.relationships.${x}.target`),p.data.forEach((y,v)=>f(y,`model.relationships.${x}.data.${v}`))}),n.dataTypes.forEach((p,x)=>{u(p.ownedBy,`model.dataTypes.${x}.ownedBy`),u(p.storedIn,`model.dataTypes.${x}.storedIn`);const y=new Set;p.fields.forEach((v,k)=>{const w=`model.dataTypes.${x}.fields.${k}`;if(y.has(v.name)&&r(w,`Duplicate field "${v.name}" in "${p.id}"`),y.add(v.name),v.references){const j=a.get(v.references.dataType);j?j.fields.some(C=>C.name===v.references.field)||r(`${w}.references`,`"${j.id}" has no field "${v.references.field}"`):r(`${w}.references`,`Unknown data type "${v.references.dataType}"`)}})}),n.dataRelations.forEach((p,x)=>{f(p.from,`model.dataRelations.${x}.from`),f(p.to,`model.dataRelations.${x}.to`),p.via&&([p.from,p.to].some(v=>{var k;return(k=a.get(v))==null?void 0:k.fields.some(w=>w.name===p.via)})||r(`model.dataRelations.${x}.via`,`Neither end has field "${p.via}"`))}),n.dataFlows.forEach((p,x)=>{u(p.source,`model.dataFlows.${x}.source`),u(p.target,`model.dataFlows.${x}.target`),h(p.via,`model.dataFlows.${x}.via`),p.data.forEach((y,v)=>f(y,`model.dataFlows.${x}.data.${v}`))}),n.behaviors.forEach((p,x)=>{const y=`model.behaviors.${x}`;if(p.kind==="interaction"){p.participants.forEach((j,C)=>u(j,`${y}.participants.${C}`));const v=new Set(p.participants),k=new Set,w=(j,C)=>j.forEach((E,S)=>{const _=`${C}.${S}`;k.has(E.id)&&r(`${_}.id`,`Duplicate step id "${E.id}"`),k.add(E.id),E.type==="message"?(v.has(E.from)||r(`${_}.from`,`"${E.from}" is not a participant`,`Add "${E.from}" to participants, or send from one of: ${[...v].join(", ")}.`),v.has(E.to)||r(`${_}.to`,`"${E.to}" is not a participant`,`Add "${E.to}" to participants, or send to one of: ${[...v].join(", ")}.`),h(E.relationship,`${_}.relationship`),E.data.forEach((N,M)=>f(N,`${_}.data.${M}`))):E.branches.forEach((N,M)=>w(N.steps,`${_}.branches.${M}.steps`))});w(p.steps,`${y}.steps`)}else if(p.kind==="process"){const v=s(p.nodes,`${y}.nodes`);p.nodes.forEach((k,w)=>u(k.performedBy,`${y}.nodes.${w}.performedBy`)),p.nodes.filter(k=>k.kind==="start").length!==1&&r(`${y}.nodes`,"A process needs exactly one start node"),p.flows.forEach((k,w)=>{v.has(k.from)||r(`${y}.flows.${w}.from`,`Unknown node "${k.from}"`,Vs(k.from,v.keys(),"node")),v.has(k.to)||r(`${y}.flows.${w}.to`,`Unknown node "${k.to}"`,Vs(k.to,v.keys(),"node"))})}else{f(p.subject,`${y}.subject`),u(p.owner,`${y}.owner`);const v=s(p.states,`${y}.states`);p.states.filter(k=>k.kind==="initial").length!==1&&r(`${y}.states`,"A state machine needs exactly one initial state"),p.transitions.forEach((k,w)=>{v.has(k.from)||r(`${y}.transitions.${w}.from`,`Unknown state "${k.from}"`,Vs(k.from,v.keys(),"state")),v.has(k.to)||r(`${y}.transitions.${w}.to`,`Unknown state "${k.to}"`,Vs(k.to,v.keys(),"state")),u(k.triggeredBy,`${y}.transitions.${w}.triggeredBy`)})}}),n.capabilities.forEach((p,x)=>{const y=`model.capabilities.${x}`;p.actors.forEach((v,k)=>u(v,`${y}.actors.${k}`)),p.supporting.forEach((v,k)=>u(v,`${y}.supporting.${k}`)),p.realizedBy.forEach((v,k)=>u(v,`${y}.realizedBy.${k}`)),p.behaviors.forEach((v,k)=>{l.has(v)||r(`${y}.behaviors.${k}`,`Unknown behavior "${v}"`)}),p.includes.forEach((v,k)=>{c.has(v)||r(`${y}.includes.${k}`,`Unknown capability "${v}"`)})});const m=(p,x,y)=>{const v=l.get(p);v?v.kind!==x&&r(y,`"${p}" is a ${v.kind}, expected ${x}`):r(y,`Unknown behavior "${p}"`)};return t.views.forEach((p,x)=>{var v;const y=`views.${x}`;switch(p.type){case"architecture":case"map":case"dependency":{p.entities.forEach((j,C)=>u(j,`${y}.entities.${C}`)),(v=p.relationships)==null||v.forEach((j,C)=>h(j,`${y}.relationships.${C}`));const k=new Set(p.entities),w=p.type==="architecture"?p.groups:p.type==="dependency"?p.layers:[];w.forEach((j,C)=>j.members.forEach((E,S)=>{k.has(E)||r(`${y}.groups.${C}.members.${S}`,`"${E}" is not in this view`)})),p.type==="map"&&(p.passThrough.forEach((j,C)=>u(j,`${y}.passThrough.${C}`)),p.collapsed.forEach((j,C)=>{k.has(j)?p.entities.some(E=>{var S;return((S=i.get(E))==null?void 0:S.parent)===j})||r(`${y}.collapsed.${C}`,`"${j}" has nothing inside it in this view`,'A group is an entity whose children (entities with "parent" set to it) are also in the map.'):r(`${y}.collapsed.${C}`,`"${j}" is not in this view`)})),p.type==="architecture"&&p.collapsed.forEach((j,C)=>{!k.has(j)&&!w.some(E=>E.id===j)&&r(`${y}.collapsed.${C}`,`"${j}" is not in this view`)});break}case"sequence":m(p.interaction,"interaction",`${y}.interaction`);break;case"activity":m(p.process,"process",`${y}.process`);break;case"state":m(p.stateMachine,"state-machine",`${y}.stateMachine`);break;case"erd":p.dataTypes.forEach((k,w)=>f(k,`${y}.dataTypes.${w}`));break;case"dataflow":{const k=new Set(n.dataFlows.map(w=>w.id));p.flows.forEach((w,j)=>{k.has(w)||r(`${y}.flows.${j}`,`Unknown data flow "${w}"`)});break}case"extension":p.entities.forEach((k,w)=>u(k,`${y}.entities.${w}`));break;case"usecase":p.capabilities.forEach((k,w)=>{c.has(k)||r(`${y}.capabilities.${w}`,`Unknown capability "${k}"`)});break}}),UI(t,r),t.project.defaultView&&!t.views.some(p=>p.id===t.project.defaultView)&&r("project.defaultView",`Unknown view "${t.project.defaultView}"`),new Set(n.entities.map(p=>p.kind)).forEach(p=>{t.presentation.kinds[p]||e.push({path:`presentation.kinds.${p}`,message:`No style for entity kind "${p}"; readers use a default`,severity:"warning"})}),e}function WI(t,e){var u;const n=[],r=(f,h)=>n.push({path:f,message:h,severity:"error"}),s=(f,h)=>n.push({path:f,message:h,severity:"warning"}),i=new Map(t.extensions.map(f=>[f.name,f])),o=new Map(e.map(f=>[f.name,f]));t.extensions.forEach((f,h)=>{o.has(f.name)||(f.required?r(`extensions.${h}`,`This document requires the "${f.name}" extension, which this reader does not know`):s(`extensions.${h}`,`Extension "${f.name}" is not known here; its data is kept but not checked`))});const a=(f,h,m,g)=>{var y;if(m.includes(f))return;const p=nw(f);if(!p)return r(h,`Unknown kind "${f}"`);if(!i.has(p))return r(h,`Kind "${f}" uses the undeclared extension "${p}"`);const x=o.get(p);x&&!((y=x[g])!=null&&y[f.slice(p.length+1)])&&r(h,`Extension "${p}" does not define the kind "${f}"`)},l=(f,h,m)=>{var g,p;for(const[x,y]of Object.entries(f)){if(!i.has(x)){r(`${h}.ext.${x}`,`Data for the undeclared extension "${x}"`);continue}const v=(p=(g=o.get(x))==null?void 0:g.facets)==null?void 0:p[m];if(!o.has(x))continue;if(!v){r(`${h}.ext.${x}`,`Extension "${x}" defines no data for a ${m}`);continue}const k=v.safeParse(y);k.success||k.error.issues.forEach(w=>r(`${h}.ext.${x}.${w.path.join(".")}`,w.message))}};if(t.model.entities.forEach((f,h)=>{a(f.kind,`model.entities.${h}.kind`,r_.options,"entityKinds"),l(f.ext,`model.entities.${h}`,"entity")}),t.model.relationships.forEach((f,h)=>{a(f.kind,`model.relationships.${h}.kind`,s_.options,"relationshipKinds"),l(f.ext,`model.relationships.${h}`,"relationship")}),t.model.dataTypes.forEach((f,h)=>l(f.ext,`model.dataTypes.${h}`,"dataType")),t.model.capabilities.forEach((f,h)=>l(f.ext,`model.capabilities.${h}`,"capability")),t.views.forEach((f,h)=>{var y;if(l(f.ext,`views.${h}`,"view"),f.type!=="extension")return;const m=nw(f.extension);if(!i.has(m))return r(`views.${h}.extension`,`View uses the undeclared extension "${m}"`);const g=o.get(m);if(!g)return;const p=(y=g.views)==null?void 0:y[f.extension.slice(m.length+1)];if(!p)return r(`views.${h}.extension`,`Extension "${m}" does not define the view "${f.extension}"`);const x=p.schema.safeParse(f.data);x.success||x.error.issues.forEach(v=>r(`views.${h}.data.${v.path.join(".")}`,v.message))}),n.some(f=>f.severity==="error"))return n;const c=ft(t);for(const f of e)i.has(f.name)&&((u=f.validate)==null||u.call(f,t,{index:c,report:r}));return n}function UI(t,e){const n=ft(t),r=new Set(t.views.map(s=>s.id));t.walkthroughs.forEach((s,i)=>{const o=`walkthroughs.${i}`,a=new Set([...s.removed.entities.map(u=>de({kind:"entity",id:u.id})),...s.removed.relationships.map(u=>de({kind:"relationship",id:u.id})),...s.removed.transitions.map(u=>de({kind:"transition",behavior:u.stateMachine,id:u.transition.id}))]),l=new Set(s.removed.entities.map(u=>u.id));s.removed.entities.forEach((u,f)=>{n.entities.has(u.id)&&e(`${o}.removed.entities.${f}.id`,`"${u.id}" is removed but still in the model`)}),s.removed.relationships.forEach((u,f)=>{n.relationships.has(u.id)&&e(`${o}.removed.relationships.${f}.id`,`"${u.id}" is removed but still in the model`);for(const h of["source","target"])!n.entities.has(u[h])&&!l.has(u[h])&&e(`${o}.removed.relationships.${f}.${h}`,`Unknown entity "${u[h]}"`)}),s.removed.transitions.forEach((u,f)=>{const h=n.stateMachine(u.stateMachine);if(!h)return e(`${o}.removed.transitions.${f}.stateMachine`,`Unknown state machine "${u.stateMachine}"`);for(const m of["from","to"])h.states.some(g=>g.id===u.transition[m])||e(`${o}.removed.transitions.${f}.transition.${m}`,`Unknown state "${u.transition[m]}"`)});const c=(u,f)=>{const h=an(u);if(!h)return e(f,`"${u}" is not a ref`,'Write refs as "entity:<id>", "relationship:<id>", "state:<machine>:<id>", "transition:<machine>:<id>", "message:<interaction>:<id>" or "dataType:<id>#<field>".');!n.exists(h)&&!a.has(de(h))&&e(f,`Nothing in the model matches "${u}"`,Vs(u,ZI(n,a),"element"))};if(s.kind==="change")for(const u of["before","after"])s.story[u]||e(`${o}.story.${u}`,`A change walkthrough needs "story.${u}"`,`Say in one line how it is ${u} the change, or set "kind": "tour" for a tour of code as it is.`);s.kind==="tour"&&s.marks.forEach((u,f)=>e(`${o}.marks.${f}`,"A tour has no marks",'A tour shows code as it is. Remove the marks, or set "kind": "change".')),s.overview&&!r.has(s.overview)&&e(`${o}.overview`,`Unknown view "${s.overview}"`),s.marks.forEach((u,f)=>{c(u.ref,`${o}.marks.${f}.ref`);const h=an(u.ref);h&&u.state==="removed"!==a.has(de(h))&&e(`${o}.marks.${f}.state`,u.state==="removed"?`"${u.ref}" is marked removed but is not in "removed"`:`"${u.ref}" is in "removed" but marked ${u.state}`)}),s.scenes.forEach((u,f)=>{s.kind==="tour"&&u.code.forEach((h,m)=>h.hunks.forEach((g,p)=>g.lines.forEach((x,y)=>{x.kind!=="ctx"&&e(`${o}.scenes.${f}.code.${m}.hunks.${p}.lines.${y}.kind`,`A tour shows code as it is, but this line is "${x.kind}"`,'Show an excerpt with "start" and "text", or use "ctx" lines.')}))),u.view&&!r.has(u.view)&&e(`${o}.scenes.${f}.view`,`Unknown view "${u.view}"`),u.focus.forEach((h,m)=>c(h,`${o}.scenes.${f}.focus.${m}`)),u.callouts.forEach((h,m)=>c(h.target,`${o}.scenes.${f}.callouts.${m}.target`)),u.trace.forEach((h,m)=>c(h.ref,`${o}.scenes.${f}.trace.${m}.ref`)),u.effects.forEach((h,m)=>c(h.target,`${o}.scenes.${f}.effects.${m}.target`)),u.badges.forEach((h,m)=>c(h.target,`${o}.scenes.${f}.badges.${m}.target`))})})}function ZI(t,e){const n=[...e];return t.entities.forEach((r,s)=>n.push(`entity:${s}`)),t.relationships.forEach((r,s)=>n.push(`relationship:${s}`)),t.dataTypes.forEach((r,s)=>{n.push(`dataType:${s}`),r.fields.forEach(i=>n.push(`dataType:${s}#${i.name}`))}),t.capabilities.forEach((r,s)=>n.push(`capability:${s}`)),t.behaviors.forEach((r,s)=>{n.push(`behavior:${s}`),r.kind==="interaction"&&t.messages(s).forEach(i=>n.push(`message:${s}:${i.message.id}`)),r.kind==="process"&&r.nodes.forEach(i=>n.push(`activityNode:${s}:${i.id}`)),r.kind==="state-machine"&&(r.states.forEach(i=>n.push(`state:${s}:${i.id}`)),r.transitions.forEach(i=>n.push(`transition:${s}:${i.id}`)))}),n}function j_(t){const e=new Map;for(const n of t.marks){const r=an(n.ref);r&&e.set(de(r),n.state)}return e}function HI(t,e){return t.walkthroughs.filter(n=>n.overview===e||n.scenes.some(r=>r.view===e))}class pn extends Error{constructor(e,n=[]){super(e),this.issues=n}}function qI(t,e){const n=KI(t,e),r=S_(n).filter(s=>s.severity==="error");if(r.length>0)throw new pn(`"${e.type}" would break the model: ${r[0].message}`,r);return n}function KI(t,e){const n=t.model;switch(e.type){case"entity.add":{const r=Df.parse(e.entity);return{...t,model:{...n,entities:[...n.entities,r]}}}case"entity.update":{bm(t,e.id);const r=n.entities.map(s=>s.id===e.id?Df.parse({...s,...e.changes,id:s.id}):s);return{...t,model:{...n,entities:r}}}case"entity.remove":{if(bm(t,e.id),n.entities.some(u=>u.parent===e.id))throw new pn(`Move or remove the children of "${e.id}" first`);const r=JI(t,e.id);if(r)throw new pn(`"${e.id}" takes part in "${r}". Change that behavior first`);const s=n.relationships.filter(u=>u.source!==e.id&&u.target!==e.id),i=new Set(n.relationships.filter(u=>!s.includes(u)).map(u=>u.id)),o=n.dataFlows.filter(u=>u.source!==e.id&&u.target!==e.id).map(u=>u.via&&i.has(u.via)?{...u,via:void 0}:u),a=new Set(n.dataFlows.filter(u=>!o.some(f=>f.id===u.id)).map(u=>u.id)),l=n.capabilities.map(u=>({...u,supporting:u.supporting.filter(f=>f!==e.id),realizedBy:u.realizedBy.filter(f=>f!==e.id)}));if(l.some(u=>u.actors.includes(e.id)))throw new pn(`"${e.id}" is the actor of a capability. Change the capability first`);const c=t.views.map(u=>u.type==="dataflow"?{...u,flows:u.flows.filter(f=>!a.has(f))}:sw(u,e.id,i));return{...t,model:{...n,entities:n.entities.filter(u=>u.id!==e.id),relationships:s,dataFlows:o,capabilities:l},views:c}}case"relationship.add":{const r=zf.parse(e.relationship);return{...t,model:{...n,relationships:[...n.relationships,r]}}}case"relationship.update":{if(!n.relationships.some(s=>s.id===e.id))throw new pn(`Unknown relationship "${e.id}"`);const r=n.relationships.map(s=>s.id===e.id?zf.parse({...s,...e.changes,id:s.id}):s);return{...t,model:{...n,relationships:r}}}case"relationship.remove":{if(!n.relationships.some(s=>s.id===e.id))throw new pn(`Unknown relationship "${e.id}"`);const r=new Set([e.id]);return{...t,model:{...n,relationships:n.relationships.filter(s=>s.id!==e.id)},views:t.views.map(s=>(s.type==="architecture"||s.type==="dependency"||s.type==="map")&&s.relationships?{...s,relationships:s.relationships.filter(i=>!r.has(i))}:s)}}case"view.addEntity":case"view.removeEntity":{const r=t.views.map(s=>{if(s.id!==e.viewId)return s;if(s.type!=="architecture"&&s.type!=="dependency"&&s.type!=="map")throw new pn(`Entities are added to ${s.type} views through their behavior, not directly`);return e.type==="view.addEntity"?(bm(t,e.entityId),s.entities.includes(e.entityId)?s:{...s,entities:[...s.entities,e.entityId]}):sw(s,e.entityId,new Set)});return{...t,views:r}}case"layout.move":{const r=t.views.map(s=>{if(s.id!==e.viewId)return s;const i={...s.positions};return e.position?i[e.elementId]=e.position:delete i[e.elementId],{...s,positions:i}});return{...t,views:r}}case"presentation.override":{const r={...t.presentation.elements};return e.changes?r[e.elementId]={...r[e.elementId],...e.changes}:delete r[e.elementId],{...t,presentation:{...t.presentation,elements:r}}}case"behavior.rename":{const r=e.value.trim();if(!r)throw new pn("A name cannot be empty");let s=!1;const i=n.behaviors.map(o=>{if(o.id!==e.behaviorId)return o;if(o.kind==="interaction"&&e.element==="message"){const a=l=>l.map(c=>c.type==="message"&&c.id===e.id?(s=!0,{...c,label:r}):c.type==="fragment"?{...c,branches:c.branches.map(u=>({...u,steps:a(u.steps)}))}:c);return{...o,steps:a(o.steps)}}return o.kind==="state-machine"&&e.element==="state"?{...o,states:o.states.map(a=>a.id===e.id?(s=!0,{...a,name:r}):a)}:o.kind==="state-machine"&&e.element==="transition"?{...o,transitions:o.transitions.map(a=>a.id===e.id?(s=!0,{...a,event:r}):a)}:o.kind==="process"&&e.element==="activityNode"?{...o,nodes:o.nodes.map(a=>a.id===e.id?(s=!0,{...a,label:r}):a)}:o});if(!s)throw new pn(`No ${e.element} "${e.id}" in "${e.behaviorId}"`);return{...t,model:{...n,behaviors:i}}}case"walkthrough.setText":{const r=t.walkthroughs.findIndex(i=>i.id===e.walkthroughId);if(r<0)throw new pn(`Unknown walkthrough "${e.walkthroughId}"`);const s=C_(t.walkthroughs[r],e.path,e.value);return{...t,walkthroughs:t.walkthroughs.map((i,o)=>o===r?s:i)}}}}function C_(t,e,n){const[r,...s]=e;if(r===void 0||t===null||typeof t!="object")throw new pn(`No text at "${e.join(".")}"`);const i=t[r];if(s.length===0){if(i!==void 0&&typeof i!="string")throw new pn(`"${r}" is not text`);if(i===void 0&&Array.isArray(t))throw new pn(`No item ${r}`)}else if(i===null||typeof i!="object")throw new pn(`No text at "${e.join(".")}"`);const o=s.length===0?n:C_(i,s,n);return Array.isArray(t)?t.map((a,l)=>l===r?o:a):{...t,[r]:o}}function bm(t,e){if(!t.model.entities.some(n=>n.id===e))throw new pn(`Unknown entity "${e}"`)}function JI(t,e){var n;return(n=t.model.behaviors.find(r=>r.kind==="interaction"?r.participants.includes(e):r.kind==="process"?r.nodes.some(s=>s.performedBy===e):r.owner===e||r.transitions.some(s=>s.triggeredBy===e)))==null?void 0:n.id}function sw(t,e,n){var s,i;const r={...t.positions};return delete r[e],t.type==="architecture"?{...t,positions:r,entities:t.entities.filter(o=>o!==e),relationships:(s=t.relationships)==null?void 0:s.filter(o=>!n.has(o)),groups:t.groups.map(o=>({...o,members:o.members.filter(a=>a!==e)})),collapsed:t.collapsed.filter(o=>o!==e)}:t.type==="dependency"?{...t,positions:r,entities:t.entities.filter(o=>o!==e),relationships:(i=t.relationships)==null?void 0:i.filter(o=>!n.has(o)),layers:t.layers.map(o=>({...o,members:o.members.filter(a=>a!==e)}))}:t.type==="extension"||t.type==="map"?{...t,positions:r,entities:t.entities.filter(o=>o!==e)}:t}const iw=t=>({past:[],present:t,future:[]});function GI(t,e){const n=qI(t.present,e);return{past:[...t.past,{doc:t.present,command:e}],present:n,future:[]}}function YI(t){const e=t.past[t.past.length-1];return e?{past:t.past.slice(0,-1),present:e.doc,future:[{doc:t.present,command:e.command},...t.future]}:t}function QI(t){const[e,...n]=t.future;return e?{past:[...t.past,{doc:t.present,command:e.command}],present:e.doc,future:n}:t}function qv(t){return`${JSON.stringify(t,null,2)}
42
- `}function XI(t,e={}){let n;try{n=JSON.parse(t)}catch(r){return{ok:!1,issues:[{path:"",message:`Not valid JSON: ${r.message}`,severity:"error"}]}}return yl(n,e)}function eP(t){const e=t.trimStart();return e.startsWith("{")&&/"poneyVersion"\s*:/.test(e)}class on extends Error{constructor(e,n){super(n?`Line ${n}: ${e}`:e),this.line=n}}function __(t){var n;const e=((n=N_(t)[0])==null?void 0:n.text)??"";if(/^sequenceDiagram\b/.test(e))return"sequence";if(/^(flowchart|graph)\b/.test(e))return"flowchart";if(/^stateDiagram(-v2)?\b/.test(e))return"state";if(/^erDiagram\b/.test(e))return"er"}function tP(t,e={}){const n=__(t);if(!n)throw new on("Not a supported Mermaid diagram. Start with sequenceDiagram, flowchart, stateDiagram or erDiagram.");const r=N_(t).filter(a=>!/^(title|accTitle|accDescr)\b/.test(a.text)),s=e.name??nP(t),i={sequence:sP,flowchart:lP,state:cP,er:uP}[n](r.slice(1),s),o=yl(i);if(!o.ok){const a=o.issues.find(l=>l.severity==="error");throw new on(`The diagram converted to an invalid model (${a==null?void 0:a.path}: ${a==null?void 0:a.message})`)}return{kind:n,document:o.document}}function N_(t){const e=[];let n=!1;return t.split(/\r?\n/).forEach((r,s)=>{const i=r.trim();if(s===0&&i==="---")return void(n=!0);if(n){i==="---"&&(n=!1);return}!i||i.startsWith("%%")||e.push({text:i,no:s+1})}),e}function nP(t){var e,n;return(n=(e=/^\s*title:?\s+(.+)$/m.exec(t))==null?void 0:e[1])==null?void 0:n.trim()}function E_(t){const e=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return e&&/^[a-z0-9]/.test(e)?e:`x-${e||"item"}`}function Zc(t){const e=t.trim();return e.length>=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))?e.slice(1,-1):e}function hp(){const t=new Set;return e=>{const n=E_(e);let r=n;for(let s=2;t.has(r);s++)r=`${n}-${s}`;return t.add(r),r}}function pp(t,e){return{poneyVersion:b_,project:{id:E_(t),name:t,description:e},model:{entities:[],relationships:[]},views:[],presentation:w_}}const rP=/^(.+?)\s*(-->>|->>|--x|-x|--\)|-\)|-->|->)\s*([+-]?)\s*(.+?)\s*:\s*(.*)$/;function sP(t,e){const n=e??"Imported sequence",r=pp(n,"Imported from a Mermaid sequence diagram."),s=hp(),i=new Map,o=r.model.entities,a=(m,g,p=!1)=>{const x=m.trim();let y=i.get(x);return y||(y=s(x),i.set(x,y),o.push({id:y,kind:p?"person":"service",name:g??x,summary:""})),y},l=[],c=[{steps:l}],u=()=>c[c.length-1];let f=0,h=0;for(const{text:m,no:g}of t){let p;if(!/^(autonumber|activate|deactivate|title|Note|note|create|destroy|links?|properties)\b/.test(m)){if(p=/^(participant|actor)\s+(.+?)(?:\s+as\s+(.+))?$/.exec(m)){a(p[2],p[3]?Zc(p[3]):void 0,p[1]==="actor");continue}if(/^(box|rect)\b/.test(m)){c.push({steps:u().steps,ignore:!0});continue}if(p=/^(alt|opt|loop|par|critical|break)\b\s*(.*)$/.exec(m)){const x=p[1]==="critical"||p[1]==="break"?"opt":p[1],y=p[2]||p[1],v={type:"fragment",id:`f${++h}`,kind:x,label:{alt:"Alternatives",opt:"Optional",loop:"Loop",par:"In parallel"}[x],branches:[{guard:y,steps:[]}]};u().steps.push(v),c.push({fragment:v,steps:v.branches[0].steps});continue}if(p=/^(else|and|option)\b\s*(.*)$/.exec(m)){const x=u();if(!x.fragment)throw new on(`"${p[1]}" outside of a block`,g);const y={guard:p[2]||"otherwise",steps:[]};x.fragment.branches.push(y),x.steps=y.steps;continue}if(m==="end"){if(c.length===1)throw new on('"end" without a block',g);c.pop();continue}if(p=rP.exec(m)){const x=a(p[1]),y=a(p[4]),v=p[2],k=x===y?"self":v.startsWith("--")&&v.endsWith(">")?"return":v.endsWith(")")?"async":"call";u().steps.push({type:"message",id:`m${++f}`,kind:k,from:x,to:y,label:p[5]||"(message)",data:[]});continue}throw new on(`Cannot read "${m}"`,g)}}if(c.length>1)throw new on('A block is missing its "end"');if(o.length<2)throw new on("A sequence needs at least two participants");if(l.length===0)throw new on("The sequence has no messages");return r.model.behaviors=[{kind:"interaction",id:"sequence",name:n,summary:"",participants:[...i.values()],steps:l}],r.views=[{id:"sequence",type:"sequence",category:"behavior",title:n,description:"Imported from Mermaid.",interaction:"sequence"}],r.project.defaultView="sequence",r}const iP=/^([A-Za-z0-9_][\w\-.]*)\s*(\(\[[\s\S]*\]\)|\[\[[\s\S]*\]\]|\[\([\s\S]*\)\]|\(\([\s\S]*\)\)|\{\{[\s\S]*\}\}|\[\/[\s\S]*\/\]|\[\\[\s\S]*\\\]|\[[\s\S]*\]|\([\s\S]*\)|\{[\s\S]*\}|>[\s\S]*\])?\s*(?::::[\w-]+)?$/,oP=/\s*(<-->|-->|---|-\.->|-\.-|==>|===|--x|--o)\s*(?:\|([^|]*)\|)?\s*/;function aP(t,e){const n=iP.exec(t.trim());if(!n)throw new on(`Cannot read the node "${t.trim()}"`,e);const r=n[2];if(!r)return{key:n[1],shape:"rect"};const s=[["([","])","stadium"],["((","))","circle"],["{{","}}","other"],["[[","]]","rect"],["[(",")]","other"],["[/","/]","other"],["[\\","\\]","other"],["[","]","rect"],["(",")","round"],["{","}","diamond"],[">","]","other"]];for(const[i,o,a]of s)if(r.startsWith(i)&&r.endsWith(o))return{key:n[1],label:Zc(r.slice(i.length,-o.length)),shape:a};return{key:n[1],shape:"rect"}}function lP(t,e){var x;const n=e??"Imported flowchart",r=pp(n,"Imported from a Mermaid flowchart."),s=hp(),i=new Map,o=[],a=[],l=[],c=(y,v)=>{const k=aP(y,v);let w=i.get(k.key);return w?k.label&&(w.label=k.label,w.shape=k.shape):(w={id:s(k.key),label:k.label??k.key,shape:k.shape,lane:l[l.length-1]},i.set(k.key,w)),w};for(const{text:y,no:v}of t){let k;if(/^(classDef|class|style|linkStyle|click|direction|accTitle|accDescr|title)\b/.test(y))continue;if(k=/^subgraph\s+(.+)$/.exec(y)){const S=/^([\w-]+)\s*\[(.+)\]$/.exec(k[1].trim()),_=Zc(S?S[2]:k[1]),N=s(`lane-${S?S[1]:_}`);a.push({id:N,name:_}),l.push(N);continue}if(y==="end"){l.pop();continue}const j=y.replace(/;$/,"").replace(/--\s+([^-|>][^>]*?)\s+-->/g,"-->|$1|").replace(/-\.\s+([^.]+?)\s+\.->/g,"-.->|$1|").replace(/==\s+([^=]+?)\s+==>/g,"==>|$1|").split(oP),C=S=>S.split(/\s*&\s*/);let E=C(j[0]).map(S=>c(S,v));for(let S=1;S+2<j.length+1&&j[S+2]!==void 0;S+=3){const _=(x=j[S+1])==null?void 0:x.trim(),N=C(j[S+2]).map(M=>c(M,v));for(const M of E)for(const P of N)o.push({from:M.id,to:P.id,guard:_?Zc(_):void 0});E=N}}if(i.size===0)throw new on("The flowchart has no nodes");const u=new Set(o.map(y=>y.to)),f=new Set(o.map(y=>y.from)),h=[...i.values()],m=y=>y.shape==="diamond"?"decision":(y.shape==="circle"||y.shape==="stadium")&&!u.has(y.id)?"start":(y.shape==="circle"||y.shape==="stadium")&&!f.has(y.id)?"end":"action",g=h.map(y=>({id:y.id,kind:m(y),label:y.label,performedBy:y.lane})),p=g.filter(y=>y.kind==="start");if(p.length!==1){p.forEach(k=>k.kind="action");const y=g.filter(k=>!u.has(k.id)),v={id:s("start"),kind:"start",label:"Start",performedBy:(y[0]??g[0]).performedBy};g.unshift(v);for(const k of y.length?y:[g[1]])o.push({from:v.id,to:k.id})}return r.model.entities=a.map(y=>({id:y.id,kind:"module",name:y.name,summary:""})),r.model.behaviors=[{kind:"process",id:"flow",name:n,summary:"",nodes:g,flows:o.map((y,v)=>({id:`e${v+1}`,...y}))}],r.views=[{id:"flow",type:"activity",category:"behavior",title:n,description:"Imported from Mermaid.",process:"flow",swimlanes:a.length>0}],r.project.defaultView="flow",r}function cP(t,e){var g;const n=e??"Imported lifecycle",r=pp(n,"Imported from a Mermaid state diagram."),s=hp(),i=new Map,o=[],a="[*]:initial",l="[*]:final",c=p=>{let x=i.get(p);return x||(x={id:s(p===a?"start":p===l?"end":p),name:p===a?"Start":p===l?"End":p},i.set(p,x)),x};for(const{text:p,no:x}of t){let y;if(!(/^(note|direction|classDef|class|style)\b/i.test(p)||p==="}"||p==="--")){if(y=/^state\s+"([^"]+)"\s+as\s+([\w-]+)/.exec(p)){c(y[2]).name=y[1];continue}if(y=/^state\s+([\w-]+)/.exec(p)){c(y[1]);continue}if(y=/^(\[\*\]|[\w-]+)\s*-->\s*(\[\*\]|[\w-]+)\s*(?::\s*(.*))?$/.exec(p)){const v=y[1]==="[*]"?a:y[1],k=y[2]==="[*]"?l:y[2];c(v),c(k),o.push({from:v,to:k,label:(g=y[3])==null?void 0:g.trim()});continue}if(y=/^([\w-]+)\s*:\s*(.+)$/.exec(p)){c(y[1]).description=y[2];continue}throw new on(`Cannot read "${p}"`,x)}}if(o.length===0)throw new on("The state diagram has no transitions");if(!i.has(a)){const p=o[0].from;c(a),o.unshift({from:a,to:p})}const u=new Set,f=o.filter(p=>p.to===l);for(const p of f)o.some(x=>x.from===p.from&&x.to!==l)||u.add(p.from);const h=o.filter(p=>!(p.to===l&&u.has(p.from)));h.some(p=>p.to===l)||i.delete(l);const m=p=>{if(!p)return{event:"Next"};const x=/^(.*?)\s*(?:\[(.*?)\])?\s*(?:\/\s*(.*))?$/.exec(p);return{event:x[1]||p,guard:x[2]||void 0,actions:x[3]?x[3].split(/\s*[;,]\s*/).filter(Boolean):[]}};return r.model.behaviors=[{kind:"state-machine",id:"lifecycle",name:n,summary:"",states:[...i.entries()].map(([p,x])=>({id:x.id,kind:p===a?"initial":p===l||u.has(p)?"final":"normal",name:x.name,description:x.description})),transitions:h.map((p,x)=>({id:`t${x+1}`,from:i.get(p.from).id,to:i.get(p.to).id,...m(p.label)}))}],r.views=[{id:"lifecycle",type:"state",category:"behavior",title:n,description:"Imported from Mermaid.",stateMachine:"lifecycle"}],r.project.defaultView="lifecycle",r}const ow="(\\|\\||\\|o|o\\||\\}\\||\\|\\{|\\}o|o\\{)",dP=new RegExp(`^([\\w-]+)\\s*${ow}(--|\\.\\.)${ow}\\s*([\\w-]+)\\s*:\\s*(.+)$`);function aw(t){return t==="||"?"one":t==="|o"||t==="o|"?"zero-or-one":t==="}|"||t==="|{"?"one-or-many":"many"}function uP(t,e){const n=e??"Imported data model",r=pp(n,"Imported from a Mermaid ER diagram."),s=hp(),i=new Map,o=[];let a=null;function l(c){let u=i.get(c);return u||(u={id:s(c),name:c,fields:[]},i.set(c,u)),u}for(const{text:c,no:u}of t){let f;if(a){if(c==="}"){a=null;continue}const h=/^([\w<>[\](),.-]+)\s+([\w-]+)(?:\s+((?:PK|FK|UK)(?:\s*,\s*(?:PK|FK|UK))*))?(?:\s+"([^"]*)")?$/.exec(c);if(!h)throw new on(`Cannot read the attribute "${c}"`,u);const m=(h[3]??"").split(/\s*,\s*/);a.fields.push({name:h[2],type:h[1],primaryKey:m.includes("PK")||void 0,unique:m.includes("UK")||void 0,description:[m.includes("FK")?"Foreign key.":"",h[4]??""].filter(Boolean).join(" ")||void 0});continue}if(f=/^([\w-]+)(?:\["?([^"\]]+)"?\])?\s*\{$/.exec(c)){a=l(f[1]),f[2]&&(a.name=f[2]);continue}if(f=dP.exec(c)){const h=l(f[1]),m=l(f[5]);o.push({id:s(`rel-${f[1]}-${f[5]}`),from:h.id,to:m.id,fromCardinality:aw(f[2]),toCardinality:aw(f[4]),label:Zc(f[6]),logical:f[3]===".."});continue}if(f=/^([\w-]+)$/.exec(c)){l(f[1]);continue}throw new on(`Cannot read "${c}"`,u)}if(i.size===0)throw new on("The ER diagram has no entities");return r.model.dataTypes=[...i.values()].map(c=>({id:c.id,kind:"table",name:c.name,summary:"",fields:c.fields})),r.model.dataRelations=o,r.views=[{id:"data-model",type:"erd",category:"data",title:n,description:"Imported from Mermaid.",dataTypes:[...i.values()].map(c=>c.id)}],r.project.defaultView="data-model",r}const ou=t=>`g:${t}`;function fP(t,e,n={}){const r=ft(t),s=new Set(e.entities.filter(k=>r.entities.has(k))),i=new Set(n.collapsed??e.collapsed),o=k=>{var w;return(w=r.ancestors(k).find(j=>s.has(j.id)))==null?void 0:w.id},a=new Map;for(const k of e.groups)for(const w of k.members)s.has(w)&&a.set(w,k.id);const l=new Map;for(const k of e.groups){const w=k.members.find(j=>s.has(j));w&&l.set(k.id,o(w))}const c=new Map;for(const k of s){const w=a.get(k);c.set(k,w?ou(w):o(k))}for(const[k,w]of l)c.set(ou(k),w);const u=new Map;for(const[k,w]of c){const j=u.get(w)??[];j.push(k),u.set(w,j)}const f=new Map;e.entities.forEach((k,w)=>f.set(k,w)),e.groups.forEach(k=>f.set(ou(k.id),Math.min(...k.members.map(w=>f.get(w)??1/0))));for(const k of u.values())k.sort((w,j)=>(f.get(w)??0)-(f.get(j)??0));const h=k=>(u.get(k)??[]).reduce((j,C)=>j+(C.startsWith("g:")?0:1)+h(C),0),m=k=>{const w=k.startsWith("g:"),j=w?k.slice(2):k,C=u.get(k)??[],E=C.length>0&&i.has(j);return{id:k,type:w?"group":"entity",entityId:w?void 0:k,groupId:w?j:void 0,parent:c.get(k),children:E?[]:C.map(m),collapsed:E,hiddenCount:E?h(k):0}},g=(u.get(void 0)??[]).map(m),p={};for(const k of s){let w=k,j=c.get(k);for(;j;){const C=j.startsWith("g:")?j.slice(2):j;i.has(C)&&(w=j),j=c.get(j)}p[k]=w}for(const k of e.groups){const w=ou(k.id);let j=w,C=c.get(w);for(;C;)i.has(C.startsWith("g:")?C.slice(2):C)&&(j=C),C=c.get(C);p[w]=j}const x=e.relationships??t.model.relationships.filter(k=>s.has(k.source)&&s.has(k.target)).map(k=>k.id),y=new Map;for(const k of x){const w=r.relationships.get(k);if(!w||!s.has(w.source)||!s.has(w.target))continue;const j=p[w.source],C=p[w.target];if(j===C)continue;const E=`${j}->${C}`,S=j!==w.source||C!==w.target,_=y.get(E);_?(_.relationships.push(w.id),_.lifted||(_.lifted=S)):y.set(E,{id:w.id,source:j,target:C,relationships:[w.id],lifted:S})}const v=[...y.values()].map(k=>k.relationships.length>1?{...k,id:`lifted:${k.source}->${k.target}`}:k);return{roots:g,edges:v,representative:p,direction:e.layout.direction}}function hP(t){return t==="person"||t==="external"?"terminator":t==="database"||t==="cache"||t==="queue"?"store":"process"}function pP(t,e,n={}){const r=ft(t),s=e.flows.map(g=>r.dataFlows.get(g)).filter(wo),i=[];for(const g of s)for(const p of[g.source,g.target])i.includes(p)||i.push(p);const o=new Set(i),a=new Set(s.map(g=>g.via).filter(wo)),c=n.controlFlow??e.showControlFlow?t.model.relationships.filter(g=>o.has(g.source)&&o.has(g.target)&&!a.has(g.id)&&g.kind!=="depends-on"&&g.kind!=="implements").map(g=>({id:g.id,source:g.source,target:g.target})):[],u=g=>{var p;return hP(((p=r.entities.get(g))==null?void 0:p.kind)??"service")},f=new Set(s.map(g=>g.source)),h=new Set(i.filter(g=>{if(u(g)!=="terminator"||!f.has(g))return!1;const p=s.filter(x=>x.target===g);return p.length>0&&p.every(x=>u(x.source)==="terminator")})),m=i.map(g=>({id:g,entityId:g,role:u(g)}));for(const g of h)m.push({id:`${g}~in`,entityId:g,role:"terminator"});return{nodes:m,flows:s.map(g=>({id:g.id,source:g.source,target:h.has(g.target)?`${g.target}~in`:g.target,label:g.label,data:g.data})),control:c}}function mP(t,e,n={}){const r=ft(t),s=new Set(e.dataTypes),i=new Set(n.expanded??[]),o=t.model.dataRelations.filter(c=>s.has(c.from)&&s.has(c.to)),a=e.dataTypes.map(c=>r.dataTypes.get(c)).filter(wo).map(c=>{const u=x=>x.primaryKey||!!x.references||o.some(y=>y.via===x.name&&(y.from===c.id||y.to===c.id)),f=c.fields.filter(u),h=c.fields.filter(x=>!u(x)),g=i.has(c.id)||c.fields.length<=e.fieldLimit+1?c.fields:[...f,...h.slice(0,Math.max(0,e.fieldLimit-f.length))],p=c.fields.filter(x=>g.includes(x));return{dataTypeId:c.id,name:c.name,store:e.groupByStore?c.storedIn:void 0,fields:p,hiddenCount:c.fields.length-p.length,expanded:i.has(c.id)}}),l=[...new Set(a.map(c=>c.store).filter(wo))];return{tables:a,relations:o,stores:l}}const gP=new RegExp("`([^`\\n]+)`|\\[([^\\]\\n]+)\\]\\(([^)\\s]+)\\)|\\*\\*(.+?)\\*\\*|(?<![\\w*])\\*(?!\\s)(.+?)(?<!\\s)\\*(?![\\w*])|(?<![\\w_])_(?!\\s)(.+?)(?<!\\s)_(?![\\w_])","gs");function $a(t,e=[],n){const r=[];let s=0;for(const i of t.matchAll(gP))i.index>s&&r.push({text:t.slice(s,i.index),marks:e,...n?{href:n}:{}}),i[1]!==void 0?r.push({text:i[1],marks:[...e,"code"],...n?{href:n}:{}}):i[2]!==void 0?r.push(...$a(i[2],e,i[3])):i[4]!==void 0?r.push(...$a(i[4],lw(e,"bold"),n)):r.push(...$a(i[5]??i[6],lw(e,"italic"),n)),s=i.index+i[0].length;return s<t.length&&r.push({text:t.slice(s),marks:e,...n?{href:n}:{}}),$_(r)}const Kv=t=>t.split(/\n{2,}/).map(e=>e.trim()).filter(Boolean),Nr=t=>Kv(t).map(e=>$a(e).map(n=>n.text).join("")).join(`
43
-
44
- `);function yP(t){const e=[];for(const n of $_(t)){const r=e[e.length-1];r&&r[0].href===n.href?r.push(n):e.push([n])}return e.map(n=>{const r=n.map(xP).join("");return n[0].href?`[${r}](${n[0].href})`:r}).join("")}function xP(t){if(!t.text)return"";const[,e,n,r]=/^(\s*)(.*?)(\s*)$/s.exec(t.text);if(!n)return t.text;let s=n;return t.marks.includes("code")&&(s=`\`${s}\``),t.marks.includes("italic")&&(s=`*${s}*`),t.marks.includes("bold")&&(s=`**${s}**`),`${e}${s}${r}`}const lw=(t,e)=>t.includes(e)?t:[...t,e],vP=(t,e)=>t.href===e.href&&t.marks.length===e.marks.length&&t.marks.every(n=>e.marks.includes(n));function $_(t){const e=[];for(const n of t){if(!n.text)continue;const r=e[e.length-1];r&&vP(r,n)?r.text+=n.text:e.push({...n,marks:[...n.marks]})}return e}const cw={card:{w:248,h:104},cylinder:{w:240,h:112},stack:{w:240,h:104},person:{w:176,h:120},frame:{w:330,h:150},chip:{w:220,h:64},group:{w:248,h:104}},dw={container:56,group:38};async function kP(t,e,n={}){var y;const r=ft(t),s=fP(t,e,n),i=v=>{var _;const k=v.children.length>0,w=v.type==="group"?"group":r.style(v.entityId,e.id).shape,j=v.collapsed&&v.type==="entity"?cw.frame:cw[w],C=e.positions[v.id],E={id:v.id};if(k){const N=v.type==="group"?dw.group:dw.container;E.layoutOptions={"elk.padding":`[top=${N},left=24,bottom=24,right=24]`,"elk.spacing.nodeNode":"28"},E.children=v.children.map(i)}else E.width=j.w,E.height=j.h;const S=v.entityId?(_=r.entities.get(v.entityId))==null?void 0:_.kind:void 0;return!k&&(S==="person"||S==="external")&&(E.layoutOptions={"elk.layered.layering.layerConstraint":S==="person"?"FIRST":"LAST"}),C&&(E.x=C.x,E.y=C.y),E},o=v=>{var k;return(k=r.entities.get(v))==null?void 0:k.kind},a=new Set(s.edges.filter(v=>o(v.source)==="external"&&o(v.target)!=="external").map(v=>v.id)),l={id:"root",layoutOptions:{...wd,"elk.direction":s.direction==="down"?"DOWN":"RIGHT","elk.hierarchyHandling":"INCLUDE_CHILDREN","elk.spacing.nodeNode":"36","elk.layered.spacing.nodeNodeBetweenLayers":"84","elk.spacing.edgeNode":"22","elk.spacing.edgeEdge":"14","elk.layered.spacing.edgeNodeBetweenLayers":"26","elk.layered.spacing.edgeEdgeBetweenLayers":"14","elk.padding":"[top=24,left=24,bottom=24,right=24]"},children:s.roots.map(i),edges:s.edges.map(v=>a.has(v.id)?{id:v.id,sources:[v.target],targets:[v.source]}:{id:v.id,sources:[v.source],targets:[v.target]})},c=await bd(l),u=new Map,f=new Map,h=(v,k)=>{u.set(v.id,v),f.set(v.id,k),v.children.forEach(w=>h(w,k+1))};s.roots.forEach(v=>h(v,0));const m=[...c.nodes.values()].map(v=>{const k=u.get(v.id);return{id:v.id,type:k.type,entityId:k.entityId,groupId:k.groupId,parent:k.parent,compound:k.children.length>0,collapsed:k.collapsed,expandable:k.collapsed||k.children.length>0,hiddenCount:k.hiddenCount,depth:f.get(v.id)??0,x:v.x,y:v.y,w:v.w,h:v.h}}).sort((v,k)=>v.depth-k.depth),g=s.edges.map(v=>{var w;const k=((w=c.edges.get(v.id))==null?void 0:w.points)??[];return{...v,points:a.has(v.id)?k.slice().reverse():k}}).filter(v=>v.points.length>=2),p=new Map(m.map(v=>[v.id,v])),x={};for(const v of m)v.entityId&&(x[de({kind:"entity",id:v.entityId})]=v),v.groupId&&(x[de({kind:"group",view:e.id,id:v.groupId})]=v);for(const[v,k]of Object.entries(s.representative)){const w=p.get(k);w&&!v.startsWith("g:")&&(x[y=de({kind:"entity",id:v})]??(x[y]=w))}for(const v of g){const k=Ci(v.points.map(w=>({x:w.x,y:w.y,w:1,h:1})));for(const w of v.relationships)x[de({kind:"relationship",id:w})]=k}return{width:c.width,height:c.height,nodes:m,edges:g,anchors:x}}const Rt={headerH:64,headerGap:30,row:44,selfRow:58,fragmentHeader:34,branchHeader:30,fragmentEnd:14,activationW:10,margin:32,labelSize:12.5};function M_(t,e){const n=[];for(const r of t){if(r.type==="message"){e.has(r.id)&&n.push(r);continue}const s=r.branches.map(i=>({...i,steps:M_(i.steps,e)})).filter(i=>i.steps.length>0);s.length&&n.push({...r,branches:s})}return n}function wP(t,e,n={}){var $;const r=ft(t),s=r.interaction(e.interaction);if(!s)throw new Error(`Unknown interaction "${e.interaction}"`);const i=new Map(r.messages(s.id).map(A=>[A.message.id,A.number])),o=($=n.only)!=null&&$.length?new Set(n.only):void 0,a=o?M_(s.steps,o):s.steps,l=new Set,c=A=>A.forEach(F=>F.type==="message"?(l.add(F.from),l.add(F.to)):F.branches.forEach(q=>c(q.steps)));c(a);const u={...s,steps:a,participants:o?s.participants.filter(A=>l.has(A)):s.participants},f=[],h=A=>A.forEach(F=>F.type==="message"?f.push({message:F}):F.branches.forEach(q=>h(q.steps)));h(a);const m=u.participants,g=new Map(m.map((A,F)=>[A,F])),p=!!n.compact,x=m.map(A=>{var F;return Math.max(p?128:156,Te(((F=r.entities.get(A))==null?void 0:F.name)??A,14.5,650)+(p?60:70))}),y=m.map((A,F)=>F===0?0:x[F-1]/2+x[F]/2+(p?28:36)),v=A=>(Te(A.label,Rt.labelSize,500)+44+(p?60:0))*(p?.62:1);for(const{message:A}of f){const F=g.get(A.from),q=g.get(A.to);if(F===q){F+1<m.length&&(y[F+1]=Math.max(y[F+1],v(A)+(p?40:56)));continue}const[re,Pe]=F<q?[F,q]:[q,F],qe=y.slice(re+1,Pe+1).reduce((gt,Xt)=>gt+Xt,0),Ke=v(A)+24;if(qe<Ke)for(let gt=re+1;gt<=Pe;gt++)y[gt]+=(Ke-qe)/(Pe-re)}const k=[];m.forEach((A,F)=>k.push(F===0?Rt.margin+40+x[0]/2:k[F-1]+y[F]));const w=A=>k[g.get(A)],j=[],C=[],E=[],S=new Map(m.map(A=>[A,[]])),_=A=>S.get(A).length,N=(A,F)=>w(A)-Rt.activationW/2+Math.max(0,F-1)*4,M=(A,F)=>{const q=_(A);if(q===0)return w(A);const re=N(A,q);return F?re+Rt.activationW:re},P=(A,F)=>S.get(A).push(F),V=(A,F)=>{const q=S.get(A),re=q.pop();re!==void 0&&E.push({entityId:A,x:N(A,q.length+1),y1:re,y2:Math.max(F,re+12)})},Z=()=>new Map([...S].map(([A,F])=>[A,F.length])),Y=(A,F)=>{for(const q of m){for(;_(q)>0;)V(q,F);for(let re=0;re<(A.get(q)??0);re++)P(q,F)}};let O=Rt.headerH+Rt.headerGap,R=k[k.length-1]+x[x.length-1]/2;const I=(A,F=new Set)=>{for(const q of A)q.type==="message"?(F.add(q.from),F.add(q.to)):q.branches.forEach(re=>I(re.steps,F));return F},L=A=>Math.max(0,...A.map(F=>F.type==="fragment"?1+Math.max(...F.branches.map(q=>L(q.steps))):0)),K=(A,F,q)=>{for(const re of A){if(re.type==="message"){const le=re;if(le.kind==="self"){const Zt=M(le.from,!0);P(le.from,O+6);const hr=34;j.push({id:le.id,number:i.get(le.id),kind:le.kind,from:le.from,to:le.to,label:le.label,y:O,x1:Zt,x2:Zt,loop:{x:Zt,y1:O-2,y2:O+20,w:hr},fragments:F}),R=Math.max(R,Zt+hr+Te(le.label,Rt.labelSize,500)+48),V(le.from,O+28),O+=Rt.selfRow;continue}const it=w(le.to)>w(le.from);if(le.kind==="call"){_(le.from)===0&&!p&&P(le.from,O-10);const Zt=M(le.from,it);P(le.to,O);const hr=M(le.to,!it);j.push({id:le.id,number:i.get(le.id),kind:le.kind,from:le.from,to:le.to,label:le.label,y:O,x1:Zt,x2:hr,fragments:F})}else if(le.kind==="return"){const Zt=M(le.from,it);V(le.from,O);const hr=M(le.to,!it);j.push({id:le.id,number:i.get(le.id),kind:le.kind,from:le.from,to:le.to,label:le.label,y:O,x1:Zt,x2:hr,fragments:F})}else{const Zt=M(le.from,it),hr=M(le.to,!it);j.push({id:le.id,number:i.get(le.id),kind:le.kind,from:le.from,to:le.to,label:le.label,y:O,x1:Zt,x2:hr,fragments:F})}O+=Rt.row;continue}const Pe=re,qe=O-18,Ke=[...I([Pe])].map(le=>g.get(le)).sort((le,it)=>le-it),gt=30+(L([Pe])-1)*12,Xt=k[Ke[0]]-gt;let Wt=k[Ke[Ke.length-1]]+gt;O=qe+Rt.fragmentHeader+18;const At=[],Qe=Z(),Dn=j.length;Pe.branches.forEach((le,it)=>{if(it>0){const Zt=O-18;At.push({guard:le.guard,y:Zt}),Y(Qe,Zt),O=Zt+Rt.branchHeader+18}else At.push({guard:le.guard,y:qe});K(le.steps,[...F,Pe.id],q+1)});for(const le of j.slice(Dn))le.loop&&(Wt=Math.max(Wt,le.loop.x+le.loop.w+Te(le.label,Rt.labelSize,500)+48));const Ut=O-18+Rt.fragmentEnd;C.push({id:Pe.id,kind:Pe.kind,label:Pe.label,depth:q,branches:At,x:Xt,y:qe,w:Wt-Xt,h:Ut-qe}),R=Math.max(R,Wt),O=Ut+26}};K(u.steps,[],0);const ne=O+4;for(const A of m)for(;_(A)>0;)V(A,ne-18);const D=m.map((A,F)=>({entityId:A,x:k[F],header:{x:k[F]-x[F]/2,y:0,w:x[F],h:Rt.headerH},lifeline:{y1:Rt.headerH,y2:ne}})),B=-Math.min(0,...C.map(A=>A.x-Rt.margin));B&&(D.forEach(A=>{A.x+=B,A.header.x+=B}),j.forEach(A=>{A.x1+=B,A.x2+=B,A.loop&&(A.loop.x+=B)}),E.forEach(A=>A.x+=B),C.forEach(A=>A.x+=B),R+=B);const H={};H[de({kind:"behavior",id:u.id})]={x:0,y:0,w:R+Rt.margin,h:ne};for(const A of D)H[de({kind:"entity",id:A.entityId})]=A.header;for(const A of j){const F=Math.min(A.x1,A.x2),q=Math.max(Math.abs(A.x2-A.x1),A.loop?A.loop.w+120:0);H[de({kind:"message",behavior:u.id,id:A.id})]={x:F,y:A.y-22,w:q,h:32}}for(const A of C)H[de({kind:"fragment",behavior:u.id,id:A.id})]=A;return{interactionId:u.id,width:R+Rt.margin,height:ne+24,participants:D,messages:j,activations:E,fragments:C,anchors:H}}const uw={terminator:{w:184,h:64},process:{w:196,h:64},store:{w:204,h:52}};async function bP(t,e,n={}){var u,f;const r=ft(t),s=pP(t,e,n),i=h=>{var y;if(((y=s.nodes.find(v=>v.id===h))==null?void 0:y.role)!=="terminator")return{};const g=s.flows.some(v=>v.target===h),p=s.flows.some(v=>v.source===h),x=g?p?void 0:"LAST":"FIRST";return x?{layoutOptions:{"elk.layered.layering.layerConstraint":x}}:{}},o=await bd({id:"root",layoutOptions:{...wd,"elk.direction":"DOWN","elk.spacing.nodeNode":"48","elk.layered.spacing.nodeNodeBetweenLayers":"48","elk.spacing.edgeNode":"24","elk.spacing.edgeEdge":"16","elk.spacing.edgeLabel":"6","elk.edgeLabels.placement":"CENTER","elk.padding":"[top=32,left=32,bottom=32,right=32]"},children:s.nodes.map(h=>({id:h.id,width:uw[h.role].w,height:uw[h.role].h,...e.positions[h.id],...i(h.id)})),edges:[...s.flows.map(h=>({id:h.id,sources:[h.source],targets:[h.target],labels:[{text:h.label,width:Te(h.label,11.5,500)+26,height:22}]})),...s.control.map(h=>({id:h.id,sources:[h.source],targets:[h.target],layoutOptions:{"elk.layered.priority.direction":"0"}}))]}),a=s.nodes.map(h=>({...o.nodes.get(h.id),id:h.id,entityId:h.entityId,role:h.role})),l=[...s.control.map(h=>{var m;return{id:h.id,control:!0,source:h.source,target:h.target,points:((m=o.edges.get(h.id))==null?void 0:m.points)??[],data:[]}}),...s.flows.map(h=>{const m=o.edges.get(h.id);return{id:h.id,control:!1,source:h.source,target:h.target.replace(/~in$/,""),points:(m==null?void 0:m.points)??[],label:m==null?void 0:m.labels[0],data:h.data}})].filter(h=>h.points.length>=2),c={};for(const h of a)c[u=de({kind:"entity",id:h.entityId})]??(c[u]=h);for(const h of l){const m=Ci([...h.points.map(p=>({x:p.x,y:p.y,w:1,h:1})),...h.label?[h.label]:[]]);c[de(h.control?{kind:"relationship",id:h.id}:{kind:"dataFlow",id:h.id})]=m;const g=r.dataFlows.get(h.id);g!=null&&g.via&&(c[f=de({kind:"relationship",id:g.via})]??(c[f]=m))}return{width:o.width,height:o.height,nodes:a,edges:l,anchors:c}}const SP=92,$y=52,jP=$y+40,au=212;function CP(t,e){var Y;const n=ft(t),r=n.process(e.process);if(!r)throw new Error(`Unknown process "${e.process}"`);const s=r.nodes,i=new Map,o=new Map;for(const O of r.flows)i.set(O.from,[...i.get(O.from)??[],O.to]),o.set(O.to,[...o.get(O.to)??[],O.from]);const a=s.find(O=>O.kind==="start")??s[0],l=new Set,c=new Map,u=O=>{c.set(O,"open");for(const R of r.flows.filter(I=>I.from===O)){const I=c.get(R.to);I==="open"?l.add(R.id):I||u(R.to)}c.set(O,"done")};u(a.id),s.forEach(O=>!c.has(O.id)&&u(O.id));const f=r.flows.filter(O=>!l.has(O.id)),h=new Map(s.map(O=>[O.id,0])),m=new Map(s.map(O=>[O.id,0]));f.forEach(O=>m.set(O.to,(m.get(O.to)??0)+1));const g=s.filter(O=>(m.get(O.id)??0)===0).map(O=>O.id);for(;g.length;){const O=g.shift();for(const R of f.filter(I=>I.from===O))h.set(R.to,Math.max(h.get(R.to),h.get(O)+1)),m.set(R.to,m.get(R.to)-1),m.get(R.to)===0&&g.push(R.to)}const p=[];if(e.swimlanes)for(const O of s)p.includes(O.performedBy)||p.push(O.performedBy);p.length===0&&p.push(void 0);const x=O=>e.swimlanes?p.indexOf(O.performedBy):0,y=new Map;for(const O of s){const R=`${x(O)}:${h.get(O.id)}`;y.set(R,[...y.get(R)??[],O.id])}const v=p.map((O,R)=>Math.max(240,...[...y.entries()].filter(([I])=>I.startsWith(`${R}:`)).map(([,I])=>I.length*au+28))),k=[];let w=0;p.forEach((O,R)=>{var I;k.push({entityId:O,label:O?((I=n.entities.get(O))==null?void 0:I.name)??O:e.swimlanes?"Unassigned":r.name,x:w,w:v[R]}),w+=v[R]});const j=new Map;for(const O of s){const R=x(O),I=h.get(O.id),L=y.get(`${R}:${I}`),K=L.indexOf(O.id),ne=k[R].x+k[R].w/2+(K-(L.length-1)/2)*au,D=jP+I*SP;let z=0,B=0,H=[O.label];switch(O.kind){case"start":z=B=22;break;case"end":z=B=26;break;case"fork":case"join":z=120,B=6;break;case"decision":case"merge":z=Math.max(96,Te(O.label,12.5,600)+60),B=54;break;default:H=Cf(O.label,156,13,500,2),z=Math.min(188,Math.max(124,Math.max(...H.map($=>Te($,13,500)))+32)),B=H.length>1?58:42}j.set(O.id,{id:O.id,kind:O.kind,label:O.label,lines:H,outcome:O.outcome,lane:R,rank:I,x:ne-z/2,y:D-B/2,w:z,h:B})}for(const O of j.values()){if(O.kind!=="fork"&&O.kind!=="join")continue;const R=((Y=O.kind==="fork"?i.get(O.id):o.get(O.id))==null?void 0:Y.map(ne=>j.get(ne)))??[];if(R.length<2)continue;const I=R.map(ne=>ne.x+ne.w/2),L=Math.min(...I,O.x+O.w/2)-28,K=Math.max(...I,O.x+O.w/2)+28;O.x=L,O.w=K-L}const C=O=>O.x+O.w/2,E=O=>O.y+O.h/2,S=new Map;for(const O of j.values()){if(O.kind!=="decision")continue;const I=r.flows.filter(ne=>ne.from===O.id&&!l.has(ne.id)).slice().sort((ne,D)=>C(j.get(ne.to))-C(j.get(D.to))),L=new Set(["left","bottom","right"]),K=ne=>{const D=C(j.get(ne.to))-C(O);return Math.abs(D)<2?"bottom":D<0?"left":"right"};for(const ne of I){const D=K(ne),B=(D==="left"?["left","bottom","right"]:D==="right"?["right","bottom","left"]:["bottom","left","right"]).find(H=>L.has(H))??"bottom";L.delete(B),S.set(ne.id,B)}for(const ne of r.flows.filter(D=>D.from===O.id&&l.has(D.id)))S.set(ne.id,L.has("right")?"right":"bottom")}const _=[];let N=0;for(const O of r.flows){const R=j.get(O.from),I=j.get(O.to);if(l.has(O.id)){const B=Math.min(I.rank,R.rank),H=Math.max(I.rank,R.rank),$=Math.min(R.x,I.x),A=Math.max(R.x+R.w,I.x+I.w),F=[...j.values()].filter(Ke=>Ke.rank>=B&&Ke.rank<=H&&Ke.x+Ke.w>=$-au/2&&Ke.x<=A+au/2),q=Math.max(...F.map(Ke=>Ke.x+Ke.w))+28+N++*14,re=R.y+R.h+16+(N-1)*6,Pe=S.get(O.id)==="right"?{x:R.x+R.w,y:E(R)}:{x:C(R),y:R.y+R.h},qe=S.get(O.id)==="right"?[Pe,{x:q,y:Pe.y},{x:q,y:E(I)},{x:I.x+I.w,y:E(I)}]:[Pe,{x:Pe.x,y:re},{x:q,y:re},{x:q,y:E(I)},{x:I.x+I.w,y:E(I)}];_.push({id:O.id,from:O.from,to:O.to,points:qe,guard:O.guard,guardAt:O.guard?{x:Pe.x+8,y:Pe.y+14,anchor:"start"}:void 0,back:!0});continue}const L=I.kind==="join"?C(R):C(I),K={x:L,y:I.y};let ne,D;const z=R.kind==="decision"?S.get(O.id):void 0;if(z==="left"||z==="right"){const B={x:z==="right"?R.x+R.w:R.x,y:E(R)};ne=Math.abs(L-B.x)<1?[B,K]:[B,{x:L,y:B.y},K],D={x:B.x+(z==="right"?10:-10),y:B.y-9,anchor:z==="right"?"start":"end"}}else{const H={x:R.kind==="fork"?C(I):C(R),y:R.y+R.h},$=K.y-22;ne=Math.abs(H.x-K.x)<1?[H,K]:[H,{x:H.x,y:$},{x:K.x,y:$},K],D={x:H.x+8,y:H.y+16,anchor:"start"}}_.push({id:O.id,from:O.from,to:O.to,points:ne,guard:O.guard,guardAt:O.guard?D:void 0,back:!1})}const M=[...j.values()],P=Math.max(w,..._.flatMap(O=>O.points.map(R=>R.x+24))),V=Math.max(...M.map(O=>O.y+O.h))+72;P>w&&(k[k.length-1].w+=P-w);const Z={};for(const O of M)Z[de({kind:"activityNode",behavior:r.id,id:O.id})]=O;for(const O of _)Z[de({kind:"activityFlow",behavior:r.id,id:O.id})]=Ci(O.points.map(R=>({...R,w:1,h:1})));return k.forEach(O=>{O.entityId&&(Z[de({kind:"entity",id:O.entityId})]={x:O.x,y:0,w:O.w,h:$y})}),Z[de({kind:"behavior",id:r.id})]={x:0,y:0,w:P,h:V},{processId:r.id,width:Math.max(w,P),height:V,lanes:k,laneHeader:$y,nodes:M,edges:_,anchors:Z}}const at={header:40,row:26,more:28,bottom:6};function _P(t){const e=Te(t.name,13.5,650)+64,n=Math.max(0,...t.fields.map(i=>Te(i.name,12.5,500,"mono")+Te(i.type,11.5,400,"mono")+78)),r=Math.ceil(Math.max(232,e,n)),s=at.header+t.fields.length*at.row+(t.hiddenCount>0||t.expanded?at.more:0)+at.bottom;return{w:r,h:s}}async function NP(t,e,n={}){const r=mP(t,e,n),s=m=>{const g=_P(m);return{id:m.dataTypeId,width:g.w,height:g.h,...e.positions[m.dataTypeId]}},i=await bd({id:"root",layoutOptions:{...wd,"elk.direction":"RIGHT","elk.hierarchyHandling":"INCLUDE_CHILDREN","elk.spacing.nodeNode":"36","elk.layered.spacing.nodeNodeBetweenLayers":"96","elk.spacing.edgeNode":"24","elk.spacing.edgeEdge":"16","elk.padding":"[top=32,left=32,bottom=32,right=32]"},children:[...r.stores.map(m=>({id:`store:${m}`,layoutOptions:{"elk.padding":"[top=44,left=20,bottom=20,right=20]","elk.spacing.nodeNode":"28"},children:r.tables.filter(g=>g.store===m).map(s)})),...r.tables.filter(m=>!m.store).map(s)],edges:r.relations.map(m=>({id:m.id,sources:[m.from],targets:[m.to]}))}),o=r.tables.map(m=>{const g=i.nodes.get(m.dataTypeId),p=new Set(r.relations.filter(x=>x.via&&(x.from===m.dataTypeId||x.to===m.dataTypeId)).map(x=>x.via));return{...g,dataTypeId:m.dataTypeId,name:m.name,store:m.store,hiddenCount:m.hiddenCount,expanded:m.expanded,rows:m.fields.map((x,y)=>({...x,y:g.y+at.header+y*at.row,foreign:!!x.references||p.has(x.name)&&!x.primaryKey}))}}),a=new Map(o.map(m=>[m.dataTypeId,m])),l=(m,g)=>{const p=m.rows.find(x=>x.name===g)??m.rows.find(x=>x.primaryKey);return p?p.y+at.row/2:void 0},c=(m,g,p)=>{if(p===void 0||m.length<2)return m;const x=m[m.length-1],y=m[m.length-2];if(Math.abs(y.y-x.y)>.5||Math.abs(x.y-p)<.5)return m;const v=Math.abs(x.x-g.x)<2,k=x.x+(v?-18:18);return v&&y.x>k||!v&&y.x<k?m:[...m.slice(0,-1),{x:k,y:x.y},{x:k,y:p},{x:x.x,y:p}]},u=r.relations.map(m=>{var v;let g=((v=i.edges.get(m.id))==null?void 0:v.points)??[];const p=a.get(m.from),x=a.get(m.to),y=p.rows.some(k=>k.name===m.via)&&m.from!==m.to?m.via:void 0;return g=c(g,x,l(x,m.via)),g=c(g.slice().reverse(),p,l(p,y)).reverse(),{...m,points:g}}).filter(m=>m.points.length>=2),f=r.stores.map(m=>({...i.nodes.get(`store:${m}`),entityId:m})),h={};for(const m of o){h[de({kind:"dataType",id:m.dataTypeId})]=m;for(const g of m.rows)h[de({kind:"dataType",id:m.dataTypeId,field:g.name})]={x:m.x,y:g.y,w:m.w,h:at.row}}for(const m of f)h[de({kind:"entity",id:m.entityId})]=m;for(const m of u)h[de({kind:"dataRelation",id:m.id})]=Ci(m.points.map(g=>({...g,w:1,h:1})));return{width:i.width,height:i.height,stores:f,tables:o,relations:u,anchors:h}}function EP(t,e){const n=Math.max(Te(t,11.5,600),e?Te(`[${e}]`,10.5,400):0)+16;return{width:Math.ceil(n),height:e?34:22}}async function $P(t,e,n={}){const s=ft(t).stateMachine(e.stateMachine);if(!s)throw new Error(`Unknown state machine "${e.stateMachine}"`);const i={...s,transitions:[...s.transitions,...n.extraTransitions??[]]},o=f=>{if(f.kind==="initial")return{w:22,h:22};const h=f.entryActions.length?`On entry: ${f.entryActions[0]}${f.entryActions.length>1?` +${f.entryActions.length-1}`:""}`:"",m=Math.max(148,Te(f.name,14,600)+52,h?Te(h,11,400)+36:0);return{w:Math.ceil(m),h:h?64:48}},a=await bd({id:"root",layoutOptions:{...wd,"elk.direction":"DOWN","elk.spacing.nodeNode":"56","elk.layered.spacing.nodeNodeBetweenLayers":"44","elk.spacing.edgeNode":"22","elk.spacing.edgeEdge":"18","elk.spacing.edgeLabel":"6","elk.edgeLabels.placement":"CENTER","elk.padding":"[top=40,left=40,bottom=40,right=40]"},children:i.states.map(f=>({id:f.id,width:o(f).w,height:o(f).h,...e.positions[f.id]})),edges:i.transitions.map(f=>({id:f.id,sources:[f.from],targets:[f.to],labels:[{text:f.event,...EP(f.event,f.guard)}]}))}),l=i.states.map(f=>({...a.nodes.get(f.id),id:f.id,kind:f.kind,name:f.name,outcome:f.outcome,entryActions:f.entryActions})),c=i.transitions.map(f=>{const h=a.edges.get(f.id);return{id:f.id,from:f.from,to:f.to,event:f.event,guard:f.guard,points:(h==null?void 0:h.points)??[],label:h==null?void 0:h.labels[0]}}).filter(f=>f.points.length>=2),u={};for(const f of l)u[de({kind:"state",behavior:i.id,id:f.id})]=f;for(const f of c)u[de({kind:"transition",behavior:i.id,id:f.id})]=Ci([...f.points.map(h=>({...h,w:1,h:1})),...f.label?[f.label]:[]]);return u[de({kind:"behavior",id:i.id})]={x:0,y:0,w:a.width,h:a.height},i.subject&&(u[de({kind:"dataType",id:i.subject})]={x:0,y:0,w:a.width,h:a.height}),{machineId:i.id,width:a.width,height:a.height,states:l,transitions:c,anchors:u}}const Il={w:168,h:96},MP=40,TP=52;function OP(t,e){const n=ft(t),r=e.capabilities.map(S=>n.capabilities.get(S)).filter(wo),s=[];for(const S of r)s.includes(S.area)||s.push(S.area);const i=Math.min(340,Math.max(240,...r.map(S=>Te(S.name,13.5,600)+56))),o=Il.w+200,a=i+140,l=o+(a-i)/2;let c=76;const u=[],f=[];for(const S of s){const _=c;c+=34;for(const N of r.filter(M=>M.area===S))f.push({id:N.id,name:N.name,x:l,y:c,w:i,h:MP}),c+=TP;c+=6,u.push({label:S,x:o+16,y:_,w:a-32,h:c-_}),c+=14}const h={x:o,y:24,w:a,h:c+4-24,title:t.project.name},m=new Map(f.map(S=>[S.id,S])),g=(S,_)=>{const N=_==="left"?24:o+a+176,M=S.map(V=>{const Z=r.filter(O=>(_==="left"?O.actors:O.supporting).includes(V)).map(O=>m.get(O.id)),Y=Z.reduce((O,R)=>O+R.y+R.h/2,0)/Math.max(1,Z.length);return{id:V,cy:Y}});M.sort((V,Z)=>V.cy-Z.cy);let P=0;return M.map(({id:V,cy:Z})=>{const Y=Math.max(P,Z-Il.h/2);return P=Y+Il.h+28,{entityId:V,side:_,x:N,y:Y,w:Il.w,h:Il.h}})},p=[...new Set(r.flatMap(S=>S.actors))],x=[...new Set(r.flatMap(S=>S.supporting))].filter(S=>!p.includes(S)),y=[...g(p,"left"),...g(x,"right")],v=new Map(y.map(S=>[S.entityId,S])),k=[];for(const S of r){const _=m.get(S.id);for(const N of S.actors){const M=v.get(N);M&&k.push({id:`${N}->${S.id}`,actor:N,capability:S.id,side:"left",from:{x:M.x+M.w-22,y:M.y+30},to:{x:_.x,y:_.y+_.h/2}})}for(const N of S.supporting){const M=v.get(N);(M==null?void 0:M.side)==="right"&&k.push({id:`${N}->${S.id}`,actor:N,capability:S.id,side:"right",from:{x:M.x+22,y:M.y+30},to:{x:_.x+_.w,y:_.y+_.h/2}})}}const w=[];for(const S of r)for(const _ of S.includes){const N=m.get(S.id),M=m.get(_);!N||!M||w.push({id:`${S.id}=>${_}`,from:S.id,to:_,a:{x:N.x+N.w-24,y:N.y+N.h},b:{x:M.x+M.w-24,y:M.y},bulge:0})}const j=Math.max(...y.map(S=>S.x+S.w),h.x+h.w)+32,C=Math.max(h.y+h.h,...y.map(S=>S.y+S.h))+32,E={};for(const S of f)E[de({kind:"capability",id:S.id})]=S;for(const S of y)E[de({kind:"entity",id:S.entityId})]=S;return{width:j,height:C,boundary:h,areas:u,capabilities:f,actors:y,associations:k,includes:w,anchors:E}}const Pl=132,fw=168,hw=58,pw=28;function AP(t,e){const n=ft(t),r=new Set(e.entities),s=new Map;e.layers.forEach((_,N)=>_.members.forEach(M=>r.has(M)&&s.set(M,N)));for(const _ of e.entities)s.has(_)||s.set(_,e.layers.length-1);const i=(e.relationships??t.model.relationships.filter(_=>r.has(_.source)&&r.has(_.target)).map(_=>_.id)).map(_=>n.relationships.get(_)).filter(_=>!!_&&r.has(_.source)&&r.has(_.target)),o=_=>{var N;return Math.ceil(Math.max(184,Te(((N=n.entities.get(_))==null?void 0:N.name)??_,13.5,600)+70))},a=e.layers.map((_,N)=>e.entities.filter(M=>s.get(M)===N)),l=new Map;a.forEach(_=>_.forEach((N,M)=>l.set(N,M/Math.max(1,_.length-1))));const u=_=>i.flatMap(N=>N.source===_?[N.target]:N.target===_?[N.source]:[]),f=_=>{for(const N of _){const M=a[N],P=new Map(M.map(V=>{const Z=u(V).filter(Y=>s.get(Y)!==N);return[V,Z.length?Z.reduce((Y,O)=>Y+l.get(O),0)/Z.length:l.get(V)]}));M.sort((V,Z)=>P.get(V)-P.get(Z)),M.forEach((V,Z)=>l.set(V,Z/Math.max(1,M.length-1)))}},h=a.map((_,N)=>N);f(h.slice(1)),f(h.slice(0,-1).reverse()),f(h.slice(1));const m=a.map(_=>_.reduce((N,M)=>N+o(M),0)+Math.max(0,_.length-1)*pw),g=Math.max(...m,400),p=[];a.forEach((_,N)=>{let M=fw+24+(g-m[N])/2;for(const P of _)p.push({entityId:P,band:N,x:M,y:N*Pl+(Pl-hw)/2,w:o(P),h:hw}),M+=o(P)+pw});const x=new Map(p.map(_=>[_.entityId,_])),y=fw+24+g+40,v=e.layers.map((_,N)=>({id:_.id,label:_.label,description:_.description,x:0,y:N*Pl,w:y,h:Pl})),k=new Map,w=(_,N)=>`${_}:${N}`,j=i.map(_=>{const N=x.get(_.source),M=x.get(_.target),P=M.band>N.band?"down":M.band<N.band?"up":"across",V=P==="down"?"bottom":"top",Z=P==="down"?"top":P==="up"?"bottom":"top";return k.set(w(_.source,V),[...k.get(w(_.source,V))??[],_.id]),k.set(w(_.target,Z),[...k.get(w(_.target,Z))??[],_.id]),{r:_,a:N,b:M,direction:P,out:V,inn:Z}}),C=(_,N,M,P)=>{const V=x.get(_),Z=(k.get(w(_,N))??[]).slice(),Y=I=>{const L=n.relationships.get(I),K=x.get(L.source===_?L.target:L.source);return K.x+K.w/2};Z.sort((I,L)=>Y(I)-Y(L));const O=Z.indexOf(M),R=Math.min(V.w*.6,(Z.length-1)*18);return V.x+V.w/2-R/2+(Z.length>1?O/(Z.length-1)*R:0)},E=j.map(({r:_,a:N,b:M,direction:P,out:V,inn:Z})=>{const Y={x:C(_.source,V,_.id),y:V==="bottom"?N.y+N.h:N.y},O={x:C(_.target,Z,_.id),y:Z==="top"?M.y:M.y+M.h};let R,I;if(P==="across")R={x:Y.x,y:Y.y-46},I={x:O.x,y:O.y-46};else{const L=Math.max(40,Math.abs(O.y-Y.y)*.45),K=P==="down"?1:-1;R={x:Y.x,y:Y.y+L*K},I={x:O.x,y:O.y-L*K}}return{id:_.id,source:_.source,target:_.target,kind:_.kind,d:[Y,R,I,O],direction:P}}),S={};for(const _ of p)S[de({kind:"entity",id:_.entityId})]=_;for(const _ of v)S[de({kind:"group",view:e.id,id:_.id})]=_;for(const _ of E){const N=_.d.map(P=>P.x),M=_.d.map(P=>P.y);S[de({kind:"relationship",id:_.id})]={x:Math.min(...N),y:Math.min(...M),w:Math.max(...N)-Math.min(...N),h:Math.max(...M)-Math.min(...M)}}return{width:y,height:e.layers.length*Pl,bands:v,nodes:p,edges:E,anchors:S}}const Uo={head:52,pad:24},wa={h:72,gapX:120,gapY:44,minW:184,maxW:260},Sm={size:12,h:22,subH:36};function RP(t){return Math.round(Math.min(wa.maxW,Math.max(wa.minW,Te(t,15,600)+76)))}function IP(t,e){const n=Math.max(Te(t,Sm.size,500),e?Te(e,11,400):0)+18;return{w:Math.ceil(n),h:e?Sm.subH:Sm.h}}async function PP(t,e,n={}){var H;const r=ft(t),s=new Map((n.extraEntities??[]).map($=>[$.id,$])),i=$=>r.entities.get($)??s.get($),o=new Set(e.passThrough),a=[...e.entities.filter($=>r.entities.has($)&&!o.has($)),...[...s.keys()].filter($=>!e.entities.includes($))],l=new Set(a),c=e.relationships?new Set(e.relationships):void 0,u=[...t.model.relationships,...n.extraRelationships??[]],f=$=>!c||c.has($.id)||(n.extraRelationships??[]).includes($),h=u.filter($=>f($)&&l.has($.source)&&l.has($.target)).map($=>({id:$.id,relationships:[$.id],source:$.source,target:$.target,text:$.label}));for(const $ of o){const A=u.filter(q=>f(q)&&q.target===$&&l.has(q.source)),F=u.filter(q=>f(q)&&q.source===$&&l.has(q.target));for(const q of A)for(const re of F)h.push({id:q.id,relationships:[q.id,re.id],source:q.source,target:re.target,via:$,text:q.label})}const m=$=>{var F,q;let A=(F=i($))==null?void 0:F.parent;for(let re=0;A&&!l.has(A)&&re<32;re++)A=(q=i(A))==null?void 0:q.parent;return A&&l.has(A)&&A!==$?A:void 0},g=new Map;for(const $ of a){const A=m($);A&&g.set(A,[...g.get(A)??[],$])}const p=new Set((n.collapsed??e.collapsed).filter($=>g.has($))),x=$=>{const A=[];for(let F=m($);F&&A.length<32&&!A.includes(F);F=m(F))A.push(F);return A},y=$=>[$,...x($)].filter((A,F)=>F===0||p.has(A)).pop(),v=$=>(g.get($)??[]).flatMap(A=>[A,...v(A)]),k=a.filter($=>y($)===$),w=$=>g.has($)&&!p.has($),j=new Map;for(const $ of h){const A=y($.source),F=y($.target);if(A===F||x(A).includes(F)||x(F).includes(A))continue;const q=`${A}>${F}`,re=j.get(q);re?(re.relationships.push(...$.relationships),re.texts.push($.text)):j.set(q,{...$,source:A,target:F,relationships:[...$.relationships],texts:[$.text]})}h.length=0;for(const $ of j.values()){const A=[...new Set($.texts)],F=A.join(", "),q=A.length===1?A[0]:F.length<=40?F:`${A[0]} +${A.length-1} more`;h.push({id:$.id,relationships:$.relationships,source:$.source,target:$.target,via:A.length>1?void 0:$.via,text:q})}const C=$=>w($)?C(g.get($).find(A=>y(A)===A)??$):$,E=$=>{var q,re;const A=((q=i($))==null?void 0:q.name)??$;if(!w($))return{id:$,width:RP(A),height:wa.h,...e.positions[$]};const F=Math.ceil(Te(A,14,600)+Te(((re=i($))==null?void 0:re.technology)??"",12,400)+Uo.pad*2+40);return{id:$,layoutOptions:{"elk.padding":`[top=${Uo.head},left=${Uo.pad},bottom=${Uo.pad},right=${Uo.pad}]`,"elk.nodeSize.constraints":"MINIMUM_SIZE","elk.nodeSize.minimum":`(${F}, ${wa.h})`},children:g.get($).filter(Pe=>y(Pe)===Pe).map(E)}},S=e.layout.direction==="down",_=await bd({id:"root",layoutOptions:{...wd,"elk.direction":S?"DOWN":"RIGHT","elk.spacing.nodeNode":String(S?56:wa.gapY),"elk.layered.spacing.nodeNodeBetweenLayers":String(S?84:wa.gapX),"elk.layered.nodePlacement.strategy":"BRANDES_KOEPF","elk.layered.nodePlacement.bk.fixedAlignment":"BALANCED","elk.padding":"[top=48,left=48,bottom=48,right=48]",...g.size?{"elk.hierarchyHandling":"INCLUDE_CHILDREN"}:{}},children:k.filter($=>!m($)).map(E),edges:h.flatMap(($,A)=>{const[F,q]=[C($.source),C($.target)];return F===q?[]:[{id:`e${A}`,sources:[F],targets:[q]}]})}),N=$=>{const A=_.nodes.get($);return{x:A.x,y:A.y,w:A.w,h:A.h}},M=k.filter($=>!w($)).map($=>({...N($),entityId:$,...p.has($)?{members:v($)}:{}})),P=k.filter(w).map($=>({...N($),entityId:$,members:v($),depth:x($).length})).sort(($,A)=>$.depth-A.depth),V=new Map([...M.map($=>[$.entityId,$]),...P.map($=>[$.entityId,$])]),Z=$=>{const A=V.get($.source),F=V.get($.target),q=Math.max(F.x-(A.x+A.w),A.x-(F.x+F.w)),re=Math.max(F.y-(A.y+A.h),A.y-(F.y+F.h));return q>=re&&q>0?F.x>A.x?{out:"right",in:"left"}:{out:"left",in:"right"}:F.y>A.y?{out:"bottom",in:"top"}:{out:"top",in:"bottom"}},Y=new Map,O=h.map(($,A)=>{const F=Z($),q=`${$.source}:${F.out}`,re=`${$.target}:${F.in}`;return Y.set(q,[...Y.get(q)??[],A]),Y.set(re,[...Y.get(re)??[],A]),{l:$,s:F,k1:q,k2:re,i:A}}),R=$=>{const A=V.get($);return{x:A.x+A.w/2,y:A.y+A.h/2}},I=($,A,F,q)=>{const re=V.get($),Pe=A==="left"||A==="right",qe=At=>R(h[At].source===$?h[At].target:h[At].source),Ke=(Y.get(F)??[]).slice().sort((At,Qe)=>Pe?qe(At).y-qe(Qe).y:qe(At).x-qe(Qe).x),gt=Ke.indexOf(q),Xt=Math.min((Pe?re.h:re.w)*.55,(Ke.length-1)*14),Wt=Ke.length>1?-Xt/2+gt/(Ke.length-1)*Xt:0;return A==="right"?{x:re.x+re.w,y:re.y+re.h/2+Wt}:A==="left"?{x:re.x,y:re.y+re.h/2+Wt}:A==="bottom"?{x:re.x+re.w/2+Wt,y:re.y+re.h}:{x:re.x+re.w/2+Wt,y:re.y}},L=[...M.map($=>({x:$.x-6,y:$.y-6,w:$.w+12,h:$.h+12})),...P.map($=>({x:$.x,y:$.y,w:$.w,h:Uo.head-8}))],K={right:[1,0],left:[-1,0],bottom:[0,1],top:[0,-1]},ne=({l:$,s:A,k1:F,k2:q,i:re})=>{const Pe=I($.source,A.out,F,re),qe=I($.target,A.in,q,re),gt=A.out==="left"||A.out==="right"?Math.max(48,Math.abs(qe.x-Pe.x)*.45):Math.max(36,Math.abs(qe.y-Pe.y)*.45),[Xt,Wt]=K[A.out],[At,Qe]=K[A.in];return[Pe,{x:Pe.x+Xt*gt,y:Pe.y+Wt*gt},{x:qe.x+At*gt,y:qe.y+Qe*gt},qe]},D=O.map(ne),z=O.map(({l:$,i:A})=>{var At;const F=D[A],q=$.via?`through ${((At=i($.via))==null?void 0:At.name)??$.via}`:void 0,re=IP($.text,q),Pe=D.filter((Qe,Dn)=>Dn!==A),qe=Qe=>{let Dn=0;for(const Ut of L)Dn+=8*Math.max(0,Math.min(Qe.x+Qe.w,Ut.x+Ut.w)-Math.max(Qe.x,Ut.x))*Math.max(0,Math.min(Qe.y+Qe.h,Ut.y+Ut.h)-Math.max(Qe.y,Ut.y));for(const Ut of Pe)for(let le=1;le<24;le++){const it=hc(Ut,le/24);it.x>Qe.x&&it.x<Qe.x+Qe.w&&it.y>Qe.y&&it.y<Qe.y+Qe.h&&(Dn+=600)}return Dn};let Ke,gt,Xt=1/0;const Wt=[.5,.44,.56,.38,.62,.32,.68,.26,.74];for(const Qe of[0,1,-1,2,-2,3,-3,4,-4]){for(const Dn of Wt){const Ut=hc(F,Dn),le=DP(F,Dn),it=Math.hypot(le.x,le.y)||1,Zt=Qe*(Math.abs(le.x/it)>.7?re.h/2+12:re.w/2+12),hr={x:-le.y/it,y:le.x/it},E0={x:Ut.x+hr.x*Zt-re.w/2,y:Ut.y+hr.y*Zt-re.h/2,w:re.w,h:re.h},$0=qe(E0)+Math.abs(Dn-.5)*40+Math.abs(Qe)*250;$0<Xt&&(Xt=$0,Ke=E0,gt=Qe?Ut:void 0)}if(Xt<=10)break}return Ke??(Ke={x:0,y:0,...re}),L.push(Ke),{id:$.id,relationships:$.relationships,source:$.source,target:$.target,via:$.via,curve:F,label:{...Ke,text:$.text,sub:q},leader:gt}}),B={};for(const $ of M)B[de({kind:"entity",id:$.entityId})]=$;for(const $ of P)B[de({kind:"entity",id:$.entityId})]=$;for(const $ of a)y($)!==$&&(B[de({kind:"entity",id:$})]=V.get(y($)));for(const $ of z){const A=$.curve.map(qe=>qe.x),F=$.curve.map(qe=>qe.y),q=[...A,$.label.x,$.label.x+$.label.w],re=[...F,$.label.y,$.label.y+$.label.h],Pe={x:Math.min(...q),y:Math.min(...re),w:Math.max(...q)-Math.min(...q),h:Math.max(...re)-Math.min(...re)};for(const qe of $.relationships)B[H=de({kind:"relationship",id:qe})]??(B[H]=Pe)}return{width:_.width,height:_.height,nodes:M,groups:P,edges:z,anchors:B}}function hc([t,e,n,r],s){const i=1-s;return{x:i*i*i*t.x+3*i*i*s*e.x+3*i*s*s*n.x+s*s*s*r.x,y:i*i*i*t.y+3*i*i*s*e.y+3*i*s*s*n.y+s*s*s*r.y}}function DP([t,e,n,r],s){const i=1-s;return{x:3*i*i*(e.x-t.x)+6*i*s*(n.x-e.x)+3*s*s*(r.x-n.x),y:3*i*i*(e.y-t.y)+6*i*s*(n.y-e.y)+3*s*s*(r.y-n.y)}}const T_=new Map;function zP(t,e){T_.set(t,e)}async function O_(t,e,n={}){switch(e.type){case"architecture":return kP(t,e,n);case"map":return PP(t,e,n);case"sequence":return wP(t,e,n);case"dataflow":return bP(t,e,n);case"activity":return CP(t,e);case"erd":return NP(t,e,n);case"state":return $P(t,e,n);case"usecase":return OP(t,e);case"dependency":return AP(t,e);case"extension":{const r=T_.get(e.extension);if(!r)throw new Error(`No layout registered for "${e.extension}"`);return r(t,e,n)}}}const A_=b.createContext({marks:new Map,mode:"after",focus:null,callouts:new Map,hot:null,setHot:()=>{}}),Jv=({value:t,children:e})=>d.jsx(A_.Provider,{value:t,children:e}),dr=()=>b.useContext(A_);function Ps(t){return R_(dr(),t)}function xl(t){var r,s;const e=dr(),n=t.map(i=>R_(e,i));return{state:(r=n.find(i=>i.state))==null?void 0:r.state,hidden:n.every(i=>i.hidden),dim:n.every(i=>i.dim),hot:n.some(i=>i.hot),focused:n.some(i=>i.focused),callout:(s=n.find(i=>i.callout))==null?void 0:s.callout}}function R_(t,e){const n=t.marks.get(e),r=t.mode==="before"&&n==="new"||t.mode==="after"&&n==="removed",s=!t.focus||t.focus.has(e);return{state:t.mode==="change"?n:void 0,hidden:r,dim:!s&&t.hot!==e,hot:t.hot===e,focused:s,callout:t.callouts.get(e)}}const Mr=t=>`poney-story-el ${t.hidden?"poney-story-hidden":t.dim?"poney-story-dim":""}`,vl=(t,e="var(--poney-story-rule)")=>t?`var(--poney-${t})`:e,Gv=(t,e="var(--poney-story-node)")=>t?`var(--poney-${t}-wash)`:e,Yv={new:"New",changed:"Changed",removed:"Removed"};function Cd({state:t,x:e,y:n,anchor:r="start"}){if(!t)return null;const s=Yv[t],i=Te(s,11,650)+14,o=r==="start"?e:r==="end"?e-i:e-i/2;return d.jsxs("g",{pointerEvents:"none",children:[d.jsx("rect",{x:o,y:n-9,width:i,height:18,rx:9,fill:`var(--poney-${t}-wash)`,stroke:`var(--poney-${t})`,strokeWidth:1}),d.jsx("text",{x:o+i/2,y:n+4,textAnchor:"middle",fontSize:11,fontWeight:650,fill:`var(--poney-${t})`,children:s})]})}function kl({n:t,x:e,y:n,hot:r}){return d.jsxs("g",{pointerEvents:"none",className:"poney-story-el",children:[d.jsx("circle",{cx:e,cy:n,r:12,fill:r?"var(--poney-accent)":"var(--poney-ink)",stroke:"var(--poney-paper-raised)",strokeWidth:2.5}),d.jsx("text",{x:e,y:n+4.2,textAnchor:"middle",fontSize:12,fontWeight:700,fill:"var(--poney-paper-raised)",className:"poney-numbers",children:t})]})}function Lf({x:t,y:e,angle:n,color:r,size:s=7}){const i=Math.cos(n),o=Math.sin(n),a=(l,c)=>`${t+l*i-c*o},${e+l*o+c*i}`;return d.jsx("polygon",{points:`${a(0,0)} ${a(-s*1.35,-s*.62)} ${a(-s*1.35,s*.62)}`,fill:r})}const wl=b.createContext(null),LP=({value:t,children:e})=>d.jsx(wl.Provider,{value:t,children:e});function fn(){const t=b.useContext(wl);if(!t)throw new Error("Poney renderers need a RenderProvider (from @hattoriai/poney-react) with the model index");return t.idx}const FP=(t,e)=>({"data-ref":de(t),"aria-label":e});function Sn(){var t;return((t=b.useContext(wl))==null?void 0:t.bind)??FP}function Ds(){const t=b.useContext(wl),e=(t==null?void 0:t.selection)??null,n=(t==null?void 0:t.hover)??null;return{subject:n??e,selection:e,hover:n}}function mp(t){var a;const e=b.useContext(wl),[n,r]=b.useState({}),s=!!(e!=null&&e.setViewState),i=(s?(a=e.viewState)==null?void 0:a.call(e,t):n)??{},o=b.useCallback(l=>s?e.setViewState(t,l):r(c=>({...c,...l})),[s,e,t]);return[i,o]}const I_=b.createContext(1),BP=({value:t,children:e})=>d.jsx(I_.Provider,{value:t,children:e}),Qv=()=>b.useContext(I_),VP=()=>{var t;return!!((t=b.useContext(wl))!=null&&t.still)};function WP(t,e,n){const r={};if(e&&t.type==="state"&&(r.extraTransitions=e.removed.transitions.filter(s=>s.stateMachine===t.stateMachine).map(s=>s.transition)),e&&t.type==="map"&&(r.extraEntities=e.removed.entities,r.extraRelationships=e.removed.relationships),t.type==="sequence"){r.compact=!0;const s=n.map(an).flatMap(i=>(i==null?void 0:i.kind)==="message"&&i.behavior===t.interaction?[i.id]:[]);s.length&&(r.only=s)}return r}const My=t=>t.map(an).flatMap(e=>e?[de(e)]:[]);function Xv(t,e,n){var s,i;const r=new Set(My(t));for(const o of[...r]){const a=an(o);if(a){if(a.kind==="relationship"){const l=(e==null?void 0:e.relationships.get(a.id))??(n==null?void 0:n.removed.relationships.find(c=>c.id===a.id));if(l)for(const c of[l.source,l.target])r.add(`entity:${c}`)}if(a.kind==="transition"){const l=((s=e==null?void 0:e.stateMachine(a.behavior))==null?void 0:s.transitions.find(c=>c.id===a.id))??((i=n==null?void 0:n.removed.transitions.find(c=>c.stateMachine===a.behavior&&c.transition.id===a.id))==null?void 0:i.transition);if(l)for(const c of[l.from,l.to])r.add(`state:${a.behavior}:${c}`)}}}return[...r]}const UP=/^(entity|state|dataType|activityNode|capability):/;function ZP(t,e,n,r,s){const i=Xv(n,r,s).map(l=>t.anchors[l]).filter(l=>!!l);if(!i.length||e.type==="sequence")return{x:0,y:0,w:t.width,h:t.height};let o=Ci(i);const a=24;for(let l=0;l<3;l++){const c={x:o.x-a,y:o.y-a,w:o.w+a*2,h:o.h+a*2},u=Object.entries(t.anchors).filter(([f])=>UP.test(f)).map(([,f])=>f).filter(f=>f.x<c.x+c.w&&f.x+f.w>c.x&&f.y<c.y+c.h&&f.y+f.h>c.y).filter(f=>f.x<c.x||f.y<c.y||f.x+f.w>c.x+c.w||f.y+f.h>c.y+c.h);if(!u.length)break;o=Ci([o,...u])}return o}function HP(t,e,n,r,s){const i={x:t.x-r,y:t.y-r,w:t.w+r*2,h:t.h+r*2};let o=Math.max(i.w,e/s),a=Math.max(i.h,n/s);const l=e/Math.max(n,1);return o/a<l?o=a*l:a=o/l,{x:i.x+i.w/2-o/2,y:i.y+i.h/2-a/2,w:o,h:a}}function qP(t){var r,s;const e=Xv(t.focus,t.idx,t.walkthrough),n=(i=[])=>{const o=new Map;for(const a of i){const l=an(a.target);l&&o.set(de(l),[...o.get(de(l))??[],a])}return o};return{marks:t.marks,mode:t.mode,focus:e.length&&t.view.type!=="sequence"?new Set(e):null,callouts:new Map(My(t.callouts).map((i,o)=>[i,o+1])),hot:t.hot??null,setHot:t.setHot??(()=>{}),allLabels:((r=t.walkthrough)==null?void 0:r.kind)==="tour"&&e.length===0,effects:n(t.effects),badges:n(t.badges),trace:(s=t.trace)!=null&&s.length?{steps:My(t.trace.map(i=>i.ref)),current:t.traceStep??null,animate:t.animate!==!1,numbered:!!t.numberSteps}:void 0}}/**
45
- * @license lucide-react v1.75.0 - ISC
46
- *
47
- * This source code is licensed under the ISC license.
48
- * See the LICENSE file in the root directory of this source tree.
49
- */const KP=t=>t==null?void 0:t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
50
- * @license lucide-react v1.75.0 - ISC
51
- *
52
- * This source code is licensed under the ISC license.
53
- * See the LICENSE file in the root directory of this source tree.
54
- */function JP(t,e,n=[]){if(e==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:KP(t),size:24,node:e,...n.length>0?{aliases:n}:{}}}/**
55
- * @license lucide-react v1.75.0 - ISC
56
- *
57
- * This source code is licensed under the ISC license.
58
- * See the LICENSE file in the root directory of this source tree.
59
- */const GP=t=>{let e="",n=!1;for(const r of t){if(r==="-"||r==="_"||r<=" "){n=e.length>0;continue}e.length===0?e+=r.toLowerCase():e+=n?r.toUpperCase():r,n=!1}return e};/**
60
- * @license lucide-react v1.75.0 - ISC
61
- *
62
- * This source code is licensed under the ISC license.
63
- * See the LICENSE file in the root directory of this source tree.
64
- */const YP=t=>{const e=GP(t);return e.charAt(0).toUpperCase()+e.slice(1)};/**
65
- * @license lucide-react v1.75.0 - ISC
66
- *
67
- * This source code is licensed under the ISC license.
68
- * See the LICENSE file in the root directory of this source tree.
69
- */const Ty=(...t)=>{const e=new Set;for(const n of t)if(typeof n=="string")for(const r of n.split(/\s+/))r&&e.add(r);return[...e].join(" ")};/**
70
- * @license lucide-react v1.75.0 - ISC
71
- *
72
- * This source code is licensed under the ISC license.
73
- * See the LICENSE file in the root directory of this source tree.
74
- */const Bi={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
75
- * @license lucide-react v1.75.0 - ISC
76
- *
77
- * This source code is licensed under the ISC license.
78
- * See the LICENSE file in the root directory of this source tree.
79
- */function jm(t){return t!=null}function QP(t,e={}){var h,m;const n=e.attributeNames??{},r=g=>n[g]??g,s=t.size??t.width??Bi.width,i=t.size??t.height??Bi.height,o=((h=t.aliases)==null?void 0:h.filter(g=>typeof g=="string"&&g.trim()!=="").map(g=>`lucide-${g}`))??[],a=[...t.name?[`lucide-${t.name}`]:[],...o],l=((m=e.className)==null?void 0:m.split(" ").filter(Boolean))??[],c=e.includeDefaultClasses===!1?Ty(...l):Ty("lucide",...a,...l),u=e.absoluteStrokeWidth?Number(e.strokeWidth??Bi["stroke-width"])*Number(t.size??t.width??Bi.width)/Number(e.size??e.width??Bi.width):e.strokeWidth??Bi["stroke-width"];return["svg",{...Object.entries(Bi).reduce((g,[p,x])=>(g[r(p)]=x,g),{}),..."color"in e&&e.color&&{[r("stroke")]:e.color},..."size"in e&&jm(e.size)&&{[r("width")]:e.size,[r("height")]:e.size},..."width"in e&&jm(e.width)&&{[r("width")]:e.width},..."height"in e&&jm(e.height)&&{[r("height")]:e.height},[r("stroke-width")]:u,...c&&{[r("class")]:c},[r("viewBox")]:`0 0 ${s} ${i}`,...e.hasA11yProp===!1?{[r("aria-hidden")]:"true"}:{},..."attributes"in e&&e.attributes},t.node.map(g=>{const[p,x,y]=g,v=e.nonScalingStroke?{[r("vector-effect")]:"non-scaling-stroke",...x}:x;return y?[p,v,y]:[p,v]})]}/**
80
- * @license lucide-react v1.75.0 - ISC
81
- *
82
- * This source code is licensed under the ISC license.
83
- * See the LICENSE file in the root directory of this source tree.
84
- */function XP(t,e={}){return QP(t,{...e,attributeNames:{...e.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}/**
85
- * @license lucide-react v1.75.0 - ISC
86
- *
87
- * This source code is licensed under the ISC license.
88
- * See the LICENSE file in the root directory of this source tree.
89
- */const eD=t=>{if(t==null||typeof t!="object")return!1;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&(e.startsWith("aria-")||e==="role"||e==="title")&&t[e]!=null)return!0;return!1},tD=b.createContext({}),nD=()=>b.useContext(tD),rD=b.forwardRef(({color:t,size:e,width:n,height:r,strokeWidth:s,absoluteStrokeWidth:i,nonScalingStroke:o,className:a="",children:l,iconNode:c=[],icon:u={node:c,aliases:[],size:24},...f},h)=>{const{size:m=24,strokeWidth:g=2,absoluteStrokeWidth:p=!1,nonScalingStroke:x=!1,color:y="currentColor",className:v=""}=nD()??{},k=!!l||eD(f),[w,j,C=[]]=XP(u,{color:t??y,width:n??e??m,height:r??e??m,strokeWidth:s??g,absoluteStrokeWidth:i??p,nonScalingStroke:o??x,className:Ty(v,a),hasA11yProp:k,attributes:f});return b.createElement(w,{ref:h,...j},[...C.map(([E,S])=>b.createElement(E,S)),...Array.isArray(l)?l:[l]])});/**
90
- * @license lucide-react v1.75.0 - ISC
91
- *
92
- * This source code is licensed under the ISC license.
93
- * See the LICENSE file in the root directory of this source tree.
94
- */function U(t,e=[],n=[]){const r=typeof t=="string"?JP(t,e,n):t,s=b.forwardRef(({className:i,...o},a)=>b.createElement(rD,{ref:a,icon:r,className:i,...o}));return r.name&&(s.displayName=YP(r.name)),s}/**
95
- * @license lucide-react v1.75.0 - ISC
96
- *
97
- * This source code is licensed under the ISC license.
98
- * See the LICENSE file in the root directory of this source tree.
99
- */const P_={name:"activity",size:24,node:[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]};P_.node;const sD=U(P_);/**
100
- * @license lucide-react v1.75.0 - ISC
101
- *
102
- * This source code is licensed under the ISC license.
103
- * See the LICENSE file in the root directory of this source tree.
104
- */const D_={name:"app-window",size:24,node:[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]};D_.node;const iD=U(D_);/**
105
- * @license lucide-react v1.75.0 - ISC
106
- *
107
- * This source code is licensed under the ISC license.
108
- * See the LICENSE file in the root directory of this source tree.
109
- */const z_={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};z_.node;const L_=U(z_);/**
110
- * @license lucide-react v1.75.0 - ISC
111
- *
112
- * This source code is licensed under the ISC license.
113
- * See the LICENSE file in the root directory of this source tree.
114
- */const F_={name:"arrow-right-left",size:24,node:[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]};F_.node;const oD=U(F_);/**
115
- * @license lucide-react v1.75.0 - ISC
116
- *
117
- * This source code is licensed under the ISC license.
118
- * See the LICENSE file in the root directory of this source tree.
119
- */const B_={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};B_.node;const Gr=U(B_);/**
120
- * @license lucide-react v1.75.0 - ISC
121
- *
122
- * This source code is licensed under the ISC license.
123
- * See the LICENSE file in the root directory of this source tree.
124
- */const V_={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};V_.node;const Ff=U(V_);/**
125
- * @license lucide-react v1.75.0 - ISC
126
- *
127
- * This source code is licensed under the ISC license.
128
- * See the LICENSE file in the root directory of this source tree.
129
- */const W_={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};W_.node;const U_=U(W_);/**
130
- * @license lucide-react v1.75.0 - ISC
131
- *
132
- * This source code is licensed under the ISC license.
133
- * See the LICENSE file in the root directory of this source tree.
134
- */const Z_={name:"blocks",size:24,node:[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]]};Z_.node;const aD=U(Z_);/**
135
- * @license lucide-react v1.75.0 - ISC
136
- *
137
- * This source code is licensed under the ISC license.
138
- * See the LICENSE file in the root directory of this source tree.
139
- */const H_={name:"book-open-text",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M16 13h2",key:"weia3s"}],["path",{d:"M16 9h2",key:"1n7gjm"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}],["path",{d:"M6 13h2",key:"1cckiz"}],["path",{d:"M6 9h2",key:"1k7j9f"}]]};H_.node;const gp=U(H_);/**
140
- * @license lucide-react v1.75.0 - ISC
141
- *
142
- * This source code is licensed under the ISC license.
143
- * See the LICENSE file in the root directory of this source tree.
144
- */const q_={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};q_.node;const K_=U(q_);/**
145
- * @license lucide-react v1.75.0 - ISC
146
- *
147
- * This source code is licensed under the ISC license.
148
- * See the LICENSE file in the root directory of this source tree.
149
- */const J_={name:"box",size:24,node:[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]};J_.node;const G_=U(J_);/**
150
- * @license lucide-react v1.75.0 - ISC
151
- *
152
- * This source code is licensed under the ISC license.
153
- * See the LICENSE file in the root directory of this source tree.
154
- */const Y_={name:"boxes",size:24,node:[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]};Y_.node;const lD=U(Y_);/**
155
- * @license lucide-react v1.75.0 - ISC
156
- *
157
- * This source code is licensed under the ISC license.
158
- * See the LICENSE file in the root directory of this source tree.
159
- */const Q_={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};Q_.node;const bs=U(Q_);/**
160
- * @license lucide-react v1.75.0 - ISC
161
- *
162
- * This source code is licensed under the ISC license.
163
- * See the LICENSE file in the root directory of this source tree.
164
- */const X_={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};X_.node;const eN=U(X_);/**
165
- * @license lucide-react v1.75.0 - ISC
166
- *
167
- * This source code is licensed under the ISC license.
168
- * See the LICENSE file in the root directory of this source tree.
169
- */const tN={name:"chevron-left",size:24,node:[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]};tN.node;const nN=U(tN);/**
170
- * @license lucide-react v1.75.0 - ISC
171
- *
172
- * This source code is licensed under the ISC license.
173
- * See the LICENSE file in the root directory of this source tree.
174
- */const rN={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};rN.node;const _d=U(rN);/**
175
- * @license lucide-react v1.75.0 - ISC
176
- *
177
- * This source code is licensed under the ISC license.
178
- * See the LICENSE file in the root directory of this source tree.
179
- */const sN={name:"chevrons-down-up",size:24,node:[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]]};sN.node;const e1=U(sN);/**
180
- * @license lucide-react v1.75.0 - ISC
181
- *
182
- * This source code is licensed under the ISC license.
183
- * See the LICENSE file in the root directory of this source tree.
184
- */const iN={name:"chevrons-up-down",size:24,node:[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]};iN.node;const t1=U(iN);/**
185
- * @license lucide-react v1.75.0 - ISC
186
- *
187
- * This source code is licensed under the ISC license.
188
- * See the LICENSE file in the root directory of this source tree.
189
- */const oN={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};oN.node;const aN=U(oN);/**
190
- * @license lucide-react v1.75.0 - ISC
191
- *
192
- * This source code is licensed under the ISC license.
193
- * See the LICENSE file in the root directory of this source tree.
194
- */const lN={name:"circle-dot",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};lN.node;const cD=U(lN);/**
195
- * @license lucide-react v1.75.0 - ISC
196
- *
197
- * This source code is licensed under the ISC license.
198
- * See the LICENSE file in the root directory of this source tree.
199
- */const cN={name:"circle-exclamation-point",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],aliases:["alert-circle","circle-alert"]};cN.node;const Nd=U(cN);/**
200
- * @license lucide-react v1.75.0 - ISC
201
- *
202
- * This source code is licensed under the ISC license.
203
- * See the LICENSE file in the root directory of this source tree.
204
- */const dN={name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};dN.node;const dD=U(dN);/**
205
- * @license lucide-react v1.75.0 - ISC
206
- *
207
- * This source code is licensed under the ISC license.
208
- * See the LICENSE file in the root directory of this source tree.
209
- */const uN={name:"clipboard-copy",size:24,node:[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]};uN.node;const fN=U(uN);/**
210
- * @license lucide-react v1.75.0 - ISC
211
- *
212
- * This source code is licensed under the ISC license.
213
- * See the LICENSE file in the root directory of this source tree.
214
- */const hN={name:"clipboard-list",size:24,node:[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]};hN.node;const uD=U(hN);/**
215
- * @license lucide-react v1.75.0 - ISC
216
- *
217
- * This source code is licensed under the ISC license.
218
- * See the LICENSE file in the root directory of this source tree.
219
- */const pN={name:"clipboard-paste",size:24,node:[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]};pN.node;const mN=U(pN);/**
220
- * @license lucide-react v1.75.0 - ISC
221
- *
222
- * This source code is licensed under the ISC license.
223
- * See the LICENSE file in the root directory of this source tree.
224
- */const gN={name:"code",size:24,node:[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]};gN.node;const fD=U(gN);/**
225
- * @license lucide-react v1.75.0 - ISC
226
- *
227
- * This source code is licensed under the ISC license.
228
- * See the LICENSE file in the root directory of this source tree.
229
- */const yN={name:"compass",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]]};yN.node;const n1=U(yN);/**
230
- * @license lucide-react v1.75.0 - ISC
231
- *
232
- * This source code is licensed under the ISC license.
233
- * See the LICENSE file in the root directory of this source tree.
234
- */const xN={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};xN.node;const Qo=U(xN);/**
235
- * @license lucide-react v1.75.0 - ISC
236
- *
237
- * This source code is licensed under the ISC license.
238
- * See the LICENSE file in the root directory of this source tree.
239
- */const vN={name:"credit-card",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}],["path",{d:"M6 14h2",key:"mk7k0u"}]]};vN.node;const hD=U(vN);/**
240
- * @license lucide-react v1.75.0 - ISC
241
- *
242
- * This source code is licensed under the ISC license.
243
- * See the LICENSE file in the root directory of this source tree.
244
- */const kN={name:"crosshair",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]};kN.node;const wN=U(kN);/**
245
- * @license lucide-react v1.75.0 - ISC
246
- *
247
- * This source code is licensed under the ISC license.
248
- * See the LICENSE file in the root directory of this source tree.
249
- */const bN={name:"database-zap",size:24,node:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 15 21.84",key:"14ibmq"}],["path",{d:"M21 5V8",key:"1marbg"}],["path",{d:"M21 12L18 17H22L19 22",key:"zafso"}],["path",{d:"M3 12A9 3 0 0 0 14.59 14.87",key:"1y4wr8"}]]};bN.node;const pD=U(bN);/**
250
- * @license lucide-react v1.75.0 - ISC
251
- *
252
- * This source code is licensed under the ISC license.
253
- * See the LICENSE file in the root directory of this source tree.
254
- */const SN={name:"database",size:24,node:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]};SN.node;const jN=U(SN);/**
255
- * @license lucide-react v1.75.0 - ISC
256
- *
257
- * This source code is licensed under the ISC license.
258
- * See the LICENSE file in the root directory of this source tree.
259
- */const CN={name:"download",size:24,node:[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]};CN.node;const mD=U(CN);/**
260
- * @license lucide-react v1.75.0 - ISC
261
- *
262
- * This source code is licensed under the ISC license.
263
- * See the LICENSE file in the root directory of this source tree.
264
- */const _N={name:"file-code-corner",size:24,node:[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],aliases:["file-code-2"]};_N.node;const yp=U(_N);/**
265
- * @license lucide-react v1.75.0 - ISC
266
- *
267
- * This source code is licensed under the ISC license.
268
- * See the LICENSE file in the root directory of this source tree.
269
- */const NN={name:"file-input",size:24,node:[["path",{d:"M4 11V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-1",key:"1q9hii"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]};NN.node;const r1=U(NN);/**
270
- * @license lucide-react v1.75.0 - ISC
271
- *
272
- * This source code is licensed under the ISC license.
273
- * See the LICENSE file in the root directory of this source tree.
274
- */const EN={name:"file-text",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]};EN.node;const Bf=U(EN);/**
275
- * @license lucide-react v1.75.0 - ISC
276
- *
277
- * This source code is licensed under the ISC license.
278
- * See the LICENSE file in the root directory of this source tree.
279
- */const $N={name:"file-up",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]};$N.node;const mw=U($N);/**
280
- * @license lucide-react v1.75.0 - ISC
281
- *
282
- * This source code is licensed under the ISC license.
283
- * See the LICENSE file in the root directory of this source tree.
284
- */const MN={name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]};MN.node;const s1=U(MN);/**
285
- * @license lucide-react v1.75.0 - ISC
286
- *
287
- * This source code is licensed under the ISC license.
288
- * See the LICENSE file in the root directory of this source tree.
289
- */const TN={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};TN.node;const ON=U(TN);/**
290
- * @license lucide-react v1.75.0 - ISC
291
- *
292
- * This source code is licensed under the ISC license.
293
- * See the LICENSE file in the root directory of this source tree.
294
- */const AN={name:"git-branch",size:24,node:[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]};AN.node;const RN=U(AN);/**
295
- * @license lucide-react v1.75.0 - ISC
296
- *
297
- * This source code is licensed under the ISC license.
298
- * See the LICENSE file in the root directory of this source tree.
299
- */const IN={name:"git-merge",size:24,node:[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]};IN.node;const gD=U(IN);/**
300
- * @license lucide-react v1.75.0 - ISC
301
- *
302
- * This source code is licensed under the ISC license.
303
- * See the LICENSE file in the root directory of this source tree.
304
- */const PN={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]};PN.node;const yD=U(PN);/**
305
- * @license lucide-react v1.75.0 - ISC
306
- *
307
- * This source code is licensed under the ISC license.
308
- * See the LICENSE file in the root directory of this source tree.
309
- */const DN={name:"hash",size:24,node:[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]};DN.node;const xD=U(DN);/**
310
- * @license lucide-react v1.75.0 - ISC
311
- *
312
- * This source code is licensed under the ISC license.
313
- * See the LICENSE file in the root directory of this source tree.
314
- */const zN={name:"house",size:24,node:[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],aliases:["home"]};zN.node;const vD=U(zN);/**
315
- * @license lucide-react v1.75.0 - ISC
316
- *
317
- * This source code is licensed under the ISC license.
318
- * See the LICENSE file in the root directory of this source tree.
319
- */const LN={name:"info",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]};LN.node;const kD=U(LN);/**
320
- * @license lucide-react v1.75.0 - ISC
321
- *
322
- * This source code is licensed under the ISC license.
323
- * See the LICENSE file in the root directory of this source tree.
324
- */const FN={name:"italic",size:24,node:[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]};FN.node;const wD=U(FN);/**
325
- * @license lucide-react v1.75.0 - ISC
326
- *
327
- * This source code is licensed under the ISC license.
328
- * See the LICENSE file in the root directory of this source tree.
329
- */const BN={name:"key-round",size:24,node:[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]};BN.node;const i1=U(BN);/**
330
- * @license lucide-react v1.75.0 - ISC
331
- *
332
- * This source code is licensed under the ISC license.
333
- * See the LICENSE file in the root directory of this source tree.
334
- */const VN={name:"key",size:24,node:[["path",{d:"m2 21 9.6-9.6",key:"9l79m3"}],["path",{d:"m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19",key:"fw8biw"}],["circle",{cx:"15.5",cy:"7.5",r:"5.5",key:"4wxmhb"}]]};VN.node;const bD=U(VN);/**
335
- * @license lucide-react v1.75.0 - ISC
336
- *
337
- * This source code is licensed under the ISC license.
338
- * See the LICENSE file in the root directory of this source tree.
339
- */const WN={name:"keyboard",size:24,node:[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]};WN.node;const UN=U(WN);/**
340
- * @license lucide-react v1.75.0 - ISC
341
- *
342
- * This source code is licensed under the ISC license.
343
- * See the LICENSE file in the root directory of this source tree.
344
- */const ZN={name:"landmark",size:24,node:[["path",{d:"M10 18v-7",key:"wt116b"}],["path",{d:"M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z",key:"yxxwt6"}],["path",{d:"M14 18v-7",key:"vav6t3"}],["path",{d:"M18 18v-7",key:"aexdmj"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M6 18v-7",key:"1ivflk"}]]};ZN.node;const SD=U(ZN);/**
345
- * @license lucide-react v1.75.0 - ISC
346
- *
347
- * This source code is licensed under the ISC license.
348
- * See the LICENSE file in the root directory of this source tree.
349
- */const HN={name:"layout-grid",size:24,node:[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]};HN.node;const bo=U(HN);/**
350
- * @license lucide-react v1.75.0 - ISC
351
- *
352
- * This source code is licensed under the ISC license.
353
- * See the LICENSE file in the root directory of this source tree.
354
- */const qN={name:"letter-b",size:24,node:[["path",{d:"M6 12h9a4 4 0 010 8H7a1 1 0 01-1-1V5a1 1 0 011-1h7a4 4 0 010 8",key:"n8tvfh"}]],aliases:["bold"]};qN.node;const jD=U(qN);/**
355
- * @license lucide-react v1.75.0 - ISC
356
- *
357
- * This source code is licensed under the ISC license.
358
- * See the LICENSE file in the root directory of this source tree.
359
- */const KN={name:"library",size:24,node:[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]};KN.node;const CD=U(KN);/**
360
- * @license lucide-react v1.75.0 - ISC
361
- *
362
- * This source code is licensed under the ISC license.
363
- * See the LICENSE file in the root directory of this source tree.
364
- */const JN={name:"lightbulb",size:24,node:[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]};JN.node;const Cm=U(JN);/**
365
- * @license lucide-react v1.75.0 - ISC
366
- *
367
- * This source code is licensed under the ISC license.
368
- * See the LICENSE file in the root directory of this source tree.
369
- */const GN={name:"link-2",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]};GN.node;const oo=U(GN);/**
370
- * @license lucide-react v1.75.0 - ISC
371
- *
372
- * This source code is licensed under the ISC license.
373
- * See the LICENSE file in the root directory of this source tree.
374
- */const YN={name:"link",size:24,node:[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]};YN.node;const _D=U(YN);/**
375
- * @license lucide-react v1.75.0 - ISC
376
- *
377
- * This source code is licensed under the ISC license.
378
- * See the LICENSE file in the root directory of this source tree.
379
- */const QN={name:"list-ordered",size:24,node:[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]};QN.node;const ND=U(QN);/**
380
- * @license lucide-react v1.75.0 - ISC
381
- *
382
- * This source code is licensed under the ISC license.
383
- * See the LICENSE file in the root directory of this source tree.
384
- */const XN={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]};XN.node;const So=U(XN);/**
385
- * @license lucide-react v1.75.0 - ISC
386
- *
387
- * This source code is licensed under the ISC license.
388
- * See the LICENSE file in the root directory of this source tree.
389
- */const eE={name:"mail",size:24,node:[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]};eE.node;const ED=U(eE);/**
390
- * @license lucide-react v1.75.0 - ISC
391
- *
392
- * This source code is licensed under the ISC license.
393
- * See the LICENSE file in the root directory of this source tree.
394
- */const tE={name:"map",size:24,node:[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]};tE.node;const $D=U(tE);/**
395
- * @license lucide-react v1.75.0 - ISC
396
- *
397
- * This source code is licensed under the ISC license.
398
- * See the LICENSE file in the root directory of this source tree.
399
- */const nE={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]};nE.node;const MD=U(nE);/**
400
- * @license lucide-react v1.75.0 - ISC
401
- *
402
- * This source code is licensed under the ISC license.
403
- * See the LICENSE file in the root directory of this source tree.
404
- */const rE={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]};rE.node;const sE=U(rE);/**
405
- * @license lucide-react v1.75.0 - ISC
406
- *
407
- * This source code is licensed under the ISC license.
408
- * See the LICENSE file in the root directory of this source tree.
409
- */const iE={name:"message-circle-plus",size:24,node:[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]};iE.node;const TD=U(iE);/**
410
- * @license lucide-react v1.75.0 - ISC
411
- *
412
- * This source code is licensed under the ISC license.
413
- * See the LICENSE file in the root directory of this source tree.
414
- */const oE={name:"message-circle-question-mark",size:24,node:[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9 9.5a3 2.5 0 016 0c0 2-2 2-3 3.5",key:"1awbb0"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["message-circle-question"]};oE.node;const aE=U(oE);/**
415
- * @license lucide-react v1.75.0 - ISC
416
- *
417
- * This source code is licensed under the ISC license.
418
- * See the LICENSE file in the root directory of this source tree.
419
- */const lE={name:"message-circle",size:24,node:[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]};lE.node;const Yi=U(lE);/**
420
- * @license lucide-react v1.75.0 - ISC
421
- *
422
- * This source code is licensed under the ISC license.
423
- * See the LICENSE file in the root directory of this source tree.
424
- */const cE={name:"message-square-text",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]};cE.node;const OD=U(cE);/**
425
- * @license lucide-react v1.75.0 - ISC
426
- *
427
- * This source code is licensed under the ISC license.
428
- * See the LICENSE file in the root directory of this source tree.
429
- */const dE={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};dE.node;const uE=U(dE);/**
430
- * @license lucide-react v1.75.0 - ISC
431
- *
432
- * This source code is licensed under the ISC license.
433
- * See the LICENSE file in the root directory of this source tree.
434
- */const fE={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};fE.node;const o1=U(fE);/**
435
- * @license lucide-react v1.75.0 - ISC
436
- *
437
- * This source code is licensed under the ISC license.
438
- * See the LICENSE file in the root directory of this source tree.
439
- */const hE={name:"network",size:24,node:[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]};hE.node;const AD=U(hE);/**
440
- * @license lucide-react v1.75.0 - ISC
441
- *
442
- * This source code is licensed under the ISC license.
443
- * See the LICENSE file in the root directory of this source tree.
444
- */const pE={name:"package",size:24,node:[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]};pE.node;const RD=U(pE);/**
445
- * @license lucide-react v1.75.0 - ISC
446
- *
447
- * This source code is licensed under the ISC license.
448
- * See the LICENSE file in the root directory of this source tree.
449
- */const mE={name:"panel-left",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],aliases:["sidebar"]};mE.node;const gE=U(mE);/**
450
- * @license lucide-react v1.75.0 - ISC
451
- *
452
- * This source code is licensed under the ISC license.
453
- * See the LICENSE file in the root directory of this source tree.
454
- */const yE={name:"panel-right",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]};yE.node;const ID=U(yE);/**
455
- * @license lucide-react v1.75.0 - ISC
456
- *
457
- * This source code is licensed under the ISC license.
458
- * See the LICENSE file in the root directory of this source tree.
459
- */const xE={name:"pause",size:24,node:[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]};xE.node;const PD=U(xE);/**
460
- * @license lucide-react v1.75.0 - ISC
461
- *
462
- * This source code is licensed under the ISC license.
463
- * See the LICENSE file in the root directory of this source tree.
464
- */const vE={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};vE.node;const DD=U(vE);/**
465
- * @license lucide-react v1.75.0 - ISC
466
- *
467
- * This source code is licensed under the ISC license.
468
- * See the LICENSE file in the root directory of this source tree.
469
- */const kE={name:"phone-call",size:24,node:[["path",{d:"M13 2a9 9 0 0 1 9 9",key:"1itnx2"}],["path",{d:"M13 6a5 5 0 0 1 5 5",key:"11nki7"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]]};kE.node;const zD=U(kE);/**
470
- * @license lucide-react v1.75.0 - ISC
471
- *
472
- * This source code is licensed under the ISC license.
473
- * See the LICENSE file in the root directory of this source tree.
474
- */const wE={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]};wE.node;const LD=U(wE);/**
475
- * @license lucide-react v1.75.0 - ISC
476
- *
477
- * This source code is licensed under the ISC license.
478
- * See the LICENSE file in the root directory of this source tree.
479
- */const bE={name:"plug",size:24,node:[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]};bE.node;const xp=U(bE);/**
480
- * @license lucide-react v1.75.0 - ISC
481
- *
482
- * This source code is licensed under the ISC license.
483
- * See the LICENSE file in the root directory of this source tree.
484
- */const SE={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]};SE.node;const a1=U(SE);/**
485
- * @license lucide-react v1.75.0 - ISC
486
- *
487
- * This source code is licensed under the ISC license.
488
- * See the LICENSE file in the root directory of this source tree.
489
- */const jE={name:"puzzle",size:24,node:[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]};jE.node;const CE=U(jE);/**
490
- * @license lucide-react v1.75.0 - ISC
491
- *
492
- * This source code is licensed under the ISC license.
493
- * See the LICENSE file in the root directory of this source tree.
494
- */const _E={name:"radio",size:24,node:[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]};_E.node;const FD=U(_E);/**
495
- * @license lucide-react v1.75.0 - ISC
496
- *
497
- * This source code is licensed under the ISC license.
498
- * See the LICENSE file in the root directory of this source tree.
499
- */const NE={name:"receipt",size:24,node:[["path",{d:"M12 17V7",key:"pyj7ub"}],["path",{d:"M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8",key:"1elt7d"}],["path",{d:"M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z",key:"ycz6yz"}]]};NE.node;const BD=U(NE);/**
500
- * @license lucide-react v1.75.0 - ISC
501
- *
502
- * This source code is licensed under the ISC license.
503
- * See the LICENSE file in the root directory of this source tree.
504
- */const EE={name:"redo-2",size:24,node:[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]};EE.node;const VD=U(EE);/**
505
- * @license lucide-react v1.75.0 - ISC
506
- *
507
- * This source code is licensed under the ISC license.
508
- * See the LICENSE file in the root directory of this source tree.
509
- */const $E={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};$E.node;const WD=U($E);/**
510
- * @license lucide-react v1.75.0 - ISC
511
- *
512
- * This source code is licensed under the ISC license.
513
- * See the LICENSE file in the root directory of this source tree.
514
- */const ME={name:"route",size:24,node:[["path",{d:"M9 5h8.5a1 1 0 010 7h-11a1 1 0 000 7H15",key:"1r1aam"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["circle",{cx:"6",cy:"5",r:"3",key:"151irh"}]]};ME.node;const UD=U(ME);/**
515
- * @license lucide-react v1.75.0 - ISC
516
- *
517
- * This source code is licensed under the ISC license.
518
- * See the LICENSE file in the root directory of this source tree.
519
- */const TE={name:"scan",size:24,node:[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]};TE.node;const OE=U(TE);/**
520
- * @license lucide-react v1.75.0 - ISC
521
- *
522
- * This source code is licensed under the ISC license.
523
- * See the LICENSE file in the root directory of this source tree.
524
- */const AE={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};AE.node;const Oy=U(AE);/**
525
- * @license lucide-react v1.75.0 - ISC
526
- *
527
- * This source code is licensed under the ISC license.
528
- * See the LICENSE file in the root directory of this source tree.
529
- */const RE={name:"send",size:24,node:[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]};RE.node;const ZD=U(RE);/**
530
- * @license lucide-react v1.75.0 - ISC
531
- *
532
- * This source code is licensed under the ISC license.
533
- * See the LICENSE file in the root directory of this source tree.
534
- */const IE={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};IE.node;const HD=U(IE);/**
535
- * @license lucide-react v1.75.0 - ISC
536
- *
537
- * This source code is licensed under the ISC license.
538
- * See the LICENSE file in the root directory of this source tree.
539
- */const PE={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};PE.node;const qD=U(PE);/**
540
- * @license lucide-react v1.75.0 - ISC
541
- *
542
- * This source code is licensed under the ISC license.
543
- * See the LICENSE file in the root directory of this source tree.
544
- */const DE={name:"share-2",size:24,node:[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]};DE.node;const KD=U(DE);/**
545
- * @license lucide-react v1.75.0 - ISC
546
- *
547
- * This source code is licensed under the ISC license.
548
- * See the LICENSE file in the root directory of this source tree.
549
- */const zE={name:"share",size:24,node:[["path",{d:"M12 2v13",key:"1km8f5"}],["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}]]};zE.node;const JD=U(zE);/**
550
- * @license lucide-react v1.75.0 - ISC
551
- *
552
- * This source code is licensed under the ISC license.
553
- * See the LICENSE file in the root directory of this source tree.
554
- */const LE={name:"shopping-cart",size:24,node:[["path",{d:"m2.05 2.05 1.099-.028a1 1 0 0 1 1.008.815l2.69 14.347A1 1 0 0 0 7.83 18H18",key:"uebgi3"}],["path",{d:"M4.563 5h16.435a1 1 0 0 1 .981 1.204l-1.026 6.226A2 2 0 0 1 18.962 14H6.25",key:"1j7c9p"}],["circle",{cx:"18",cy:"20",r:"2",key:"t9985n"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]]};LE.node;const GD=U(LE);/**
555
- * @license lucide-react v1.75.0 - ISC
556
- *
557
- * This source code is licensed under the ISC license.
558
- * See the LICENSE file in the root directory of this source tree.
559
- */const FE={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};FE.node;const BE=U(FE);/**
560
- * @license lucide-react v1.75.0 - ISC
561
- *
562
- * This source code is licensed under the ISC license.
563
- * See the LICENSE file in the root directory of this source tree.
564
- */const VE={name:"star",size:24,node:[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]};VE.node;const WE=U(VE);/**
565
- * @license lucide-react v1.75.0 - ISC
566
- *
567
- * This source code is licensed under the ISC license.
568
- * See the LICENSE file in the root directory of this source tree.
569
- */const UE={name:"store",size:24,node:[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]]};UE.node;const YD=U(UE);/**
570
- * @license lucide-react v1.75.0 - ISC
571
- *
572
- * This source code is licensed under the ISC license.
573
- * See the LICENSE file in the root directory of this source tree.
574
- */const ZE={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};ZE.node;const HE=U(ZE);/**
575
- * @license lucide-react v1.75.0 - ISC
576
- *
577
- * This source code is licensed under the ISC license.
578
- * See the LICENSE file in the root directory of this source tree.
579
- */const qE={name:"table-2",size:24,node:[["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]};qE.node;const Ed=U(qE);/**
580
- * @license lucide-react v1.75.0 - ISC
581
- *
582
- * This source code is licensed under the ISC license.
583
- * See the LICENSE file in the root directory of this source tree.
584
- */const KE={name:"timer",size:24,node:[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]};KE.node;const QD=U(KE);/**
585
- * @license lucide-react v1.75.0 - ISC
586
- *
587
- * This source code is licensed under the ISC license.
588
- * See the LICENSE file in the root directory of this source tree.
589
- */const JE={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};JE.node;const XD=U(JE);/**
590
- * @license lucide-react v1.75.0 - ISC
591
- *
592
- * This source code is licensed under the ISC license.
593
- * See the LICENSE file in the root directory of this source tree.
594
- */const GE={name:"triangle-exclamation-point",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle","triangle-alert"]};GE.node;const ez=U(GE);/**
595
- * @license lucide-react v1.75.0 - ISC
596
- *
597
- * This source code is licensed under the ISC license.
598
- * See the LICENSE file in the root directory of this source tree.
599
- */const YE={name:"undo-2",size:24,node:[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]};YE.node;const tz=U(YE);/**
600
- * @license lucide-react v1.75.0 - ISC
601
- *
602
- * This source code is licensed under the ISC license.
603
- * See the LICENSE file in the root directory of this source tree.
604
- */const QE={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};QE.node;const nz=U(QE);/**
605
- * @license lucide-react v1.75.0 - ISC
606
- *
607
- * This source code is licensed under the ISC license.
608
- * See the LICENSE file in the root directory of this source tree.
609
- */const XE={name:"user-cog",size:24,node:[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};XE.node;const rz=U(XE);/**
610
- * @license lucide-react v1.75.0 - ISC
611
- *
612
- * This source code is licensed under the ISC license.
613
- * See the LICENSE file in the root directory of this source tree.
614
- */const e$={name:"user-round",size:24,node:[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],aliases:["user-2"]};e$.node;const sz=U(e$);/**
615
- * @license lucide-react v1.75.0 - ISC
616
- *
617
- * This source code is licensed under the ISC license.
618
- * See the LICENSE file in the root directory of this source tree.
619
- */const t$={name:"users-round",size:24,node:[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],aliases:["users-2"]};t$.node;const iz=U(t$);/**
620
- * @license lucide-react v1.75.0 - ISC
621
- *
622
- * This source code is licensed under the ISC license.
623
- * See the LICENSE file in the root directory of this source tree.
624
- */const n$={name:"users",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};n$.node;const l1=U(n$);/**
625
- * @license lucide-react v1.75.0 - ISC
626
- *
627
- * This source code is licensed under the ISC license.
628
- * See the LICENSE file in the root directory of this source tree.
629
- */const r$={name:"waypoints",size:24,node:[["path",{d:"m10.586 5.414-5.172 5.172",key:"4mc350"}],["path",{d:"m18.586 13.414-5.172 5.172",key:"8c96vv"}],["path",{d:"M6 12h12",key:"8npq4p"}],["circle",{cx:"12",cy:"20",r:"2",key:"144qzu"}],["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["circle",{cx:"20",cy:"12",r:"2",key:"1xzzfp"}],["circle",{cx:"4",cy:"12",r:"2",key:"1hvhnz"}]]};r$.node;const s$=U(r$);/**
630
- * @license lucide-react v1.75.0 - ISC
631
- *
632
- * This source code is licensed under the ISC license.
633
- * See the LICENSE file in the root directory of this source tree.
634
- */const i$={name:"workflow",size:24,node:[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]};i$.node;const $d=U(i$);/**
635
- * @license lucide-react v1.75.0 - ISC
636
- *
637
- * This source code is licensed under the ISC license.
638
- * See the LICENSE file in the root directory of this source tree.
639
- */const o$={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};o$.node;const oz=U(o$);/**
640
- * @license lucide-react v1.75.0 - ISC
641
- *
642
- * This source code is licensed under the ISC license.
643
- * See the LICENSE file in the root directory of this source tree.
644
- */const a$={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};a$.node;const zo=U(a$);/**
645
- * @license lucide-react v1.75.0 - ISC
646
- *
647
- * This source code is licensed under the ISC license.
648
- * See the LICENSE file in the root directory of this source tree.
649
- */const l$={name:"zap",size:24,node:[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]]};l$.node;const c$=U(l$),az={"app-window":iD,"book-open":K_,box:G_,boxes:lD,"clipboard-list":uD,"credit-card":hD,database:jN,"file-text":Bf,globe:yD,"key-round":i1,landmark:SD,library:CD,mail:ED,package:RD,plug:xp,radio:FD,receipt:BD,route:UD,send:ZD,server:HD,"shopping-cart":GD,store:YD,table:Ed,timer:QD,"user-cog":rz,"user-round":sz,users:l1,waypoints:s$,zap:c$};function Md(t){return az[t]??G_}function lr({name:t,x:e,y:n,size:r=16,color:s="currentColor",strokeWidth:i=1.75}){const o=Md(t);return d.jsx(o,{x:e,y:n,width:r,height:r,color:s,strokeWidth:i,"aria-hidden":!0})}const dt=t=>t.startsWith("#")?t:`var(--poney-${t==="poney"?"accent":t})`,mn=(t,e=10)=>`color-mix(in srgb, ${dt(t)} ${e}%, var(--poney-paper-raised))`;function d$({scene:t,extra:e=[]}){const n=fn(),r=new Map(e.map(i=>[i.id,i])),s=i=>n.entities.get(i)??r.get(i);return d.jsxs("g",{children:[(t.groups??[]).map(i=>{const o=s(i.entityId);return o?d.jsx(dz,{group:i,entity:o},i.entityId):null}),t.edges.map(i=>d.jsx(uz,{edge:i},i.id)),t.nodes.map(i=>{const o=s(i.entityId);return o?d.jsx(cz,{node:i,entity:o},i.entityId):null}),t.edges.map(i=>d.jsx(fz,{edge:i},`l-${i.id}`)),[...t.groups??[],...t.nodes].map(i=>d.jsx(hz,{node:i},`c-${i.entityId}`)),t.edges.map(i=>d.jsx(pz,{edge:i},`ec-${i.id}`)),t.nodes.filter(i=>{var o;return(o=i.members)==null?void 0:o.length}).map(i=>d.jsx(lz,{node:i,names:i.members.map(o=>{var a;return((a=s(o))==null?void 0:a.name)??o})},`p-${i.entityId}`))]})}function lz({node:t,names:e}){const{hot:n}=dr();if(n!==`entity:${t.entityId}`)return null;const r=e.slice(0,6),s=e.length-r.length,i=[...r,...s>0?[`and ${s} more`]:[]],o=Math.max(t.w,Math.max(...i.map(u=>Te(u,12.5,500)))+40),a=i.length*22+38,l=t.x+t.w/2-o/2,c=t.y+t.h+12;return d.jsxs("g",{pointerEvents:"none",transform:`translate(${l} ${c})`,children:[d.jsx("rect",{width:o,height:a,rx:12,fill:"var(--poney-paper-raised)",stroke:"var(--poney-story-rule)"}),d.jsx("text",{x:16,y:22,fontSize:11.5,fontWeight:600,fill:"var(--poney-ink-3)",children:"Inside"}),i.map((u,f)=>d.jsx("text",{x:16,y:44+f*22,fontSize:12.5,fontWeight:f<r.length?500:400,fill:f<r.length?"var(--poney-ink)":"var(--poney-ink-3)",children:u},f))]})}function cz({node:t,entity:e}){const n=fn(),r=Sn(),s=`entity:${e.id}`,i=t.members??[],o=xl([s,...i.map(v=>`entity:${v}`)]),a=n.style(e),{setHot:l,toggleGroup:c}=dr(),{x:u,y:f,w:h,h:m}=t,g=o.hot?"var(--poney-accent)":vl(o.state,o.focused?"var(--poney-story-line)":"var(--poney-story-rule)"),p=o.state==="removed",x=i.length?`${i.length} inside${e.technology?` · ${e.technology}`:""}`:e.technology??a.label,y=r({kind:"entity",id:e.id},`${e.name}. ${e.summary}`);return d.jsxs("g",{transform:`translate(${u} ${f})`,...y,className:`poney-el ${Mr(o)}`,onMouseEnter:()=>{var v;(v=y.onMouseEnter)==null||v.call(y),l(s)},onMouseLeave:()=>{var v;(v=y.onMouseLeave)==null||v.call(y),l(null)},children:[i.length>0&&d.jsx("rect",{x:5,y:5,width:h,height:m,rx:14,fill:"var(--poney-story-node)",stroke:"var(--poney-story-rule)",strokeWidth:1.2}),d.jsx("rect",{width:h,height:m,rx:14,fill:Gv(o.state),stroke:g,strokeWidth:o.state||o.hot?1.75:1.2,strokeDasharray:p||e.kind==="external"?"6 4":void 0}),i.length>0&&c&&d.jsx(u$,{open:!1,name:e.name,x:h-22,y:m/2,onToggle:()=>c(e.id)}),d.jsx(lr,{name:a.icon,x:18,y:m/2-9,size:18,color:o.state?`var(--poney-${o.state})`:dt(a.tone)}),d.jsx("text",{x:48,y:m/2-2,fontSize:15,fontWeight:600,fill:"var(--poney-ink)",textDecoration:p?"line-through":void 0,children:Nt(e.name,h-(i.length&&c?92:60),15,600)}),d.jsx("text",{x:48,y:m/2+17,fontSize:12.5,fill:"var(--poney-ink-3)",children:Nt(x,h-(i.length&&c?92:60),12.5)}),d.jsx(Cd,{state:o.state,x:h-12,y:0,anchor:"end"}),d.jsx("rect",{className:"poney-focus",x:-5,y:-5,width:h+10,height:m+10,rx:18,fill:"none",stroke:"var(--poney-accent)",strokeWidth:2,strokeDasharray:"4 3"})]})}function dz({group:t,entity:e}){const n=fn(),r=Sn(),s=`entity:${e.id}`,i=Ps(s),o=xl(t.members.map(y=>`entity:${y}`)),{setHot:a,toggleGroup:l}=dr(),c=n.style(e),{x:u,y:f,w:h,h:m}=t,g=r({kind:"entity",id:e.id},`${e.name}. ${e.summary}`),p=i.hot?"var(--poney-accent)":vl(i.state,"var(--poney-story-rule)"),x=e.technology??c.label;return d.jsxs("g",{transform:`translate(${u} ${f})`,className:`poney-el ${Mr({...i,dim:i.dim&&o.dim})}`,children:[d.jsx("rect",{width:h,height:m,rx:18,fill:i.state?`var(--poney-${i.state}-wash)`:"var(--poney-sunken)",fillOpacity:i.state?.55:.45,stroke:p,strokeWidth:i.state||i.hot?1.6:1.1}),d.jsxs("g",{...g,onMouseEnter:()=>{var y;(y=g.onMouseEnter)==null||y.call(g),a(s)},onMouseLeave:()=>{var y;(y=g.onMouseLeave)==null||y.call(g),a(null)},children:[d.jsx("rect",{width:h,height:44,rx:18,fill:"transparent"}),d.jsx(lr,{name:c.icon,x:16,y:14,size:16,color:i.state?`var(--poney-${i.state})`:dt(c.tone)}),d.jsx("text",{x:40,y:27,fontSize:14,fontWeight:600,fill:"var(--poney-ink)",children:Nt(e.name,h-(l?150:110),14,600)}),d.jsx("text",{x:40+Math.min(gw(e.name),h-(l?150:110))+10,y:27,fontSize:12,fill:"var(--poney-ink-3)",children:Nt(x,Math.max(0,h-40-gw(e.name)-(l?56:24)),12)})]}),d.jsx(Cd,{state:i.state,x:h-(l?44:14),y:22,anchor:"end"}),l&&d.jsx(u$,{open:!0,name:e.name,x:h-24,y:22,onToggle:()=>l(e.id)})]})}const gw=t=>Te(t,14,600);function u$({open:t,name:e,x:n,y:r,onToggle:s}){return d.jsxs("g",{role:"button",tabIndex:0,"aria-label":`${t?"Close":"Open"} ${e}`,className:"poney-control",onClick:i=>{i.stopPropagation(),s()},onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),s())},children:[d.jsx("title",{children:t?`Close ${e}`:`Open ${e}`}),d.jsx("circle",{cx:n,cy:r,r:11,fill:"var(--poney-paper-raised)",stroke:"var(--poney-story-line)",strokeWidth:1.1}),d.jsx("line",{x1:n-4.5,y1:r,x2:n+4.5,y2:r,stroke:"var(--poney-ink-2)",strokeWidth:1.6,strokeLinecap:"round"}),!t&&d.jsx("line",{x1:n,y1:r-4.5,x2:n,y2:r+4.5,stroke:"var(--poney-ink-2)",strokeWidth:1.6,strokeLinecap:"round"})]})}function uz({edge:t}){const e=fn(),n=Sn(),{setHot:r}=dr(),s=`relationship:${t.id}`,i=xl(t.relationships.map(x=>`relationship:${x}`)),o=e.relationships.get(t.id),[a,l,c,u]=t.curve,f=i.hot?"var(--poney-accent)":vl(i.state,i.focused?"var(--poney-story-line)":"var(--poney-story-rule)"),h=Math.atan2(u.y-c.y,u.x-c.x),m={x:u.x-Math.cos(h)*8,y:u.y-Math.sin(h)*8},g=(o==null?void 0:o.kind)==="publishes"||(o==null?void 0:o.kind)==="subscribes",p=n({kind:"relationship",id:t.id},(o==null?void 0:o.label)??t.id);return d.jsxs("g",{...p,className:`poney-el ${Mr(i)}`,onMouseEnter:()=>{var x;(x=p.onMouseEnter)==null||x.call(p),r(s)},onMouseLeave:()=>{var x;(x=p.onMouseLeave)==null||x.call(p),r(null)},children:[d.jsx("path",{d:`M ${a.x} ${a.y} C ${l.x} ${l.y} ${c.x} ${c.y} ${u.x} ${u.y}`,fill:"none",stroke:"transparent",strokeWidth:16}),d.jsx("path",{d:`M ${a.x} ${a.y} C ${l.x} ${l.y} ${c.x} ${c.y} ${m.x} ${m.y}`,fill:"none",stroke:f,strokeWidth:i.state||i.hot?2:1.4,strokeDasharray:i.state==="removed"||g?"6 5":void 0,strokeLinecap:"round"}),d.jsx(Lf,{x:u.x,y:u.y,angle:h,color:f})]})}function fz({edge:t}){const e=dr(),n=xl(t.relationships.map(g=>`relationship:${g}`));if(!(!n.hidden&&(n.hot||e.allLabels||!!n.callout||!!e.focus&&n.focused||!e.focus&&!!n.state)))return null;const{x:s,y:i,w:o,h:a,text:l,sub:c}=t.label,u=n.hot?"var(--poney-accent)":n.state?`var(--poney-${n.state})`:"var(--poney-ink-2)",f=n.hot?"var(--poney-accent)":n.state?`var(--poney-${n.state})`:"var(--poney-story-line)",h=t.leader,m=h?{x:Math.max(s,Math.min(s+o,h.x)),y:Math.max(i,Math.min(i+a,h.y))}:void 0;return d.jsxs("g",{pointerEvents:"none",className:`poney-story-el ${n.dim?"poney-story-dim":""}`,children:[h&&m&&d.jsxs(d.Fragment,{children:[d.jsx("line",{x1:m.x,y1:m.y,x2:h.x,y2:h.y,stroke:f,strokeWidth:1,strokeDasharray:"2 3"}),d.jsx("circle",{cx:h.x,cy:h.y,r:2.5,fill:f})]}),d.jsxs("g",{transform:`translate(${s} ${i})`,children:[d.jsx("rect",{width:o,height:a,rx:11,fill:"var(--poney-paper-raised)",stroke:n.hot?"var(--poney-accent)":n.state?`var(--poney-${n.state})`:"var(--poney-story-rule)"}),d.jsx("text",{x:o/2,y:15,textAnchor:"middle",fontSize:12,fontWeight:500,fill:u,children:l}),c&&d.jsx("text",{x:o/2,y:29,textAnchor:"middle",fontSize:11,fill:"var(--poney-ink-3)",children:c})]})]})}function hz({node:t}){const e=xl([`entity:${t.entityId}`,...(("depth"in t?[]:t.members)??[]).map(n=>`entity:${n}`)]);return!e.callout||e.hidden?null:d.jsx(kl,{n:e.callout,x:t.x-2,y:t.y-2,hot:e.hot})}function pz({edge:t}){const e=xl(t.relationships.map(n=>`relationship:${n}`));return!e.callout||e.hidden?null:d.jsx(kl,{n:e.callout,x:t.label.x-14,y:t.label.y+t.label.h/2,hot:e.hot})}function mz({scene:t}){const e=t.interactionId;return d.jsxs("g",{children:[t.fragments.slice().sort((n,r)=>n.depth-r.depth).map(n=>d.jsx(kz,{f:n,behavior:e},n.id)),t.participants.map(n=>d.jsx(gz,{p:n},n.entityId)),t.activations.map((n,r)=>d.jsx("rect",{x:n.x+1,y:n.y1,width:8,height:n.y2-n.y1,rx:3,fill:"var(--poney-sunken)",stroke:"var(--poney-story-rule)"},r)),t.fragments.map(n=>d.jsx(wz,{f:n,behavior:e},`fl-${n.id}`)),t.messages.map(n=>d.jsx(vz,{m:n,behavior:e},n.id)),t.participants.map(n=>d.jsx(yz,{p:n},`h-${n.entityId}`))]})}function gz({p:t}){const e=Ps(`entity:${t.entityId}`);return d.jsx("line",{x1:t.x,x2:t.x,y1:t.lifeline.y1,y2:t.lifeline.y2,stroke:e.hot?"var(--poney-accent)":"var(--poney-story-rule)",strokeWidth:e.hot?1.5:1,className:Mr({...e,dim:!1})})}function yz({p:t}){const e=fn(),n=Sn(),{setHot:r}=dr(),s=`entity:${t.entityId}`,i=Ps(s),o=e.entities.get(t.entityId);if(!o)return null;const a=e.style(o),{x:l,y:c,w:u,h:f}=t.header,h=n({kind:"entity",id:o.id},`${o.name}, ${a.label}`);return d.jsxs("g",{transform:`translate(${l} ${c})`,...h,className:`poney-el ${Mr({...i,dim:!1})}`,onMouseEnter:()=>{var m;(m=h.onMouseEnter)==null||m.call(h),r(s)},onMouseLeave:()=>{var m;(m=h.onMouseLeave)==null||m.call(h),r(null)},children:[d.jsx("rect",{width:u,height:f,rx:14,fill:Gv(i.state),stroke:i.hot?"var(--poney-accent)":vl(i.state,"var(--poney-story-line)"),strokeWidth:i.state?1.75:1.2,strokeDasharray:o.kind==="external"?"6 4":void 0}),d.jsx(lr,{name:a.icon,x:16,y:f/2-9,size:18,color:i.state?`var(--poney-${i.state})`:dt(a.tone)}),d.jsx("text",{x:44,y:f/2-1,fontSize:14.5,fontWeight:600,fill:"var(--poney-ink)",children:Nt(o.name,u-54,14.5,600)}),d.jsx("text",{x:44,y:f/2+16,fontSize:12,fill:"var(--poney-ink-3)",children:Nt(o.technology??a.label,u-54,12)}),d.jsx(Cd,{state:i.state,x:u-10,y:0,anchor:"end"}),i.callout&&d.jsx(kl,{n:i.callout,x:-2,y:-2,hot:i.hot})]})}function xz(t){return t.hot?"var(--poney-accent)":t.state?`var(--poney-${t.state})`:"var(--poney-ink-2)"}function vz({m:t,behavior:e}){const n=Sn(),{setHot:r}=dr(),s=`message:${e}:${t.id}`,i=Ps(s),o=xz(i),a=i.state||i.hot?1.9:1.35,l=String(t.number),c=Te(l,11.5,600)+8,u=Te(t.label,13,i.state?600:500),f=n({kind:"message",behavior:e,id:t.id},`Step ${t.number}: ${t.label}`),h={...f,className:`poney-el ${Mr(i)}`,onMouseEnter:()=>{var p;(p=f.onMouseEnter)==null||p.call(f),r(s)},onMouseLeave:()=>{var p;(p=f.onMouseLeave)==null||p.call(f),r(null)}},m=(p,x,y)=>{const v=c+u,k=y==="middle"?p-v/2:p;return d.jsxs(d.Fragment,{children:[d.jsx("text",{x:k,y:x,fontSize:11.5,fontWeight:600,fill:"var(--poney-ink-3)",className:"poney-numbers",stroke:"var(--poney-paper-raised)",strokeWidth:5,paintOrder:"stroke",strokeLinejoin:"round",children:l}),d.jsx("text",{x:k+c,y:x,stroke:"var(--poney-paper-raised)",strokeWidth:5,paintOrder:"stroke",strokeLinejoin:"round",fontSize:13,fontWeight:i.state?600:500,fill:i.state||i.hot?o:t.kind==="return"?"var(--poney-ink-2)":"var(--poney-ink)",children:t.label}),d.jsx(Cd,{state:i.state,x:k+v+14,y:x-4.5}),i.callout&&d.jsx(kl,{n:i.callout,x:k-18,y:x-4.5,hot:i.hot})]})};if(t.loop){const{x:p,y1:x,y2:y,w:v}=t.loop;return d.jsxs("g",{...h,children:[d.jsx("rect",{x:p-4,y:x-14,width:v+u+c+90,height:y-x+26,fill:"transparent"}),d.jsx("path",{d:`M ${p} ${x} H ${p+v} V ${y} H ${p+8}`,fill:"none",stroke:o,strokeWidth:a,strokeLinejoin:"round"}),d.jsx(Lf,{x:p+1,y,angle:Math.PI,color:o,size:6}),m(p+v+14,(x+y)/2+4.5,"start")]})}const g=t.x2>t.x1;return d.jsxs("g",{...h,children:[d.jsx("rect",{x:Math.min(t.x1,t.x2),y:t.y-24,width:Math.abs(t.x2-t.x1),height:32,fill:"transparent"}),d.jsx("line",{x1:t.x1,x2:t.x2+(g?-8:8),y1:t.y,y2:t.y,stroke:o,strokeWidth:a,strokeDasharray:t.kind==="return"?"5 4":t.kind==="async"?"2 4":void 0,strokeLinecap:"round"}),d.jsx(Lf,{x:t.x2,y:t.y,angle:g?0:Math.PI,color:o,size:6}),m((t.x1+t.x2)/2,t.y-9,"middle")]})}function kz({f:t,behavior:e}){const n=Ps(`fragment:${e}:${t.id}`);return d.jsxs("g",{className:Mr(n),children:[d.jsx("rect",{x:t.x,y:t.y,width:t.w,height:t.h,rx:14,fill:"var(--poney-paper)",fillOpacity:.55,stroke:"var(--poney-story-rule)"}),t.branches.slice(1).map((r,s)=>d.jsx("line",{x1:t.x+10,x2:t.x+t.w-10,y1:r.y,y2:r.y,stroke:"var(--poney-story-rule)",strokeDasharray:"4 4"},s))]})}function wz({f:t,behavior:e}){var a;const n=Ps(`fragment:${e}:${t.id}`),r=jd(t.kind),s=((a=t.branches[0])==null?void 0:a.guard)??"",i=Te(r,11.5,650),o={stroke:"var(--poney-paper-raised)",strokeWidth:5,paintOrder:"stroke",strokeLinejoin:"round"};return d.jsxs("g",{className:Mr(n),pointerEvents:"none",children:[d.jsx("text",{x:t.x+14,y:t.y+19,fontSize:11.5,fontWeight:650,fill:"var(--poney-ink-3)",...o,children:r}),d.jsx("text",{x:t.x+24+i,y:t.y+19,fontSize:12,fill:"var(--poney-ink-2)",...o,children:t.kind==="loop"||t.kind==="opt"?s:`if ${s}`}),t.branches.slice(1).map((l,c)=>d.jsx("text",{x:t.x+14,y:l.y+18,fontSize:12,fill:"var(--poney-ink-2)",...o,children:t.kind==="par"?`and ${l.guard}`:`else, if ${l.guard}`},c))]})}function bz({scene:t}){return d.jsxs("g",{children:[t.transitions.map(e=>d.jsx(jz,{t:e,machine:t.machineId},e.id)),t.states.map(e=>d.jsx(Sz,{s:e,machine:t.machineId},e.id)),t.transitions.map(e=>d.jsx(Cz,{t:e,machine:t.machineId},`l-${e.id}`))]})}function f$(t,e,n,r){const s=Sn(),{setHot:i}=dr(),o=s(e,n);return{...o,className:`poney-el ${r}`,onMouseEnter:()=>{var a;(a=o.onMouseEnter)==null||a.call(o),i(t)},onMouseLeave:()=>{var a;(a=o.onMouseLeave)==null||a.call(o),i(null)}}}function Sz({s:t,machine:e}){const n=`state:${e}:${t.id}`,r=Ps(n),s=f$(n,{kind:"state",behavior:e,id:t.id},`State ${t.name}`,Mr(r)),i=t.outcome==="success"?"var(--poney-success)":t.outcome==="failure"?"var(--poney-failure)":void 0;if(t.kind==="initial")return d.jsx("g",{transform:`translate(${t.x} ${t.y})`,...s,children:d.jsx("circle",{cx:t.w/2,cy:t.h/2,r:8,fill:"var(--poney-ink)"})});const o=r.hot?"var(--poney-accent)":vl(r.state,r.focused?"var(--poney-story-line)":"var(--poney-story-rule)");return d.jsxs("g",{transform:`translate(${t.x} ${t.y})`,...s,children:[d.jsx("rect",{width:t.w,height:t.h,rx:t.h/2,fill:Gv(r.state),stroke:o,strokeWidth:r.state||r.hot?1.8:1.25}),t.kind==="final"&&d.jsx("rect",{x:4,y:4,width:t.w-8,height:t.h-8,rx:(t.h-8)/2,fill:"none",stroke:o,strokeWidth:1}),i&&d.jsx("circle",{cx:20,cy:t.h/2,r:4,fill:i}),d.jsx("text",{x:t.w/2,y:t.entryActions.length?t.h/2-2:t.h/2+5,textAnchor:"middle",fontSize:14.5,fontWeight:600,fill:"var(--poney-ink)",children:t.name}),t.entryActions.length>0&&d.jsxs("text",{x:t.w/2,y:t.h/2+15,textAnchor:"middle",fontSize:11.5,fill:"var(--poney-ink-3)",children:[t.entryActions[0],t.entryActions.length>1?`, +${t.entryActions.length-1}`:""]}),d.jsx(Cd,{state:r.state,x:t.w-14,y:0,anchor:"end"}),r.callout&&d.jsx(kl,{n:r.callout,x:0,y:0,hot:r.hot})]})}function jz({t,machine:e}){const n=`transition:${e}:${t.id}`,r=Ps(n),s=f$(n,{kind:"transition",behavior:e,id:t.id},`Transition: ${t.event}`,Mr(r)),i=r.hot?"var(--poney-accent)":vl(r.state,r.focused?"var(--poney-story-line)":"var(--poney-story-rule)"),o=yo(BC(t.points,7),18),a=t.points[t.points.length-1];return d.jsxs("g",{...s,children:[d.jsx("path",{d:yo(t.points,18),fill:"none",stroke:"transparent",strokeWidth:16}),d.jsx("path",{d:o,fill:"none",stroke:i,strokeWidth:r.state||r.hot?2:1.4,strokeDasharray:r.state==="removed"?"6 5":void 0,strokeLinecap:"round"}),d.jsx(Lf,{x:a.x,y:a.y,angle:VC(t.points),color:i,size:6})]})}function Cz({t,machine:e}){const n=`transition:${e}:${t.id}`,r=Ps(n);if(!t.label)return null;const{x:s,y:i,w:o,h:a}=t.label,l=r.hot?"var(--poney-accent)":r.state?`var(--poney-${r.state})`:"var(--poney-ink)";return d.jsxs("g",{transform:`translate(${s} ${i})`,pointerEvents:"none",className:Mr(r),children:[d.jsx("rect",{width:o,height:a,rx:8,fill:r.state?`var(--poney-${r.state}-wash)`:"var(--poney-paper-raised)",stroke:r.state?`var(--poney-${r.state})`:"var(--poney-story-rule)"}),d.jsx("text",{x:o/2,y:15,textAnchor:"middle",fontSize:11.5,fontWeight:600,fill:l,textDecoration:r.state==="removed"?"line-through":void 0,children:t.event}),t.guard&&d.jsxs("text",{x:o/2,y:28,textAnchor:"middle",fontSize:10.5,fill:"var(--poney-ink-3)",children:["[",t.guard,"]"]}),r.callout&&d.jsx(kl,{n:r.callout,x:-4,y:a/2,hot:r.hot})]})}function h$(t,e){const n=new Map;if(e.type==="map")for(const r of t.edges){const s=r.curve,i={d:`M ${s[0].x} ${s[0].y} C ${s[1].x} ${s[1].y} ${s[2].x} ${s[2].y} ${s[3].x} ${s[3].y}`,at:o=>{const a=hc(s,o),l=hc(s,Math.min(1,o+.01)),c=hc(s,Math.max(0,o-.01));return{...a,angle:Math.atan2(l.y-c.y,l.x-c.x)}},stepAt:.18,badge:{x:r.label.x+r.label.w/2,y:r.label.y+r.label.h+13},sign:{x:r.label.x+r.label.w+13,y:r.label.y+r.label.h/2}};for(const o of r.relationships)n.set(`relationship:${o}`,i)}if(e.type==="sequence"){const r=t;for(const s of r.messages){const i=s.loop?[{x:s.loop.x,y:s.loop.y1},{x:s.loop.x+s.loop.w,y:s.loop.y1},{x:s.loop.x+s.loop.w,y:s.loop.y2},{x:s.loop.x+8,y:s.loop.y2}]:[{x:s.x1,y:s.y},{x:s.x2,y:s.y}],o=yw(i,0),a=Math.abs(s.x2-s.x1)||60,l=o.at(.5);n.set(`message:${r.interactionId}:${s.id}`,{...o,stepAt:Math.min(.4,22/a),badge:s.loop?{x:s.loop.x+s.loop.w+40,y:s.loop.y2+14}:{x:l.x,y:l.y+15},sign:s.loop?o.at(.5):{x:o.at(.9).x,y:s.y+15}})}}if(e.type==="state"){const r=t;for(const s of r.transitions){const i=yw(s.points,18),o=i.at(.5);n.set(`transition:${r.machineId}:${s.id}`,{...i,stepAt:.22,badge:s.label?{x:s.label.x+s.label.w/2,y:s.label.y+s.label.h+13}:{x:o.x,y:o.y+15},sign:s.label?{x:s.label.x+s.label.w+13,y:s.label.y+s.label.h/2}:i.at(.3)})}}return n}function yw(t,e){const n=t.slice(1).map((s,i)=>Math.hypot(s.x-t[i].x,s.y-t[i].y)),r=n.reduce((s,i)=>s+i,0)||1;return{d:e?yo(t,e):`M ${t.map(s=>`${s.x} ${s.y}`).join(" L ")}`,at(s){let i=Math.max(0,Math.min(1,s))*r;for(let o=0;o<n.length;o++){const a=t[o],l=t[o+1];if(i<=n[o]||o===n.length-1){const c=n[o]?Math.min(1,i/n[o]):0;return{x:a.x+(l.x-a.x)*c,y:a.y+(l.y-a.y)*c,angle:Math.atan2(l.y-a.y,l.x-a.x)}}i-=n[o]}return{...t[0],angle:0}}}}const _z={flow:"var(--poney-lapis)",attention:"var(--poney-accent)","hot-path":"var(--poney-accent)",slow:"var(--poney-ochre)",failing:"var(--poney-failure)",blocked:"var(--poney-failure)"},p$=(t,e)=>e?dt(e):_z[t],Nz=t=>/^(entity|state|dataType|activityNode|capability):/.test(t);function Ez({scene:t,view:e}){var i;const n=dr();if(!((i=n.effects)!=null&&i.size))return null;const r=h$(t,e),s=[];return n.effects.forEach((o,a)=>{const l=r.get(a);if(l)for(const c of o){if(c.as==="flow")continue;const u=c.as==="hot-path";s.push(d.jsx("path",{d:l.d,fill:"none",stroke:p$(c.as,c.tone),strokeOpacity:u?.3:.2,strokeWidth:u?9:11,strokeLinecap:"round",strokeDasharray:c.as==="slow"?"1 14":void 0,className:c.as==="attention"?"poney-pulse":void 0},`${a}-${c.as}`))}}),d.jsx("g",{pointerEvents:"none",children:s})}function m$({scene:t,view:e}){var a,l;const n=dr(),r=h$(t,e),s=c=>{const u=Nz(c)?t.anchors[c]:void 0;return u!=null&&u.entityId&&c.startsWith("entity:")&&u.entityId!==c.slice(7)?void 0:u},i=[];(a=n.effects)==null||a.forEach((c,u)=>{const f=r.get(u),h=s(u);c.forEach((m,g)=>{const p=p$(m.as,m.tone),x=`${u}-${m.as}-${g}`;f?(m.as==="flow"&&i.push(d.jsx("path",{d:f.d,fill:"none",stroke:p,strokeWidth:3,strokeLinecap:"round",strokeDasharray:"0.1 11",className:"poney-flow"},x)),(m.as==="slow"||m.as==="failing"||m.as==="blocked")&&i.push(d.jsx(xw,{as:m.as,x:f.sign.x,y:f.sign.y,color:p},x))):h&&(i.push(d.jsx("rect",{x:h.x-6,y:h.y-6,width:h.w+6*2,height:h.h+6*2,rx:Math.min(20,(h.h+6*2)/2),fill:"none",stroke:p,strokeWidth:m.as==="hot-path"?2.5:2,strokeDasharray:m.as==="blocked"?"6 4":m.as==="slow"?"2 4":void 0,strokeLinecap:"round",className:m.as==="attention"?"poney-pulse":void 0},x)),(m.as==="slow"||m.as==="failing"||m.as==="blocked")&&i.push(d.jsx(xw,{as:m.as,x:h.x+h.w+2,y:h.y+h.h+2,color:p},`${x}-s`)))})}),(l=n.badges)==null||l.forEach((c,u)=>{const f=r.get(u),h=s(u);let m=0,g=0;if(f)m=f.badge.x,g=f.badge.y;else if(h)m=h.x+h.w/2,g=h.y+h.h;else return;const p=c.map(y=>Te(y.text,11,600)+16);let x=m-(p.reduce((y,v)=>y+v,0)+(c.length-1)*4)/2;c.forEach((y,v)=>{const k=y.tone?dt(y.tone):"var(--poney-ink-2)";i.push(d.jsxs("g",{transform:`translate(${x} ${g-10})`,children:[d.jsx("rect",{width:p[v],height:20,rx:10,fill:"var(--poney-paper-raised)",stroke:k,strokeWidth:1.1}),d.jsx("text",{x:p[v]/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:600,fill:k,className:"poney-numbers",children:y.text})]},`b-${u}-${v}`)),x+=p[v]+4})});const o=n.trace;if(o!=null&&o.steps.length){if(o.current===null&&o.numbered)o.steps.forEach((c,u)=>{const f=r.get(c),h=s(c),m=f?f.at(f.stepAt):h?{x:h.x+14,y:h.y+h.h-2}:void 0;m&&i.push(d.jsx($z,{n:u+1,x:m.x,y:m.y},`t-${u}`))});else if(o.current!==null){const c=o.steps[o.current],u=r.get(c),f=s(c);u?i.push(d.jsxs("g",{children:[d.jsx("circle",{r:7,fill:"var(--poney-accent)",stroke:"var(--poney-paper-raised)",strokeWidth:2.5,children:o.animate?d.jsx("animateMotion",{dur:"0.9s",fill:"freeze",path:u.d,keyPoints:"0;1",keyTimes:"0;1",calcMode:"spline",keySplines:"0.4 0 0.2 1"}):null}),!o.animate&&d.jsx("circle",{cx:u.at(1).x,cy:u.at(1).y,r:7,fill:"var(--poney-accent)",stroke:"var(--poney-paper-raised)",strokeWidth:2.5})]},`token-${o.current}`)):f&&i.push(d.jsx("rect",{x:f.x-7,y:f.y-7,width:f.w+14,height:f.h+14,rx:20,fill:"none",stroke:"var(--poney-accent)",strokeWidth:2.5,className:o.animate?"poney-pulse":void 0},`token-${o.current}`))}}return i.length?d.jsx("g",{pointerEvents:"none",children:i}):null}function xw({as:t,x:e,y:n,color:r}){return d.jsxs("g",{children:[d.jsx("circle",{cx:e,cy:n,r:10,fill:"var(--poney-paper-raised)",stroke:r,strokeWidth:1.6}),t==="slow"&&d.jsx(lr,{name:"timer",x:e-6.5,y:n-6.5,size:13,color:r}),t==="failing"&&d.jsx("path",{d:`M ${e-3.6} ${n-3.6} L ${e+3.6} ${n+3.6} M ${e+3.6} ${n-3.6} L ${e-3.6} ${n+3.6}`,stroke:r,strokeWidth:2,strokeLinecap:"round"}),t==="blocked"&&d.jsx("path",{d:`M ${e-4.5} ${n} L ${e+4.5} ${n}`,stroke:r,strokeWidth:2.4,strokeLinecap:"round"})]})}const c1=t=>t<26?String.fromCharCode(65+t):`${String.fromCharCode(65+Math.floor(t/26)-1)}${String.fromCharCode(65+t%26)}`;function $z({n:t,x:e,y:n}){return d.jsxs("g",{children:[d.jsx("rect",{x:e-8.5,y:n-8.5,width:17,height:17,rx:5,fill:"var(--poney-accent)",stroke:"var(--poney-paper-raised)",strokeWidth:1.75}),d.jsx("text",{x:e,y:n+3.8,textAnchor:"middle",fontSize:10.5,fontWeight:700,fill:"var(--poney-paper-raised)",className:"poney-numbers",children:c1(t-1)})]})}function Mz({view:t,scene:e,extra:n}){const r=t.type==="map"?d.jsx(d$,{scene:e,extra:n}):t.type==="sequence"?d.jsx(mz,{scene:e}):t.type==="state"?d.jsx(bz,{scene:e}):null;return r?d.jsxs("g",{children:[d.jsx(Ez,{scene:e,view:t}),r,d.jsx(m$,{scene:e,view:t})]}):null}const g$=t=>t.type==="extension"?t.extension:t.type;function Wa({at:t,angle:e,kind:n,color:r,size:s=8}){if(n==="none")return null;const i=n==="triangle"?s*.75:s*.55,o=n==="triangle"?s*1.25:s,a=Math.cos(e),l=Math.sin(e),c=(u,f)=>`${t.x+u*a-f*l},${t.y+u*l+f*a}`;return n==="open-arrow"?d.jsx("polyline",{points:`${c(-o,-i)} ${c(0,0)} ${c(-o,i)}`,fill:"none",stroke:r,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}):n==="triangle"?d.jsx("polygon",{points:`${c(0,0)} ${c(-o,-i)} ${c(-o,i)}`,fill:"var(--poney-paper-raised)",stroke:r,strokeWidth:1.3,strokeLinejoin:"round"}):d.jsx("polygon",{points:`${c(0,0)} ${c(-o,-i)} ${c(-o*.72,0)} ${c(-o,i)}`,fill:r})}function vp({points:t,style:e,radius:n=8}){const r=e.head==="none"?0:e.head==="triangle"?10:6,s=BC(t,r),i=yo(s,n);return d.jsxs("g",{opacity:e.opacity??1,children:[d.jsx("path",{d:yo(t,n),fill:"none",stroke:"transparent",strokeWidth:14}),d.jsx("path",{d:i,className:`poney-edge ${e.flowing?"poney-flowing":""}`,fill:"none",stroke:e.color,strokeWidth:e.width,strokeDasharray:e.flowing?void 0:e.dash,strokeLinecap:"round",strokeLinejoin:"round"}),d.jsx(Wa,{at:t[t.length-1],angle:VC(t),kind:e.head,color:e.color}),e.tail&&e.tail!=="none"&&d.jsx(Wa,{at:t[0],angle:uR(t),kind:e.tail,color:e.color})]})}function Tz({at:t,text:e,secondary:n,tone:r="var(--poney-ink-2)",strong:s,size:i=11.5}){const o=Te(e,i,s?600:500),a=n?Te(n,i-1,400):0,l=Math.max(o,a)+i*1.2,c=n?i*3:i*1.75;return d.jsxs("g",{transform:`translate(${t.x-l/2} ${t.y-c/2})`,pointerEvents:"none",children:[d.jsx("rect",{width:l,height:c,rx:i/2,fill:"var(--poney-paper-raised)",stroke:s?r:"var(--poney-rule)",strokeWidth:s?1.2:1}),d.jsx("text",{x:l/2,y:i*1.22,textAnchor:"middle",fontSize:i,fontWeight:s?600:500,fill:s?r:"var(--poney-ink-2)",children:e}),n&&d.jsx("text",{x:l/2,y:i*2.4,textAnchor:"middle",fontSize:i-1,fill:"var(--poney-ink-3)",children:n})]})}function pc(t,e=11.5,n=30){const r=Qv(),s=e/r;return s<=t?t:Math.min(n,Math.ceil(s/2)*2)}function xn({w:t,h:e,rx:n=12,selected:r}){return d.jsxs(d.Fragment,{children:[r&&d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:-5,y:-5,width:t+10,height:e+10,rx:n+5,fill:"none",stroke:"var(--poney-accent-ring)",strokeWidth:6}),d.jsx("rect",{x:-2.5,y:-2.5,width:t+5,height:e+5,rx:n+2.5,fill:"none",stroke:"var(--poney-accent)",strokeWidth:1.75})]}),d.jsx("rect",{className:"poney-focus",x:-5,y:-5,width:t+10,height:e+10,rx:n+5,fill:"none",stroke:"var(--poney-accent)",strokeWidth:2,strokeDasharray:"4 3"})]})}function kp({entity:t,style:e,w:n,h:r,emphasis:s,detail:i,footer:o}){const a=dt(e.tone),l=t.kind==="external",c=s==="selected",u=b.useMemo(()=>t.summary?Cf(t.summary,e.shape==="person"?n-12:n-30,e.shape==="person"?11.5:12,400,2):[],[t.summary,n,e.shape]),f=t.technology??e.label,h=pc(14,10.5),m=h>14&&e.shape!=="person",g=b.useMemo(()=>m?Cf(t.name,n-28,h,650,2):[],[m,t.name,n,h]),p=e.emphasis?`color-mix(in srgb, ${a} 55%, var(--poney-rule-strong))`:"var(--poney-rule-strong)";if(e.shape==="person"){const w=n/2;return d.jsxs("g",{children:[d.jsx("rect",{width:n,height:r,rx:14,fill:"transparent"}),d.jsx("circle",{cx:w,cy:22,r:15,fill:mn(e.tone,16),stroke:a,strokeWidth:1.4}),d.jsx("path",{d:`M ${w-27} 64 Q ${w-27} 42 ${w} 42 Q ${w+27} 42 ${w+27} 64 Z`,fill:mn(e.tone,16),stroke:a,strokeWidth:1.4,strokeLinejoin:"round"}),d.jsx("text",{x:w,y:70+Math.min(h,20),textAnchor:"middle",fontSize:Math.min(h,20),fontWeight:650,fill:"var(--poney-ink)",children:Nt(t.name,n+40,Math.min(h,20),650)}),i&&!m&&h===14&&u.map((j,C)=>d.jsx("text",{x:w,y:101+C*14,textAnchor:"middle",fontSize:11.5,fill:"var(--poney-ink-3)",children:j},C)),d.jsx(xn,{w:n,h:r,rx:14,selected:c})]})}const x=(w=0)=>g.map((j,C)=>d.jsx("text",{x:n/2,y:w+r/2+h*.36+(C-(g.length-1)/2)*h*1.1,textAnchor:"middle",fontSize:h,fontWeight:650,fill:"var(--poney-ink)",children:j},C));if(e.shape==="chip"){const w=t.kind==="interface";return d.jsxs("g",{children:[d.jsx("rect",{className:"poney-body",width:n,height:r,rx:10,fill:t.kind==="library"?"var(--poney-paper)":"var(--poney-paper-raised)",stroke:w?a:p,strokeDasharray:w?"5 3":void 0,strokeWidth:1.1}),m?x():d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:11,y:(r-30)/2,width:30,height:30,rx:8,fill:mn(e.tone,13)}),d.jsx(lr,{name:e.icon,x:18,y:(r-30)/2+7,size:16,color:a}),d.jsx("text",{x:52,y:r/2-3,fontSize:13.5,fontWeight:600,fill:"var(--poney-ink)",fontFamily:t.kind==="interface"?"var(--poney-font-mono)":void 0,children:Nt(t.name,n-62,13.5,600,t.kind==="interface"?"mono":"sans")}),d.jsx("text",{x:52,y:r/2+13,fontSize:11.5,fill:"var(--poney-ink-3)",children:Nt(f,n-62,11.5)})]}),d.jsx(xn,{w:n,h:r,rx:10,selected:c})]})}const y=e.shape==="cylinder"?12:0,v=e.shape==="cylinder"?d.jsxs(d.Fragment,{children:[d.jsx("path",{className:"poney-body",d:`M 0 10 A ${n/2} 10 0 0 1 ${n} 10 V ${r-10} A ${n/2} 10 0 0 1 0 ${r-10} Z`,fill:"var(--poney-paper-raised)",stroke:p,strokeWidth:1.1}),d.jsx("ellipse",{cx:n/2,cy:10,rx:n/2,ry:10,fill:mn(e.tone,9),stroke:p,strokeWidth:1.1})]}):d.jsxs(d.Fragment,{children:[e.shape==="stack"&&d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:8,y:-8,width:n,height:r,rx:12,fill:"var(--poney-paper)",stroke:"var(--poney-rule-strong)",strokeWidth:1}),d.jsx("rect",{x:4,y:-4,width:n,height:r,rx:12,fill:"var(--poney-paper)",stroke:"var(--poney-rule-strong)",strokeWidth:1})]}),d.jsx("rect",{className:"poney-body",width:n,height:r,rx:e.shape==="frame"?16:12,fill:e.shape==="frame"?mn(e.tone,6):"var(--poney-paper-raised)",stroke:l?a:p,strokeDasharray:l?"6 4":void 0,strokeWidth:e.shape==="frame"?1.5:1.1})]}),k=e.shape==="frame";return d.jsxs("g",{children:[v,m&&x(y/2),d.jsxs("g",{transform:`translate(0 ${y})`,display:m?"none":void 0,children:[d.jsx("rect",{x:14,y:14,width:k?38:32,height:k?38:32,rx:9,fill:mn(e.tone,14)}),d.jsx(lr,{name:e.icon,x:k?23:21.5,y:k?23:21.5,size:k?20:17,color:a}),d.jsx("text",{x:k?64:56,y:k?31:29,fontSize:k?16:14,fontWeight:650,fill:"var(--poney-ink)",children:Nt(t.name,n-(k?76:68),k?16:14,650)}),d.jsx("text",{x:k?64:56,y:k?48:45.5,fontSize:11.5,fill:"var(--poney-ink-3)",children:Nt(f,n-(k?76:68),11.5)}),i&&u.map((w,j)=>d.jsx("text",{x:14,y:(k?76:70)+j*15,fontSize:12,fill:"var(--poney-ink-2)",children:w},j)),o&&d.jsx("text",{x:14,y:r-y-16,fontSize:12,fontWeight:600,fill:a,children:o})]}),d.jsx(xn,{w:n,h:r,rx:k?16:12,selected:c})]})}function Kt({shape:t,tone:e,label:n,dashed:r}){const s=dt(e),i=mn(e,14);return d.jsxs("div",{className:"poney-legend-row",children:[d.jsxs("svg",{width:"22",height:"16","aria-hidden":!0,className:"poney-legend-mark",children:[t==="person"&&d.jsxs(d.Fragment,{children:[d.jsx("circle",{cx:"11",cy:"5",r:"3.6",fill:i,stroke:s,strokeWidth:"1.2"}),d.jsx("path",{d:"M4.5 15 Q4.5 9.5 11 9.5 Q17.5 9.5 17.5 15 Z",fill:i,stroke:s,strokeWidth:"1.2"})]}),t==="cylinder"&&d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M2 4 A9 2.6 0 0 1 20 4 V12 A9 2.6 0 0 1 2 12 Z",fill:i,stroke:s,strokeWidth:"1.2"}),d.jsx("ellipse",{cx:"11",cy:"4",rx:"9",ry:"2.6",fill:i,stroke:s,strokeWidth:"1.2"})]}),t==="stack"&&d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:"5",y:"1",width:"15",height:"10",rx:"2.5",fill:"none",stroke:s,strokeWidth:"1",opacity:"0.6"}),d.jsx("rect",{x:"2",y:"4",width:"15",height:"10",rx:"2.5",fill:i,stroke:s,strokeWidth:"1.2"})]}),(t==="card"||t==="frame"||t==="chip")&&d.jsx("rect",{x:"2",y:"2",width:"18",height:"12",rx:"3",fill:i,stroke:s,strokeWidth:"1.2",strokeDasharray:r?"3 2":void 0}),t==="pill"&&d.jsx("rect",{x:"1",y:"3",width:"20",height:"10",rx:"5",fill:i,stroke:s,strokeWidth:"1.2"}),t==="diamond"&&d.jsx("path",{d:"M11 1 L20 8 L11 15 L2 8 Z",fill:i,stroke:s,strokeWidth:"1.2"}),t==="dot"&&d.jsx("circle",{cx:"11",cy:"8",r:"5",fill:s}),t==="bullseye"&&d.jsxs(d.Fragment,{children:[d.jsx("circle",{cx:"11",cy:"8",r:"6",fill:"none",stroke:s,strokeWidth:"1.2"}),d.jsx("circle",{cx:"11",cy:"8",r:"3.4",fill:s})]}),t==="store"&&d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M2 3 H20 M2 13 H20",stroke:s,strokeWidth:"1.2"}),d.jsx("rect",{x:"2",y:"3",width:"18",height:"10",fill:i})]}),t==="bar"&&d.jsx("rect",{x:"2",y:"6",width:"18",height:"4",rx:"2",fill:s})]}),d.jsx("span",{children:n})]})}function Vn({line:t,label:e,color:n="var(--poney-ink-3)",head:r=!0}){return d.jsxs("div",{className:"poney-legend-row",children:[d.jsxs("svg",{width:"22",height:"16","aria-hidden":!0,className:"poney-legend-mark",children:[d.jsx("line",{x1:"1",y1:"8",x2:r?15:21,y2:"8",stroke:n,strokeWidth:"1.4",strokeDasharray:t==="dashed"?"4 3":t==="dotted"?"1.4 3":void 0}),r&&d.jsx("path",{d:"M14 4.5 L21 8 L14 11.5 Z",fill:n})]}),d.jsx("span",{children:e})]})}function Oz(t){const[e,n]=mp(t.id),r=e.collapsed??t.collapsed;return{collapsed:r,toggle:i=>n({collapsed:r.includes(i)?r.filter(o=>o!==i):[...r,i]})}}function lu({x:t,y:e,open:n,label:r,onToggle:s}){return VP()?null:d.jsxs("g",{transform:`translate(${t} ${e})`,role:"button",tabIndex:0,"aria-label":`${n?"Close":"Open"} ${r}`,"aria-expanded":n,className:"poney-control","data-ref":"toggle",onClick:i=>{i.stopPropagation(),s()},onDoubleClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),i.stopPropagation(),s())},children:[d.jsx("rect",{width:26,height:26,rx:7,fill:"var(--poney-paper-raised)",stroke:"var(--poney-rule-strong)"}),d.jsx("g",{transform:"translate(5 5)",color:"var(--poney-ink-2)",children:n?d.jsx(e1,{width:16,height:16,strokeWidth:1.8}):d.jsx(t1,{width:16,height:16,strokeWidth:1.8})}),d.jsx("rect",{className:"poney-focus",x:-3,y:-3,width:32,height:32,rx:9,fill:"none",stroke:"var(--poney-accent)",strokeWidth:2})]})}function Az({scene:t,view:e}){var v,k;const n=fn(),r=Sn(),s=Qv(),{subject:i,selection:o}=Ds(),{toggle:a}=Oz(e),l=n.doc.presentation.relationships,c=pc(12.5,11,26),u=pc(15,12,32),f=pc(11.5,10.5,26),h=b.useMemo(()=>{if(!i)return null;const w=new Set,j=new Set,C=new Map(t.nodes.map(N=>[N.id,N])),E=N=>t.nodes.filter(M=>Rz(M,N,C)).forEach(M=>w.add(M.id)),S=N=>{var M;return((M=t.nodes.find(P=>P.entityId===N))==null?void 0:M.id)??_(N)},_=N=>{var P;const M=t.anchors[`entity:${N}`];return M?(P=t.nodes.find(V=>V.x===M.x&&V.y===M.y&&V.w===M.w&&V.h===M.h))==null?void 0:P.id:void 0};if(i.kind==="entity"){const N=S(i.id);if(!N)return null;w.add(N),E(N);const M=new Set(w);for(const P of t.edges)(M.has(P.source)||M.has(P.target))&&(j.add(P.id),w.add(P.source),w.add(P.target))}else if(i.kind==="relationship"){const N=t.edges.find(M=>M.relationships.includes(i.id));if(!N)return null;j.add(N.id),w.add(N.source),w.add(N.target)}else if(i.kind==="group"&&i.view===e.id){const N=`g:${i.id}`;w.add(N),E(N);const M=new Set(w);for(const P of t.edges)(M.has(P.source)||M.has(P.target))&&j.add(P.id)}else return null;return{nodes:w,edges:j}},[i,t,e.id]),m=(o==null?void 0:o.kind)==="entity"?(v=t.nodes.find(w=>w.entityId===o.id))==null?void 0:v.id:(o==null?void 0:o.kind)==="group"?`g:${o.id}`:void 0,g=(o==null?void 0:o.kind)==="relationship"?(k=t.edges.find(w=>w.relationships.includes(o.id)))==null?void 0:k.id:void 0,p=w=>!!h&&!w.compound&&!h.nodes.has(w.id),x=t.nodes.filter(w=>w.compound),y=t.nodes.filter(w=>!w.compound);return d.jsxs("g",{children:[x.map(w=>{if(w.type==="group"){const E=e.groups.find(S=>S.id===w.groupId);return d.jsxs("g",{transform:`translate(${w.x} ${w.y})`,...r({kind:"group",view:e.id,id:E.id},`Group ${E.label}`),children:[d.jsx("rect",{width:w.w,height:w.h,rx:14,fill:"var(--poney-plaster)",fillOpacity:.55,stroke:"var(--poney-rule-strong)",strokeDasharray:"5 4"}),d.jsx("text",{x:16,y:12+c,fontSize:c,fontWeight:600,fill:"var(--poney-ink-2)",children:E.label}),d.jsx(lu,{x:w.w-36,y:7,open:!0,label:E.label,onToggle:()=>a(E.id)}),d.jsx(xn,{w:w.w,h:w.h,rx:14,selected:m===w.id})]},w.id)}const j=n.entities.get(w.entityId),C=n.style(j,e.id);return d.jsxs("g",{transform:`translate(${w.x} ${w.y})`,...r({kind:"entity",id:j.id},`${j.name}, ${C.label}, contains ${w.hiddenCount||"several"} parts`),children:[d.jsx("rect",{width:w.w,height:w.h,rx:18,fill:`color-mix(in srgb, ${dt(C.tone)} 4%, var(--poney-paper))`,stroke:"var(--poney-rule-strong)",strokeWidth:1.25}),d.jsx(lr,{name:C.icon,x:20,y:18,size:18,color:dt(C.tone)}),d.jsx("text",{x:46,y:u>15?16+u:32,fontSize:u,fontWeight:650,fill:"var(--poney-ink)",children:j.name}),u===15&&d.jsx("text",{x:20,y:48,fontSize:12,fill:"var(--poney-ink-3)",children:Nt(j.summary,w.w-80,12)}),d.jsx(lu,{x:w.w-40,y:12,open:!0,label:j.name,onToggle:()=>a(j.id)}),d.jsx(xn,{w:w.w,h:w.h,rx:18,selected:m===w.id})]},w.id)}),t.edges.map(w=>{const j=n.relationships.get(w.relationships[0]),C=l[j.kind]??{pattern:"solid",head:"arrow"},E=h==null?void 0:h.edges.has(w.id),S=g===w.id,_=E||S?"var(--poney-accent)":"var(--poney-ink-4)",N=w.relationships.length>1?`${w.relationships.length} connections`:j.label;return d.jsx("g",{...r({kind:"relationship",id:w.relationships[0]},`${n.describe({kind:"relationship",id:j.id}).title}: ${N}`),className:`poney-el ${h&&!E?"poney-dim":""}`,children:d.jsx(vp,{points:w.points,style:{color:_,width:E||S?1.9:1.3,dash:C.pattern==="dashed"?"6 4":C.pattern==="dotted"?"1.5 4":void 0,head:C.head,flowing:S&&(j.kind==="publishes"||j.kind==="subscribes")}})},w.id)}),y.map(w=>{if(w.type==="group"){const S=e.groups.find(_=>_.id===w.groupId);return d.jsxs("g",{transform:`translate(${w.x} ${w.y})`,...r({kind:"group",view:e.id,id:S.id},`Group ${S.label}, closed`),className:`poney-el ${p(w)?"poney-dim":""}`,children:[d.jsx("rect",{x:6,y:-6,width:w.w,height:w.h,rx:12,fill:"var(--poney-paper)",stroke:"var(--poney-rule-strong)"}),d.jsx("rect",{width:w.w,height:w.h,rx:12,fill:"var(--poney-paper-raised)",stroke:"var(--poney-rule-strong)",strokeDasharray:"5 4"}),d.jsx("text",{x:16,y:30,fontSize:14,fontWeight:650,fill:"var(--poney-ink)",children:S.label}),d.jsxs("text",{x:16,y:50,fontSize:12,fill:"var(--poney-ink-3)",children:[w.hiddenCount," parts inside"]}),S.description&&s>.55&&d.jsx("text",{x:16,y:74,fontSize:12,fill:"var(--poney-ink-2)",children:Nt(S.description,w.w-32,12)}),d.jsx(lu,{x:w.w-36,y:10,open:!1,label:S.label,onToggle:()=>a(S.id)}),d.jsx(xn,{w:w.w,h:w.h,selected:m===w.id})]},w.id)}const j=n.entities.get(w.entityId),C=n.style(j,e.id),E=w.collapsed?{...C,shape:"frame"}:C;return d.jsxs("g",{transform:`translate(${w.x} ${w.y})`,...r({kind:"entity",id:j.id},`${j.name}, ${C.label}. ${j.summary}`),className:`poney-el ${p(w)?"poney-dim":""}`,children:[d.jsx(kp,{entity:j,style:E,w:w.w,h:w.h,emphasis:m===w.id?"selected":"normal",detail:s>.55,footer:w.collapsed?`${w.hiddenCount} parts inside`:void 0}),w.collapsed&&d.jsx(lu,{x:w.w-40,y:12,open:!1,label:j.name,onToggle:()=>a(j.id)})]},w.id)}),t.edges.filter(w=>(h==null?void 0:h.edges.has(w.id))||g===w.id).map(w=>{const j=n.relationships.get(w.relationships[0]),C=w.relationships.length>1;return d.jsx(Tz,{at:fR(w.points),text:C?`${w.relationships.length} connections`:j.label,secondary:C?void 0:j.protocol,tone:"var(--poney-accent)",strong:g===w.id,size:f},`l-${w.id}`)})]})}function Rz(t,e,n){var s;let r=t.parent;for(;r;){if(r===e)return!0;r=(s=n.get(r))==null?void 0:s.parent}return!1}function Iz({view:t}){const e=fn(),n=[...new Set(t.entities.map(r=>{var s;return(s=e.entities.get(r))==null?void 0:s.kind}).filter(Boolean))];return d.jsxs("div",{className:"poney-legend",children:[n.map(r=>{const s=e.doc.presentation.kinds[r];return s?d.jsx(Kt,{shape:s.shape,tone:s.tone,label:s.label,dashed:r==="external"},r):null}),d.jsx(Vn,{line:"solid",label:"Request and response"}),d.jsx(Vn,{line:"dashed",label:"Event, sent and forgotten"})]})}const Pz={key:"architecture",label:"Architecture",icon:AD,howToRead:"Boxes are the running parts of the system; lines show who calls whom. Select a part to see what it talks to. Open or close a group with its corner button.",Renderer:Az,Legend:Iz};function Dz({scene:t}){const e=fn(),n=Sn(),{subject:r,selection:s}=Ds(),i=t.interactionId,o=e.messages(i),a=b.useMemo(()=>{if(!r)return null;const f=new Set,h=new Set,m=g=>{var x;const p=(x=o.find(y=>y.message.id===g))==null?void 0:x.message;p&&(f.add(g),h.add(p.from),h.add(p.to))};if(r.kind==="entity"){if(!t.participants.some(g=>g.entityId===r.id))return null;h.add(r.id),o.forEach(g=>(g.message.from===r.id||g.message.to===r.id)&&f.add(g.message.id))}else if(r.kind==="message"&&r.behavior===i)m(r.id);else if(r.kind==="fragment"&&r.behavior===i)o.forEach(g=>g.context.some(p=>p.fragment.id===r.id)&&m(g.message.id));else if(r.kind==="relationship")o.forEach(g=>g.message.relationship===r.id&&m(g.message.id));else if(r.kind==="dataType")o.forEach(g=>g.message.data.includes(r.id)&&m(g.message.id));else return null;return f.size||h.size?{msgs:f,people:h}:null},[r,o,t.participants,i]),l=(s==null?void 0:s.kind)==="message"&&s.behavior===i?s.id:void 0,c=(s==null?void 0:s.kind)==="fragment"&&s.behavior===i?s.id:void 0,u=(s==null?void 0:s.kind)==="entity"?s.id:void 0;return d.jsxs("g",{children:[t.fragments.map(f=>{const h=(a==null?void 0:a.msgs.size)&&o.some(m=>a.msgs.has(m.message.id)&&m.context.some(g=>g.fragment.id===f.id));return d.jsx("rect",{x:f.x,y:f.y,width:f.w,height:f.h,rx:10,fill:"var(--poney-paper)",fillOpacity:.5,stroke:c===f.id?"var(--poney-accent)":h?"var(--poney-ink-4)":"var(--poney-rule-strong)",strokeWidth:c===f.id?1.6:1},`bg-${f.id}`)}),t.participants.map(f=>{const h=a==null?void 0:a.people.has(f.entityId);return d.jsx("line",{x1:f.x,x2:f.x,y1:f.lifeline.y1,y2:f.lifeline.y2,stroke:h&&(r==null?void 0:r.kind)==="entity"?"var(--poney-accent)":"var(--poney-ink-4)",strokeOpacity:h?.8:1,strokeWidth:h&&(r==null?void 0:r.kind)==="entity"?1.6:1,strokeDasharray:"4 5",className:a&&!h?"poney-dim":""},`l-${f.entityId}`)}),t.activations.map((f,h)=>{const m=e.style(f.entityId);return d.jsx("rect",{x:f.x,y:f.y1,width:10,height:f.y2-f.y1,rx:2,fill:mn(m.tone,18),stroke:dt(m.tone),strokeWidth:1,className:a&&!a.people.has(f.entityId)?"poney-dim":""},h)}),t.messages.map(f=>{var E,S;const h=a==null?void 0:a.msgs.has(f.id),m=l===f.id,g=m||h&&(r==null?void 0:r.kind)!=="entity"?"var(--poney-accent)":h?"var(--poney-ink)":"var(--poney-ink-2)",p=f.kind==="return"?"5 4":void 0,x=f.kind==="call"?"arrow":"open-arrow",y=Te(f.label,12.5,500),v=(_,N)=>d.jsxs("g",{children:[d.jsx("circle",{cx:_,cy:N,r:9,fill:m?"var(--poney-accent)":"var(--poney-paper-raised)",stroke:m?"var(--poney-accent)":"var(--poney-rule-strong)"}),d.jsx("text",{x:_,y:N+3.5,textAnchor:"middle",fontSize:10,fontWeight:650,fill:m?"var(--poney-paper)":"var(--poney-ink-2)",className:"poney-numbers",children:f.number})]}),k=`Step ${f.number}: ${(E=e.entities.get(f.from))==null?void 0:E.name} to ${(S=e.entities.get(f.to))==null?void 0:S.name}, ${f.label}`;if(f.loop){const{x:_,y1:N,y2:M,w:P}=f.loop;return d.jsxs("g",{...n({kind:"message",behavior:i,id:f.id},k),className:`poney-el ${a&&!h?"poney-dim":""}`,children:[d.jsx("rect",{x:_-4,y:N-16,width:P+y+60,height:M-N+24,fill:"transparent"}),d.jsx("path",{d:`M ${_} ${N} H ${_+P} V ${M} H ${_+6}`,fill:"none",stroke:g,strokeWidth:m?1.8:1.3,strokeLinejoin:"round"}),d.jsx(Wa,{at:{x:_+2,y:M},angle:Math.PI,kind:"arrow",color:g}),v(_+P+18,(N+M)/2),d.jsx("text",{x:_+P+32,y:(N+M)/2+4.5,fontSize:12.5,fontWeight:m?650:500,fill:m?"var(--poney-accent)":"var(--poney-ink)",children:f.label}),m&&d.jsx("rect",{x:_-6,y:N-14,width:P+y+64,height:M-N+22,rx:8,fill:"var(--poney-accent-wash)"})]},f.id)}const w=f.x2>f.x1,j=(f.x1+f.x2)/2,C=y+26;return d.jsxs("g",{...n({kind:"message",behavior:i,id:f.id},k),className:`poney-el ${a&&!h?"poney-dim":""}`,children:[d.jsx("rect",{x:Math.min(f.x1,f.x2),y:f.y-22,width:Math.abs(f.x2-f.x1),height:30,fill:m?"var(--poney-accent-wash)":"transparent",rx:6}),d.jsx("line",{x1:f.x1,x2:f.x2+(w?-6:6),y1:f.y,y2:f.y,stroke:g,strokeWidth:m?1.8:1.3,strokeDasharray:p}),d.jsx(Wa,{at:{x:f.x2,y:f.y},angle:w?0:Math.PI,kind:x,color:g}),v(j-C/2+9,f.y-12),d.jsx("text",{x:j-C/2+24,y:f.y-7.5,fontSize:12.5,fontWeight:m?650:500,fill:m?"var(--poney-accent)":f.kind==="return"?"var(--poney-ink-2)":"var(--poney-ink)",children:f.label})]},f.id)}),[...t.fragments].sort((f,h)=>f.depth-h.depth).map(f=>{var p;const h=jd(f.kind),m=Te(h,11.5,650)+20,g=(p=f.branches[0])==null?void 0:p.guard;return d.jsxs("g",{children:[d.jsxs("g",{...n({kind:"fragment",behavior:i,id:f.id},`${h}: ${f.branches.map(x=>x.guard).join(", or ")}`),children:[d.jsx("path",{d:`M ${f.x} ${f.y+24} V ${f.y+10} Q ${f.x} ${f.y} ${f.x+10} ${f.y} H ${f.x+m} V ${f.y+16} L ${f.x+m-8} ${f.y+24} Z`,fill:c===f.id?"var(--poney-accent)":"var(--poney-ink-2)"}),d.jsx("text",{x:f.x+10,y:f.y+16,fontSize:11.5,fontWeight:650,fill:"var(--poney-paper)",children:h}),d.jsx("rect",{x:f.x+m+4,y:f.y+3,width:Te(f.kind==="loop"||f.kind==="opt"?g:`If ${g}`,12,500)+12,height:18,rx:4,fill:"var(--poney-plaster)"}),d.jsx("text",{x:f.x+m+10,y:f.y+16,fontSize:12,fontWeight:500,fill:"var(--poney-ink-2)",children:f.kind==="loop"||f.kind==="opt"?g:`If ${g}`})]}),f.branches.slice(1).map((x,y)=>d.jsxs("g",{children:[d.jsx("line",{x1:f.x,x2:f.x+f.w,y1:x.y,y2:x.y,stroke:"var(--poney-rule-strong)",strokeDasharray:"5 4"}),d.jsx("rect",{x:f.x+6,y:x.y+4,width:Te(f.kind==="par"?`And ${x.guard}`:`Else, if ${x.guard}`,12,500)+12,height:18,rx:4,fill:"var(--poney-plaster)"}),d.jsx("text",{x:f.x+12,y:x.y+17,fontSize:12,fontWeight:500,fill:"var(--poney-ink-2)",children:f.kind==="par"?`And ${x.guard}`:`Else, if ${x.guard}`})]},y))]},f.id)}),t.participants.map(f=>{const h=e.entities.get(f.entityId),m=e.style(h),g=a==null?void 0:a.people.has(f.entityId),{x:p,y:x,w:y,h:v}=f.header;return d.jsxs("g",{transform:`translate(${p} ${x})`,...n({kind:"entity",id:h.id},`${h.name}, ${m.label}`),className:`poney-el ${a&&!g?"poney-dim":""}`,children:[d.jsx("rect",{className:"poney-body",width:y,height:v,rx:12,fill:"var(--poney-paper-raised)",stroke:g?dt(m.tone):"var(--poney-rule-strong)",strokeDasharray:h.kind==="external"?"6 4":void 0}),d.jsx("rect",{x:12,y:(v-32)/2,width:32,height:32,rx:9,fill:mn(m.tone,14)}),d.jsx(lr,{name:m.icon,x:19.5,y:(v-32)/2+7.5,size:17,color:dt(m.tone)}),d.jsx("text",{x:54,y:v/2-2,fontSize:14,fontWeight:650,fill:"var(--poney-ink)",children:Nt(h.name,y-64,14,650)}),d.jsx("text",{x:54,y:v/2+14,fontSize:11.5,fill:"var(--poney-ink-3)",children:Nt(h.technology??m.label,y-64,11.5)}),d.jsx(xn,{w:y,h:v,selected:u===h.id})]},f.entityId)})]})}function zz(){return d.jsxs("div",{className:"poney-legend",children:[d.jsx(Vn,{line:"solid",label:"Request: the sender waits",color:"var(--poney-ink-2)"}),d.jsx(Vn,{line:"dashed",label:"Answer to a request",color:"var(--poney-ink-2)"}),d.jsxs("div",{className:"poney-legend-row",children:[d.jsx("svg",{width:"22",height:"16","aria-hidden":!0,children:d.jsx("rect",{x:"7",y:"1",width:"8",height:"14",rx:"2",fill:"var(--poney-sunken)",stroke:"var(--poney-lapis)"})}),"Busy: handling a request"]}),d.jsxs("div",{className:"poney-legend-row",children:[d.jsxs("svg",{width:"22",height:"16","aria-hidden":!0,children:[d.jsx("rect",{x:"1",y:"2",width:"20",height:"12",rx:"3",fill:"none",stroke:"var(--poney-rule-strong)"}),d.jsx("rect",{x:"1",y:"2",width:"9",height:"5",rx:"1.5",fill:"var(--poney-ink-2)"})]}),"Condition, loop or parallel paths"]})]})}const Lz={key:"sequence",label:"Sequence",icon:ND,howToRead:"Time runs down the page. Each column is a participant; arrows are the messages between them, numbered in order. Boxes mark steps that happen only under a condition, repeat, or run in parallel.",Renderer:Dz,Legend:zz,initialView:"start"};function Fz({scene:t}){const e=fn(),n=Sn(),{subject:r,selection:s}=Ds(),i=b.useMemo(()=>{if(!r)return null;const l=new Set,c=new Set,u=f=>{c.add(f.id),l.add(f.source),l.add(f.target)};if(r.kind==="entity"){if(!t.nodes.some(f=>f.entityId===r.id))return null;l.add(r.id),t.edges.forEach(f=>(f.source===r.id||f.target===r.id)&&u(f))}else if(r.kind==="dataFlow"||r.kind==="relationship")t.edges.forEach(f=>{var h;return(f.id===r.id||((h=e.dataFlows.get(f.id))==null?void 0:h.via)===r.id)&&u(f)});else if(r.kind==="dataType")t.edges.forEach(f=>f.data.includes(r.id)&&u(f));else return null;return c.size||l.size?{nodes:l,edges:c}:null},[r,t,e]),o=(s==null?void 0:s.kind)==="dataFlow"||(s==null?void 0:s.kind)==="relationship"?s.id:void 0,a=(s==null?void 0:s.kind)==="entity"?s.id:void 0;return d.jsxs("g",{children:[t.edges.map(l=>{const c=i==null?void 0:i.edges.has(l.id),u=o===l.id,f=l.control?{kind:"relationship",id:l.id}:{kind:"dataFlow",id:l.id},h=u||c?"var(--poney-accent)":l.control?"var(--poney-ink-4)":"var(--poney-ink-2)";return d.jsx("g",{...n(f,e.describe(f).title),className:`poney-el ${i&&!c?"poney-dim":""}`,children:d.jsx(vp,{points:l.points,style:{color:h,width:l.control?1:u||c?2:1.6,dash:l.control?"1.5 4":void 0,head:l.control?"open-arrow":"arrow",flowing:!l.control&&(u||c)}})},l.id)}),t.nodes.map(l=>{const c=e.entities.get(l.entityId),u=e.style(c),f=dt(u.tone),h=i&&!i.nodes.has(l.entityId),{w:m,h:g}=l;return d.jsxs("g",{transform:`translate(${l.x} ${l.y})`,...n({kind:"entity",id:c.id},`${c.name}, ${l.role}`),className:`poney-el ${h?"poney-dim":""}`,children:[l.role==="process"&&d.jsx("rect",{className:"poney-body",width:m,height:g,rx:g/2,fill:"var(--poney-paper-raised)",stroke:f,strokeWidth:1.3}),l.role==="terminator"&&d.jsx("rect",{className:"poney-body",width:m,height:g,rx:4,fill:mn(u.tone,10),stroke:f,strokeWidth:1.3}),l.role==="store"&&d.jsxs(d.Fragment,{children:[d.jsx("rect",{width:m,height:g,fill:mn(u.tone,10)}),d.jsx("line",{x1:0,x2:m,y1:.5,y2:.5,stroke:f,strokeWidth:1.5}),d.jsx("line",{x1:0,x2:m,y1:g-.5,y2:g-.5,stroke:f,strokeWidth:1.5}),d.jsx("line",{x1:34,x2:34,y1:0,y2:g,stroke:f,strokeWidth:1})]}),d.jsx(lr,{name:u.icon,x:l.role==="store"?9:l.role==="process"?20:14,y:g/2-8,size:16,color:f}),d.jsx("text",{x:l.role==="store"?46:l.role==="process"?44:38,y:g/2+(l.role==="store"?4.5:-1),fontSize:13.5,fontWeight:650,fill:"var(--poney-ink)",children:Nt(c.name,m-60,13.5,650)}),l.role!=="store"&&d.jsx("text",{x:l.role==="process"?44:38,y:g/2+15,fontSize:11.5,fill:"var(--poney-ink-3)",children:l.role==="process"?"Process":u.label}),d.jsx(xn,{w:m,h:g,rx:l.role==="process"?g/2:4,selected:a===c.id})]},l.id)}),t.edges.map(l=>{if(!l.label)return null;const c=(i==null?void 0:i.edges.has(l.id))||o===l.id,{x:u,y:f,w:h,h:m}=l.label;return d.jsxs("g",{transform:`translate(${u} ${f})`,className:i&&!c?"poney-dim":"",pointerEvents:"none",children:[d.jsx("rect",{width:h,height:m,rx:m/2,fill:"var(--poney-paper-raised)",stroke:c?"var(--poney-accent)":"var(--poney-rule-strong)"}),d.jsx("circle",{cx:11,cy:m/2,r:3,fill:c?"var(--poney-accent)":"var(--poney-malachite)"}),d.jsx("text",{x:19,y:m/2+4,fontSize:11.5,fontWeight:c?650:500,fill:c?"var(--poney-accent)":"var(--poney-ink-2)",children:l.label.text})]},`l-${l.id}`)})]})}function Bz(){return d.jsxs("div",{className:"poney-legend",children:[d.jsx(Kt,{shape:"card",tone:"umber",label:"Outside the system: people and providers"}),d.jsx(Kt,{shape:"pill",tone:"lapis",label:"Process: code that changes data"}),d.jsx(Kt,{shape:"store",tone:"malachite",label:"Store: where data rests"}),d.jsx(Vn,{line:"solid",label:"Data moving, with what it carries",color:"var(--poney-ink-2)"}),d.jsx(Vn,{line:"dotted",label:"Control only: a call with no data shown",color:"var(--poney-ink-4)"})]})}const Vz={key:"dataflow",label:"Data flow",icon:s$,howToRead:"Arrows follow the data, not the calls: each one says what moves and in which direction. Select a flow to see its fields.",Renderer:Fz,Legend:Bz};function Wz({scene:t}){const e=fn(),n=Sn(),{subject:r,selection:s}=Ds(),i=t.processId,o=b.useMemo(()=>{if(!r)return null;const l=new Set,c=new Set;if(r.kind==="activityNode"&&r.behavior===i)l.add(r.id),t.edges.forEach(u=>{(u.from===r.id||u.to===r.id)&&(c.add(u.id),l.add(u.from),l.add(u.to))});else if(r.kind==="activityFlow"&&r.behavior===i){const u=t.edges.find(f=>f.id===r.id);if(!u)return null;c.add(u.id),l.add(u.from),l.add(u.to)}else if(r.kind==="entity"){const u=t.lanes.findIndex(f=>f.entityId===r.id);if(u<0)return null;t.nodes.forEach(f=>f.lane===u&&l.add(f.id)),t.edges.forEach(f=>l.has(f.from)&&l.has(f.to)&&c.add(f.id))}else return null;return{nodes:l,edges:c}},[r,t,i]),a=(l,c)=>(s==null?void 0:s.kind)===l&&s.behavior===i&&s.id===c;return d.jsxs("g",{children:[t.lanes.map((l,c)=>{const u=l.entityId?e.entities.get(l.entityId):void 0,f=u?e.style(u):void 0,h=(r==null?void 0:r.kind)==="entity"&&r.id===l.entityId;return d.jsxs("g",{children:[d.jsx("rect",{x:l.x,y:0,width:l.w,height:t.height,fill:c%2?"var(--poney-paper)":"transparent",fillOpacity:.45}),c>0&&d.jsx("line",{x1:l.x,x2:l.x,y1:0,y2:t.height,stroke:"var(--poney-rule)"}),d.jsxs("g",{...u?n({kind:"entity",id:u.id},`Lane: ${u.name}`):{},children:[d.jsx("rect",{x:l.x+8,y:8,width:l.w-16,height:t.laneHeader-16,rx:8,fill:h?"var(--poney-accent-wash)":"var(--poney-paper-raised)",stroke:h?"var(--poney-accent)":"var(--poney-rule)"}),f&&d.jsx(lr,{name:f.icon,x:l.x+l.w/2-Te(l.label,13,650)/2-12,y:t.laneHeader/2-7,size:14,color:dt(f.tone)}),d.jsx("text",{x:l.x+l.w/2+(f?9:0),y:t.laneHeader/2+4.5,textAnchor:"middle",fontSize:13,fontWeight:650,fill:"var(--poney-ink)",children:l.label})]})]},c)}),t.edges.map(l=>{const c=(o==null?void 0:o.edges.has(l.id))||a("activityFlow",l.id),u=c?"var(--poney-accent)":"var(--poney-ink-3)";return d.jsxs("g",{...n({kind:"activityFlow",behavior:i,id:l.id},e.describe({kind:"activityFlow",behavior:i,id:l.id}).title),className:`poney-el ${o&&!c?"poney-dim":""}`,children:[d.jsx(vp,{points:l.points,style:{color:u,width:c?1.9:1.3,head:"arrow",dash:l.back?"6 4":void 0}}),l.guard&&l.guardAt&&d.jsxs("g",{pointerEvents:"none",children:[d.jsx("rect",{x:l.guardAt.anchor==="end"?l.guardAt.x-Te(l.guard,11.5,650)-12:l.guardAt.x-2,y:l.guardAt.y-11,width:Te(l.guard,11.5,650)+14,height:19,rx:9.5,fill:"var(--poney-plaster)",stroke:c?"var(--poney-accent)":"var(--poney-rule-strong)"}),d.jsx("text",{x:l.guardAt.anchor==="end"?l.guardAt.x-5:l.guardAt.x+5,y:l.guardAt.y+2.5,textAnchor:l.guardAt.anchor==="end"?"end":"start",fontSize:11.5,fontWeight:650,fill:c?"var(--poney-accent)":"var(--poney-ink-2)",children:l.guard})]})]},l.id)}),t.nodes.map(l=>{const c=o&&!o.nodes.has(l.id),u=a("activityNode",l.id),f={kind:"activityNode",behavior:i,id:l.id},h=`${e.describe(f).kind}: ${l.label}`,{x:m,y:g,w:p,h:x}=l,y=l.outcome==="failure"?"var(--poney-failure)":l.outcome==="success"?"var(--poney-success)":"var(--poney-ink)";let v;switch(l.kind){case"start":v=d.jsx("circle",{cx:p/2,cy:x/2,r:p/2,fill:"var(--poney-ink)"});break;case"end":v=d.jsxs(d.Fragment,{children:[d.jsx("circle",{cx:p/2,cy:x/2,r:p/2,fill:"var(--poney-paper-raised)",stroke:y,strokeWidth:1.6}),d.jsx("circle",{cx:p/2,cy:x/2,r:p/2-5.5,fill:y}),d.jsx("text",{x:p/2,y:x+17,textAnchor:"middle",fontSize:12.5,fontWeight:650,fill:y,children:l.label})]});break;case"fork":case"join":v=d.jsx("rect",{width:p,height:x,rx:3,fill:"var(--poney-ink)"});break;case"decision":case"merge":v=d.jsxs(d.Fragment,{children:[d.jsx("path",{className:"poney-body",d:`M ${p/2} 0 L ${p} ${x/2} L ${p/2} ${x} L 0 ${x/2} Z`,fill:"var(--poney-paper-raised)",stroke:"var(--poney-ochre)",strokeWidth:1.4,strokeLinejoin:"round"}),d.jsx("text",{x:p/2,y:x/2+4.5,textAnchor:"middle",fontSize:12.5,fontWeight:650,fill:"var(--poney-ink)",children:l.label})]});break;default:v=d.jsxs(d.Fragment,{children:[d.jsx("rect",{className:"poney-body",width:p,height:x,rx:10,fill:"var(--poney-paper-raised)",stroke:"var(--poney-rule-strong)",strokeWidth:1.1}),l.lines.map((w,j)=>d.jsx("text",{x:p/2,y:x/2+4.5+(j-(l.lines.length-1)/2)*16,textAnchor:"middle",fontSize:13,fontWeight:500,fill:"var(--poney-ink)",children:w},j))]})}const k=l.kind==="fork"||l.kind==="join"?6:0;return d.jsxs("g",{transform:`translate(${m} ${g})`,...n(f,h),className:`poney-el ${c?"poney-dim":""}`,children:[k>0&&d.jsx("rect",{x:0,y:-k,width:p,height:x+k*2,fill:"transparent"}),v,d.jsx(xn,{w:p,h:x,rx:l.kind==="start"||l.kind==="end"?p/2:10,selected:u})]},l.id)})]})}function Uz(){return d.jsxs("div",{className:"poney-legend",children:[d.jsx(Kt,{shape:"dot",tone:"ink",label:"Start"}),d.jsx(Kt,{shape:"card",tone:"slate",label:"Action"}),d.jsx(Kt,{shape:"diamond",tone:"ochre",label:"Decision: one way out per answer"}),d.jsx(Kt,{shape:"bar",tone:"ink",label:"Split into, or join, parallel paths"}),d.jsx(Kt,{shape:"bullseye",tone:"success",label:"End, in success"}),d.jsx(Kt,{shape:"bullseye",tone:"failure",label:"End, in failure"})]})}const Zz={key:"activity",label:"Activity",icon:RN,howToRead:"Follow the arrows from the black dot. Each column is who does the step. Diamonds ask a question; dashed arrows go back to an earlier step.",Renderer:Wz,Legend:Uz};function Ay({p:t,d:e,card:n,color:r}){const s={x:-e.y,y:e.x},i=(c,u=0)=>({x:t.x-e.x*c+s.x*u,y:t.y-e.y*c+s.y*u}),o=c=>{const u=i(c,6),f=i(c,-6);return d.jsx("line",{x1:u.x,y1:u.y,x2:f.x,y2:f.y,stroke:r,strokeWidth:1.4})},a=c=>{const u=i(c);return d.jsx("circle",{cx:u.x,cy:u.y,r:4,fill:"var(--poney-paper-raised)",stroke:r,strokeWidth:1.3})},l=()=>{const c=i(13);return d.jsx(d.Fragment,{children:[-6.5,0,6.5].map(u=>{const f=i(0,u);return d.jsx("line",{x1:c.x,y1:c.y,x2:f.x,y2:f.y,stroke:r,strokeWidth:1.3},u)})})};return d.jsxs("g",{children:[n==="one"&&d.jsxs(d.Fragment,{children:[o(6),o(11)]}),n==="zero-or-one"&&d.jsxs(d.Fragment,{children:[o(6),a(15)]}),n==="many"&&d.jsxs(d.Fragment,{children:[l(),a(18)]}),n==="one-or-many"&&d.jsxs(d.Fragment,{children:[l(),o(17)]})]})}const vw=(t,e)=>{const n=Math.hypot(e.x-t.x,e.y-t.y)||1;return{x:(e.x-t.x)/n,y:(e.y-t.y)/n}};function Hz({scene:t,view:e}){const n=fn(),r=Sn(),{subject:s,selection:i}=Ds(),[o,a]=mp(e.id),l=o.expandedTables??[],c=b.useMemo(()=>{if(!s)return null;const f=new Set,h=new Set,m=new Set;if(s.kind==="dataType"){if(!t.tables.some(g=>g.dataTypeId===s.id))return null;f.add(s.id);for(const g of t.relations)if(!(g.from!==s.id&&g.to!==s.id)){if(s.field){const x=t.tables.find(v=>v.dataTypeId===s.id).rows.find(v=>v.name===s.field);if(!(g.via===s.field||(x==null?void 0:x.primaryKey)&&g.from===s.id))continue;m.add(`${g.from}#${g.from===s.id?s.field:g.via}`),m.add(`${g.to}#${g.to===s.id?s.field:g.via}`)}h.add(g.id),f.add(g.from),f.add(g.to)}s.field&&m.add(`${s.id}#${s.field}`)}else if(s.kind==="dataRelation"){const g=t.relations.find(p=>p.id===s.id);if(!g)return null;h.add(g.id),f.add(g.from),f.add(g.to),g.via&&(m.add(`${g.to}#${g.via}`),m.add(`${g.from}#${g.via}`))}else if(s.kind==="entity"){if(t.tables.forEach(g=>g.store===s.id&&f.add(g.dataTypeId)),!f.size)return null;t.relations.forEach(g=>f.has(g.from)&&f.has(g.to)&&h.add(g.id))}else return null;return{tables:f,rels:h,rows:m}},[s,t]),u=f=>a({expandedTables:l.includes(f)?l.filter(h=>h!==f):[...l,f]});return d.jsxs("g",{children:[t.stores.map(f=>{const h=n.entities.get(f.entityId),m=n.style(h),g=(i==null?void 0:i.kind)==="entity"&&i.id===h.id;return d.jsxs("g",{children:[d.jsx("rect",{x:f.x,y:f.y,width:f.w,height:f.h,rx:16,fill:mn(m.tone,5),stroke:"var(--poney-rule-strong)"}),d.jsxs("g",{transform:`translate(${f.x} ${f.y})`,...r({kind:"entity",id:h.id},`${h.name}, ${h.technology??"database"}`),children:[d.jsx("rect",{x:10,y:8,width:Math.min(f.w-20,320),height:26,rx:7,fill:"transparent"}),d.jsx(lr,{name:m.icon,x:18,y:13,size:15,color:dt(m.tone)}),d.jsx("text",{x:40,y:25,fontSize:12.5,fontWeight:650,fill:"var(--poney-ink)",children:h.name}),d.jsx("text",{x:50+Te(h.name,12.5,650),y:25,fontSize:11.5,fill:"var(--poney-ink-3)",children:h.technology}),g&&d.jsx("rect",{x:6,y:4,width:Math.min(f.w-12,330),height:34,rx:9,fill:"none",stroke:"var(--poney-accent)",strokeWidth:1.5})]})]},f.entityId)}),t.relations.map(f=>{const h=c==null?void 0:c.rels.has(f.id),m=(i==null?void 0:i.kind)==="dataRelation"&&i.id===f.id,g=h||m?"var(--poney-accent)":"var(--poney-ink-3)",p=f.points,x=p.length;return d.jsxs("g",{...r({kind:"dataRelation",id:f.id},n.describe({kind:"dataRelation",id:f.id}).title),className:`poney-el ${c&&!h?"poney-dim":""}`,children:[d.jsx("path",{d:yo(p,8),fill:"none",stroke:"transparent",strokeWidth:14}),d.jsx("path",{d:yo(p,8),fill:"none",stroke:g,strokeWidth:h||m?1.8:1.2,strokeDasharray:f.logical?"6 4":void 0,className:"poney-edge"}),d.jsx(Ay,{p:p[0],d:vw(p[1],p[0]),card:f.fromCardinality,color:g}),d.jsx(Ay,{p:p[x-1],d:vw(p[x-2],p[x-1]),card:f.toCardinality,color:g})]},f.id)}),t.tables.map(f=>{const h=n.dataTypes.get(f.dataTypeId),m=c&&!c.tables.has(f.dataTypeId),g=(i==null?void 0:i.kind)==="dataType"&&i.id===f.dataTypeId&&!i.field,p=h.storedIn?n.style(h.storedIn).tone:"malachite";return d.jsxs("g",{transform:`translate(${f.x} ${f.y})`,className:`poney-fade ${m?"poney-dim":""}`,children:[d.jsx("rect",{width:f.w,height:f.h,rx:10,fill:"var(--poney-paper-raised)",stroke:c!=null&&c.tables.has(f.dataTypeId)&&(s==null?void 0:s.kind)==="dataType"&&s.id===f.dataTypeId?dt(p):"var(--poney-rule-strong)"}),d.jsxs("g",{...r({kind:"dataType",id:f.dataTypeId},`Table ${f.name}, ${h.fields.length} fields`),children:[d.jsx("path",{d:`M 0 10 Q 0 0 10 0 H ${f.w-10} Q ${f.w} 0 ${f.w} 10 V ${at.header} H 0 Z`,fill:mn(p,9)}),d.jsx("line",{x1:0,x2:f.w,y1:at.header,y2:at.header,stroke:"var(--poney-rule)"}),d.jsx("g",{transform:"translate(13 12)",color:dt(p),children:d.jsx(Ed,{width:16,height:16,strokeWidth:1.8})}),d.jsx("text",{x:38,y:25,fontSize:13.5,fontWeight:650,fontFamily:"var(--poney-font-mono)",fill:"var(--poney-ink)",children:f.name}),d.jsxs("text",{x:f.w-12,y:25,textAnchor:"end",fontSize:11,fill:"var(--poney-ink-3)",className:"poney-numbers",children:[h.fields.length," fields"]})]}),f.rows.map(x=>{const y=x.y-f.y,v=c==null?void 0:c.rows.has(`${f.dataTypeId}#${x.name}`),k=(i==null?void 0:i.kind)==="dataType"&&i.id===f.dataTypeId&&i.field===x.name;return d.jsxs("g",{...r({kind:"dataType",id:f.dataTypeId,field:x.name},`Field ${x.name}, ${x.type}${x.primaryKey?", primary key":""}${x.foreign?", foreign key":""}`),children:[d.jsx("rect",{x:1,y,width:f.w-2,height:at.row,fill:k?"var(--poney-accent-wash)":v?mn(p,10):"transparent",className:"poney-row"}),x.primaryKey&&d.jsx("g",{transform:`translate(13 ${y+6})`,color:"var(--poney-ochre)",children:d.jsx(i1,{width:13,height:13,strokeWidth:2})}),!x.primaryKey&&x.foreign&&d.jsx("g",{transform:`translate(13 ${y+6})`,color:"var(--poney-lapis)",children:d.jsx(oo,{width:13,height:13,strokeWidth:2})}),d.jsx("text",{x:38,y:y+17,fontSize:12.5,fontFamily:"var(--poney-font-mono)",fontWeight:x.primaryKey?600:450,fill:k?"var(--poney-accent)":"var(--poney-ink)",children:x.name}),d.jsxs("text",{x:f.w-12,y:y+17,textAnchor:"end",fontSize:11.5,fontFamily:"var(--poney-font-mono)",fill:"var(--poney-ink-3)",children:[Nt(x.type,f.w/2-20,11.5,400,"mono"),x.nullable?"?":""]})]},x.name)}),(f.hiddenCount>0||f.expanded)&&d.jsxs("g",{role:"button",tabIndex:0,"data-ref":"toggle","aria-label":f.expanded?`Show fewer fields of ${f.name}`:`Show ${f.hiddenCount} more fields of ${f.name}`,className:"poney-control",onClick:x=>{x.stopPropagation(),u(f.dataTypeId)},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),u(f.dataTypeId))},children:[d.jsx("rect",{x:1,y:f.h-at.more-at.bottom,width:f.w-2,height:at.more,fill:"transparent"}),d.jsx("line",{x1:0,x2:f.w,y1:f.h-at.more-at.bottom,y2:f.h-at.more-at.bottom,stroke:"var(--poney-rule)"}),d.jsx("text",{x:f.w/2,y:f.h-at.bottom-10,textAnchor:"middle",fontSize:11.5,fontWeight:600,fill:"var(--poney-ink-2)",children:f.expanded?"Show fewer fields":`Show ${f.hiddenCount} more field${f.hiddenCount===1?"":"s"}`}),d.jsx("rect",{className:"poney-focus",x:4,y:f.h-at.more-at.bottom+2,width:f.w-8,height:at.more-4,rx:6,fill:"none",stroke:"var(--poney-accent)",strokeWidth:2})]}),d.jsx(xn,{w:f.w,h:f.h,rx:10,selected:g})]},f.dataTypeId)})]})}function qz(){const t=(e,n)=>d.jsxs("div",{className:"poney-legend-row",children:[d.jsxs("svg",{width:"30",height:"16","aria-hidden":!0,children:[d.jsx("line",{x1:"0",y1:"8",x2:"28",y2:"8",stroke:"var(--poney-ink-3)",strokeWidth:"1.2"}),d.jsx(Ay,{p:{x:28,y:8},d:{x:1,y:0},card:e,color:"var(--poney-ink-2)"})]}),n]});return d.jsxs("div",{className:"poney-legend",children:[t("one","Exactly one"),t("zero-or-one","Zero or one"),t("one-or-many","One or more"),t("many","Any number"),d.jsx(Vn,{line:"dashed",label:"Across databases, kept by code",head:!1}),d.jsxs("div",{className:"poney-legend-row",children:[d.jsx(i1,{size:13,style:{margin:"0 4px",color:"var(--poney-ochre)"}})," Primary key",d.jsx(oo,{size:13,style:{marginLeft:8,color:"var(--poney-lapis)"}})," Reference"]})]})}const Kz={key:"erd",label:"Entity relationships",icon:Ed,howToRead:"Each box is a table; the symbols at the line ends say how many rows can be on each side. Tables show their keys first. Select a field to see what it links to.",Renderer:Hz,Legend:qz};function Jz({scene:t}){const e=fn(),n=Sn(),{subject:r,selection:s}=Ds(),i=t.machineId,o=e.stateMachine(i),a=b.useMemo(()=>{if(!r)return null;const c=new Set,u=new Set,f=h=>{h&&(u.add(h.id),c.add(h.from),c.add(h.to))};if(r.kind==="state"&&r.behavior===i)c.add(r.id),t.transitions.forEach(h=>(h.from===r.id||h.to===r.id)&&f(h));else if(r.kind==="transition"&&r.behavior===i)f(t.transitions.find(h=>h.id===r.id));else if(r.kind==="entity")o.transitions.forEach(h=>h.triggeredBy===r.id&&f(t.transitions.find(m=>m.id===h.id)));else return null;return u.size||c.size?{states:c,trans:u}:null},[r,t,i,o]),l=(c,u)=>(s==null?void 0:s.kind)===c&&s.behavior===i&&s.id===u;return d.jsxs("g",{children:[t.transitions.map(c=>{const u=(a==null?void 0:a.trans.has(c.id))||l("transition",c.id),f=u?"var(--poney-accent)":"var(--poney-ink-3)";return d.jsxs("g",{...n({kind:"transition",behavior:i,id:c.id},`Transition: ${c.event}${c.guard?`, when ${c.guard}`:""}`),className:`poney-el ${a&&!u?"poney-dim":""}`,children:[d.jsx(vp,{points:c.points,style:{color:f,width:u?1.9:1.3,head:"arrow"}}),c.label&&d.jsxs("g",{transform:`translate(${c.label.x} ${c.label.y})`,children:[d.jsx("rect",{width:c.label.w,height:c.label.h,rx:7,fill:"var(--poney-paper-raised)",stroke:u?"var(--poney-accent)":"var(--poney-rule-strong)"}),d.jsx("text",{x:c.label.w/2,y:15,textAnchor:"middle",fontSize:11.5,fontWeight:650,fill:u?"var(--poney-accent)":"var(--poney-ink)",children:c.event}),c.guard&&d.jsxs("text",{x:c.label.w/2,y:28,textAnchor:"middle",fontSize:10.5,fill:"var(--poney-ink-3)",children:["[",c.guard,"]"]})]})]},c.id)}),t.states.map(c=>{const u=a&&!a.states.has(c.id),f=l("state",c.id),h={kind:"state",behavior:i,id:c.id},m=c.outcome==="success"?"var(--poney-success)":c.outcome==="failure"?"var(--poney-failure)":"var(--poney-rule-strong)";return c.kind==="initial"?d.jsxs("g",{transform:`translate(${c.x} ${c.y})`,...n(h,"Start"),className:`poney-el ${u?"poney-dim":""}`,children:[d.jsx("circle",{cx:c.w/2,cy:c.h/2,r:c.w/2,fill:"var(--poney-ink)"}),d.jsx(xn,{w:c.w,h:c.h,rx:c.w/2,selected:f})]},c.id):d.jsxs("g",{transform:`translate(${c.x} ${c.y})`,...n(h,`State ${c.name}${c.kind==="final"?", final":""}`),className:`poney-el ${u?"poney-dim":""}`,children:[d.jsx("rect",{className:"poney-body",width:c.w,height:c.h,rx:16,fill:"var(--poney-paper-raised)",stroke:m,strokeWidth:c.outcome==="neutral"?1.1:1.5}),c.kind==="final"&&d.jsx("rect",{x:4,y:4,width:c.w-8,height:c.h-8,rx:12,fill:"none",stroke:m,strokeWidth:1.1}),c.outcome!=="neutral"&&d.jsx("circle",{cx:18,cy:c.entryActions.length?22:c.h/2,r:4,fill:m}),d.jsx("text",{x:c.w/2,y:c.entryActions.length?27:c.h/2+5,textAnchor:"middle",fontSize:14,fontWeight:650,fill:"var(--poney-ink)",children:c.name}),c.entryActions.length>0&&d.jsxs("text",{x:c.w/2,y:46,textAnchor:"middle",fontSize:11,fill:"var(--poney-ink-3)",children:["On entry: ",c.entryActions[0],c.entryActions.length>1?` +${c.entryActions.length-1}`:""]}),d.jsx(xn,{w:c.w,h:c.h,rx:16,selected:f})]},c.id)})]})}function Gz(){return d.jsxs("div",{className:"poney-legend",children:[d.jsx(Kt,{shape:"dot",tone:"ink",label:"Where it starts"}),d.jsx(Kt,{shape:"pill",tone:"slate",label:"A state it can be in"}),d.jsx(Kt,{shape:"pill",tone:"success",label:"A good outcome"}),d.jsx(Kt,{shape:"pill",tone:"failure",label:"A failed or stopped outcome"}),d.jsxs("div",{className:"poney-legend-row",children:[d.jsxs("svg",{width:"22",height:"16","aria-hidden":!0,children:[d.jsx("rect",{x:"1",y:"2",width:"20",height:"12",rx:"5",fill:"none",stroke:"var(--poney-ink-3)"}),d.jsx("rect",{x:"3.5",y:"4.5",width:"15",height:"7",rx:"3",fill:"none",stroke:"var(--poney-ink-3)"})]}),"Final: nothing happens after it"]}),d.jsx("p",{className:"poney-legend-note",children:"Labels on arrows are events. Text in brackets is the condition that must be true."})]})}const Yz={key:"state",label:"State machine",icon:cD,howToRead:"Each box is a status. Arrows are the events that move it on; select one to see what causes it and what happens next.",Renderer:Jz,Legend:Gz};function Qz({scene:t}){const e=fn(),n=Sn(),r=Qv(),{subject:s,selection:i}=Ds(),o=b.useMemo(()=>{if(!s)return null;const l=new Set,c=new Set;if(s.kind==="entity"&&t.actors.some(u=>u.entityId===s.id))l.add(s.id),t.associations.forEach(u=>u.actor===s.id&&c.add(u.capability));else if(s.kind==="capability"&&t.capabilities.some(u=>u.id===s.id))c.add(s.id),t.associations.forEach(u=>u.capability===s.id&&l.add(u.actor)),t.includes.forEach(u=>u.from===s.id&&c.add(u.to));else return null;return{actors:l,caps:c}},[s,t]),a=l=>!!o&&o.caps.has(l.capability)&&o.actors.has(l.actor);return d.jsxs("g",{children:[d.jsx("rect",{x:t.boundary.x,y:t.boundary.y,width:t.boundary.w,height:t.boundary.h,rx:22,fill:"var(--poney-paper)",fillOpacity:.6,stroke:"var(--poney-rule-strong)"}),d.jsx("text",{x:t.boundary.x+20,y:t.boundary.y+30,fontSize:13,fontWeight:650,fill:"var(--poney-ink-2)",children:t.boundary.title}),t.areas.map((l,c)=>d.jsxs("g",{children:[c>0&&d.jsx("line",{x1:l.x,x2:l.x+l.w,y1:l.y-7,y2:l.y-7,stroke:"var(--poney-rule)"}),d.jsx("text",{x:l.x+4,y:l.y+18,fontSize:12,fontWeight:650,fill:"var(--poney-ink-3)",children:l.label})]},l.label)),t.associations.map(l=>{const c=a(l),u=(l.from.x+l.to.x)/2;return d.jsx("path",{d:`M ${l.from.x} ${l.from.y} C ${u} ${l.from.y} ${u} ${l.to.y} ${l.to.x} ${l.to.y}`,fill:"none",stroke:c?"var(--poney-accent)":"var(--poney-ink-4)",strokeWidth:c?1.8:1.1,strokeDasharray:l.side==="right"?"5 4":void 0,className:`poney-edge ${o&&!c?"poney-dim":""}`},l.id)}),t.includes.map(l=>{const c=(o==null?void 0:o.caps.has(l.from))&&o.caps.has(l.to),u=c?"var(--poney-accent)":"var(--poney-ink-3)",f=`M ${l.a.x} ${l.a.y} C ${l.a.x+48} ${l.a.y+6} ${l.b.x+48} ${l.b.y-6} ${l.b.x+4} ${l.b.y-1}`;return d.jsxs("g",{className:o&&!c?"poney-dim":"",children:[d.jsx("path",{d:f,fill:"none",stroke:u,strokeDasharray:"4 3",strokeWidth:1.2}),d.jsx(Wa,{at:{x:l.b.x+2,y:l.b.y},angle:Math.PI*.62,kind:"open-arrow",color:u}),d.jsx("text",{x:l.a.x+44,y:(l.a.y+l.b.y)/2+4,fontSize:11,fontStyle:"italic",fill:u,children:"includes"})]},l.id)}),t.capabilities.map(l=>{const c=e.capabilities.get(l.id),u=o&&!o.caps.has(l.id),f=(i==null?void 0:i.kind)==="capability"&&i.id===l.id;return d.jsxs("g",{transform:`translate(${l.x} ${l.y})`,...n({kind:"capability",id:l.id},`${c.name}. ${c.summary}`),className:`poney-el ${u?"poney-dim":""}`,children:[d.jsx("rect",{className:"poney-body",width:l.w,height:l.h,rx:l.h/2,fill:"var(--poney-paper-raised)",stroke:o!=null&&o.caps.has(l.id)?"var(--poney-tyrian)":"var(--poney-rule-strong)",strokeWidth:1.2}),d.jsx("text",{x:l.w/2,y:l.h/2+5,textAnchor:"middle",fontSize:13.5,fontWeight:600,fill:"var(--poney-ink)",children:Nt(c.name,l.w-32,13.5,600)}),d.jsx(xn,{w:l.w,h:l.h,rx:l.h/2,selected:f})]},l.id)}),t.actors.map(l=>{const c=e.entities.get(l.entityId),u=e.style(c),f=o&&!o.actors.has(l.entityId),h=(i==null?void 0:i.kind)==="entity"&&i.id===c.id,m=t.associations.filter(g=>g.actor===c.id).length;return d.jsxs("g",{transform:`translate(${l.x} ${l.y})`,...n({kind:"entity",id:c.id},`${c.name}: ${m} things they can do`),className:`poney-el ${f?"poney-dim":""}`,children:[d.jsx(kp,{entity:c,style:u.shape==="person"?u:{...u,shape:"card"},w:l.w,h:l.h,emphasis:h?"selected":"normal",detail:!1}),r>.5&&d.jsx("text",{x:l.w/2,y:l.h+16,textAnchor:"middle",fontSize:11.5,fill:"var(--poney-ink-3)",children:l.side==="left"?`Can do ${m} thing${m===1?"":"s"}`:`Supports ${m}`})]},l.entityId)})]})}function Xz(){return d.jsxs("div",{className:"poney-legend",children:[d.jsx(Kt,{shape:"person",tone:"slate",label:"Person who uses the system"}),d.jsx(Kt,{shape:"card",tone:"umber",label:"Outside system that helps",dashed:!0}),d.jsx(Kt,{shape:"pill",tone:"tyrian",label:"Something a person can do"}),d.jsx(Vn,{line:"solid",label:"Does it",head:!1}),d.jsx(Vn,{line:"dashed",label:"Helps with it",head:!1})]})}const eL={key:"usecase",label:"Use cases",icon:iz,howToRead:"People on the left, the things they can do in the middle, outside services that help on the right. Select a person to see everything they can do.",Renderer:Qz,Legend:Xz},Ry="var(--poney-lapis)",Iy="var(--poney-ochre)";function tL({scene:t,view:e}){const n=fn(),r=Sn(),{subject:s,selection:i}=Ds(),o=mp(e.id)[0].transitive??!1,a=n.doc.presentation.relationships,l=pc(13,11,22),c=b.useMemo(()=>{if(!s)return null;const f=new Set,h=new Set,m=new Set,g=new Set;if(s.kind==="entity"&&t.nodes.some(p=>p.entityId===s.id)){const p=(x,y)=>{for(const v of t.edges){const k=y?v.source:v.target,w=y?v.target:v.source;if(k!==x)continue;(y?m:g).add(v.id);const j=y?f:h;j.has(w)||w===s.id||(j.add(w),o&&p(w,y))}};return p(s.id,!0),p(s.id,!1),{node:s.id,deps:f,users:h,depEdges:m,userEdges:g,group:null}}if(s.kind==="relationship"){const p=t.edges.find(x=>x.id===s.id);return p?(m.add(p.id),f.add(p.target),h.add(p.source),{node:null,deps:f,users:h,depEdges:m,userEdges:g,group:null}):null}if(s.kind==="group"&&s.view===e.id){const p=t.bands.findIndex(x=>x.id===s.id);return t.nodes.forEach(x=>x.band===p&&f.add(x.entityId)),{node:null,deps:f,users:h,depEdges:m,userEdges:g,group:s.id}}return null},[s,t,o,e.id]),u=f=>c!=null&&c.deps.has(f)?Ry:c!=null&&c.users.has(f)?Iy:void 0;return d.jsxs("g",{children:[t.bands.map((f,h)=>{const m=(i==null?void 0:i.kind)==="group"&&i.id===f.id;return d.jsxs("g",{children:[d.jsx("rect",{x:f.x,y:f.y,width:f.w,height:f.h,fill:h%2?"var(--poney-paper)":"transparent",fillOpacity:.55}),h>0&&d.jsx("line",{x1:f.x,x2:f.x+f.w,y1:f.y,y2:f.y,stroke:"var(--poney-rule)"}),d.jsxs("g",{...r({kind:"group",view:e.id,id:f.id},`Layer ${f.label}`),children:[d.jsx("rect",{x:12,y:f.y+12,width:148,height:f.h-24,rx:10,fill:m?"var(--poney-accent-wash)":"transparent"}),d.jsx("text",{x:24,y:f.y+f.h/2-(f.description&&l===13?4:-4),fontSize:l,fontWeight:650,fill:m?"var(--poney-accent)":"var(--poney-ink-2)",children:f.label}),f.description&&l===13&&d.jsx("text",{x:24,y:f.y+f.h/2+13,fontSize:11,fill:"var(--poney-ink-3)",children:Nt(f.description,136,11)})]})]},f.id)}),t.edges.map(f=>{var N,M;const h=a[f.kind]??{pattern:"solid",head:"arrow"},m=c==null?void 0:c.depEdges.has(f.id),g=c==null?void 0:c.userEdges.has(f.id),p=(c==null?void 0:c.group)&&(c.deps.has(f.source)||c.deps.has(f.target)),x=m?Ry:g?Iy:p?"var(--poney-ink-2)":"var(--poney-ink-4)",[y,v,k,w]=f.d,j=Math.atan2(w.y-k.y,w.x-k.x),C=h.head==="triangle"?10:6,E={x:w.x-Math.cos(j)*C,y:w.y-Math.sin(j)*C},S=c&&!m&&!g&&!p,_=n.relationships.get(f.id);return d.jsxs("g",{...r({kind:"relationship",id:f.id},`${(N=n.entities.get(f.source))==null?void 0:N.name} ${(_==null?void 0:_.kind)==="implements"?"implements":"depends on"} ${(M=n.entities.get(f.target))==null?void 0:M.name}`),className:`poney-el ${S?"poney-dim":""}`,children:[d.jsx("path",{d:`M ${y.x} ${y.y} C ${v.x} ${v.y} ${k.x} ${k.y} ${w.x} ${w.y}`,fill:"none",stroke:"transparent",strokeWidth:12}),d.jsx("path",{d:`M ${y.x} ${y.y} C ${v.x} ${v.y} ${k.x} ${k.y} ${E.x} ${E.y}`,fill:"none",stroke:x,strokeWidth:m||g?1.9:1.2,strokeDasharray:h.pattern==="dashed"?"5 4":void 0,className:"poney-edge"}),d.jsx(Wa,{at:w,angle:j,kind:h.head,color:x})]},f.id)}),t.nodes.map(f=>{const h=n.entities.get(f.entityId),m=n.style(h),g=(c==null?void 0:c.node)===f.entityId,p=u(f.entityId),x=c&&!g&&!p,y=(i==null?void 0:i.kind)==="entity"&&i.id===h.id;return d.jsxs("g",{transform:`translate(${f.x} ${f.y})`,...r({kind:"entity",id:h.id},`${h.name}, ${m.label}`),className:`poney-el ${x?"poney-dim":""}`,children:[d.jsx(kp,{entity:h,style:{...m,shape:"chip"},w:f.w,h:f.h,emphasis:y?"selected":"normal",detail:!1}),p&&!y&&d.jsx("rect",{x:-2,y:-2,width:f.w+4,height:f.h+4,rx:12,fill:"none",stroke:p,strokeWidth:1.6}),d.jsx(xn,{w:f.w,h:f.h,rx:10,selected:!1})]},f.entityId)})]})}function nL(){return d.jsxs("div",{className:"poney-legend",children:[d.jsx(Vn,{line:"solid",label:"Depends on",color:"var(--poney-ink-3)"}),d.jsx(Vn,{line:"dashed",label:"Implements, or sends events to",color:"var(--poney-ink-3)"}),d.jsx(Vn,{line:"solid",label:"When selected: what it needs",color:Ry}),d.jsx(Vn,{line:"solid",label:"When selected: what needs it",color:Iy}),d.jsx("p",{className:"poney-legend-note",children:"Arrows should point down. An arrow that points up is a dependency turned around on purpose, such as an adapter that implements a domain interface."})]})}const rL={key:"dependency",label:"Dependencies",icon:aD,howToRead:"Layers run from the outside in, top to bottom. Select a part: blue shows what it needs, amber shows what needs it. Turn on “follow all the way” to see the full chain.",Renderer:tL,Legend:nL};function sL({scene:t,view:e}){const n=fn().doc,[r,s]=b.useState(null),i=HI(n,e.id)[0],[o,a]=mp(e.id),l=o.collapsed,c=b.useMemo(()=>({marks:i?j_(i):new Map,mode:"after",focus:null,callouts:new Map,hot:r,setHot:s,toggleGroup:u=>{const f=l??e.collapsed;a({collapsed:f.includes(u)?f.filter(h=>h!==u):[...f,u]})}}),[i,r,l,e,a]);return d.jsx(Jv,{value:c,children:d.jsx(d$,{scene:t})})}const iL={key:"map",label:"Map",icon:$D,howToRead:"A picture of how parts connect. A part drawn inside another belongs to it; open or close a group with its round button. Hover a line to read what it does.",Renderer:sL},oL=[Pz,iL,Lz,Vz,Zz,Kz,Yz,eL,rL],y$=new Map(oL.map(t=>[t.key,t]));function aL(t){y$.set(t.key,t)}function Yr(t){return y$.get(g$(t))}const d1=[];function x$(t){var e;d1.push(t),(e=t.diagrams)==null||e.forEach(aL),Object.entries(t.layouts??{}).forEach(([n,r])=>zP(n,r))}const Td=()=>d1.map(t=>t.core),lL=()=>d1.flatMap(t=>t.inspector??[]);var Ze;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Ze||(Ze={}));var kw;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(kw||(kw={}));const pe=Ze.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Hs=t=>{switch(typeof t){case"undefined":return pe.undefined;case"string":return pe.string;case"number":return Number.isNaN(t)?pe.nan:pe.number;case"boolean":return pe.boolean;case"function":return pe.function;case"bigint":return pe.bigint;case"symbol":return pe.symbol;case"object":return Array.isArray(t)?pe.array:t===null?pe.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?pe.promise:typeof Map<"u"&&t instanceof Map?pe.map:typeof Set<"u"&&t instanceof Set?pe.set:typeof Date<"u"&&t instanceof Date?pe.date:pe.object;default:return pe.unknown}},ee=Ze.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);let jo=class v$ extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),r}static assert(e){if(!(e instanceof v$))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ze.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};jo.create=t=>new jo(t);const Py=(t,e)=>{let n;switch(t.code){case ee.invalid_type:t.received===pe.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ee.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Ze.jsonStringifyReplacer)}`;break;case ee.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ze.joinValues(t.keys,", ")}`;break;case ee.invalid_union:n="Invalid input";break;case ee.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ze.joinValues(t.options)}`;break;case ee.invalid_enum_value:n=`Invalid enum value. Expected ${Ze.joinValues(t.options)}, received '${t.received}'`;break;case ee.invalid_arguments:n="Invalid function arguments";break;case ee.invalid_return_type:n="Invalid function return type";break;case ee.invalid_date:n="Invalid date";break;case ee.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Ze.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ee.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case ee.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case ee.custom:n="Invalid input";break;case ee.invalid_intersection_types:n="Intersection results could not be merged";break;case ee.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ee.not_finite:n="Number must be finite";break;default:n=e.defaultError,Ze.assertNever(t)}return{message:n}};let cL=Py;function dL(){return cL}const uL=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function oe(t,e){const n=dL(),r=uL({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Py?void 0:Py].filter(s=>!!s)});t.common.issues.push(r)}let Er=class k${constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return Ne;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return k$.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return Ne;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}};const Ne=Object.freeze({status:"aborted"}),Gl=t=>({status:"dirty",value:t}),ur=t=>({status:"valid",value:t}),ww=t=>t.status==="aborted",bw=t=>t.status==="dirty",Ua=t=>t.status==="valid",Vf=t=>typeof Promise<"u"&&t instanceof Promise;var ye;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ye||(ye={}));let Ni=class{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const Sw=(t,e)=>{if(Ua(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new jo(t.common.issues);return this._error=n,this._error}}};function Re(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}let We=class{get description(){return this._def.description}_getType(e){return Hs(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Hs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Er,ctx:{common:e.parent.common,data:e.data,parsedType:Hs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Vf(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Hs(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Sw(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Hs(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return Ua(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>Ua(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Hs(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Vf(s)?s:Promise.resolve(s));return Sw(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:ee.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new Ha({schema:this,typeName:$e.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return pi.create(this,this._def)}nullable(){return qa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Za.create(this)}promise(){return Zf.create(this,this._def)}or(e){return Wf.create([this,e],this._def)}and(e){return Uf.create(this,e,this._def)}transform(e){return new Ha({...Re(this._def),schema:this,typeName:$e.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Uy({...Re(this._def),innerType:this,defaultValue:n,typeName:$e.ZodDefault})}brand(){return new RL({typeName:$e.ZodBranded,type:this,...Re(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Zy({...Re(this._def),innerType:this,catchValue:n,typeName:$e.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return IL.create(this,e)}readonly(){return Hy.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const fL=/^c[^\s-]{8,}$/i,hL=/^[0-9a-z]+$/,pL=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mL=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,gL=/^[a-z0-9_-]{21}$/i,yL=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,xL=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,vL=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,kL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let _m;const wL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,bL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,SL=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,jL=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,CL=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_L=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,w$="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",NL=new RegExp(`^${w$}$`);function b$(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function EL(t){return new RegExp(`^${b$(t)}$`)}function $L(t){let e=`${w$}T${b$(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function ML(t,e){return!!((e==="v4"||!e)&&wL.test(t)||(e==="v6"||!e)&&SL.test(t))}function TL(t,e){if(!yL.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function OL(t,e){return!!((e==="v4"||!e)&&bL.test(t)||(e==="v6"||!e)&&jL.test(t))}let Dy=class Yl extends We{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==pe.string){const i=this._getOrReturnCtx(e);return oe(i,{code:ee.invalid_type,expected:pe.string,received:i.parsedType}),Ne}const r=new Er;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),oe(s,{code:ee.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),oe(s,{code:ee.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?oe(s,{code:ee.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&oe(s,{code:ee.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")vL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"email",code:ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")_m||(_m=new RegExp(kL,"u")),_m.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"emoji",code:ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")mL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"uuid",code:ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")gL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"nanoid",code:ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")fL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"cuid",code:ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")hL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"cuid2",code:ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")pL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"ulid",code:ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),oe(s,{validation:"url",code:ee.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"regex",code:ee.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),oe(s,{code:ee.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),oe(s,{code:ee.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),oe(s,{code:ee.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?$L(i).test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{code:ee.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?NL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{code:ee.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?EL(i).test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{code:ee.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?xL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"duration",code:ee.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?ML(e.data,i.version)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"ip",code:ee.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?TL(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"jwt",code:ee.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?OL(e.data,i.version)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"cidr",code:ee.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?CL.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"base64",code:ee.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?_L.test(e.data)||(s=this._getOrReturnCtx(e,s),oe(s,{validation:"base64url",code:ee.invalid_string,message:i.message}),r.dirty()):Ze.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:ee.invalid_string,...ye.errToObj(r)})}_addCheck(e){return new Yl({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ye.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ye.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ye.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ye.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ye.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ye.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ye.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ye.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ye.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ye.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ye.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ye.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ye.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...ye.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...ye.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ye.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...ye.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...ye.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...ye.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...ye.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...ye.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...ye.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...ye.errToObj(n)})}nonempty(e){return this.min(1,ye.errToObj(e))}trim(){return new Yl({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Yl({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Yl({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Dy.create=t=>new Dy({checks:[],typeName:$e.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Re(t)});function AL(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}let jw=class zy extends We{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==pe.number){const i=this._getOrReturnCtx(e);return oe(i,{code:ee.invalid_type,expected:pe.number,received:i.parsedType}),Ne}let r;const s=new Er;for(const i of this._def.checks)i.kind==="int"?Ze.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),oe(r,{code:ee.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),oe(r,{code:ee.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),oe(r,{code:ee.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?AL(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),oe(r,{code:ee.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),oe(r,{code:ee.not_finite,message:i.message}),s.dirty()):Ze.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ye.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ye.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ye.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ye.toString(n))}setLimit(e,n,r,s){return new zy({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ye.toString(s)}]})}_addCheck(e){return new zy({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ye.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ye.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ye.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ye.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ye.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ye.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ze.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};jw.create=t=>new jw({checks:[],typeName:$e.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Re(t)});let Cw=class Ly extends We{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==pe.bigint)return this._getInvalidInput(e);let r;const s=new Er;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),oe(r,{code:ee.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),oe(r,{code:ee.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),oe(r,{code:ee.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Ze.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return oe(n,{code:ee.invalid_type,expected:pe.bigint,received:n.parsedType}),Ne}gte(e,n){return this.setLimit("min",e,!0,ye.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ye.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ye.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ye.toString(n))}setLimit(e,n,r,s){return new Ly({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ye.toString(s)}]})}_addCheck(e){return new Ly({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ye.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ye.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Cw.create=t=>new Cw({checks:[],typeName:$e.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Re(t)});let Fy=class extends We{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==pe.boolean){const r=this._getOrReturnCtx(e);return oe(r,{code:ee.invalid_type,expected:pe.boolean,received:r.parsedType}),Ne}return ur(e.data)}};Fy.create=t=>new Fy({typeName:$e.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Re(t)});let _w=class S$ extends We{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==pe.date){const i=this._getOrReturnCtx(e);return oe(i,{code:ee.invalid_type,expected:pe.date,received:i.parsedType}),Ne}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return oe(i,{code:ee.invalid_date}),Ne}const r=new Er;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),oe(s,{code:ee.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),oe(s,{code:ee.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Ze.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new S$({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ye.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ye.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};_w.create=t=>new _w({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:$e.ZodDate,...Re(t)});let Nw=class extends We{_parse(e){if(this._getType(e)!==pe.symbol){const r=this._getOrReturnCtx(e);return oe(r,{code:ee.invalid_type,expected:pe.symbol,received:r.parsedType}),Ne}return ur(e.data)}};Nw.create=t=>new Nw({typeName:$e.ZodSymbol,...Re(t)});let Ew=class extends We{_parse(e){if(this._getType(e)!==pe.undefined){const r=this._getOrReturnCtx(e);return oe(r,{code:ee.invalid_type,expected:pe.undefined,received:r.parsedType}),Ne}return ur(e.data)}};Ew.create=t=>new Ew({typeName:$e.ZodUndefined,...Re(t)});let $w=class extends We{_parse(e){if(this._getType(e)!==pe.null){const r=this._getOrReturnCtx(e);return oe(r,{code:ee.invalid_type,expected:pe.null,received:r.parsedType}),Ne}return ur(e.data)}};$w.create=t=>new $w({typeName:$e.ZodNull,...Re(t)});let Mw=class extends We{constructor(){super(...arguments),this._any=!0}_parse(e){return ur(e.data)}};Mw.create=t=>new Mw({typeName:$e.ZodAny,...Re(t)});let Tw=class extends We{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ur(e.data)}};Tw.create=t=>new Tw({typeName:$e.ZodUnknown,...Re(t)});let Ei=class extends We{_parse(e){const n=this._getOrReturnCtx(e);return oe(n,{code:ee.invalid_type,expected:pe.never,received:n.parsedType}),Ne}};Ei.create=t=>new Ei({typeName:$e.ZodNever,...Re(t)});let Ow=class extends We{_parse(e){if(this._getType(e)!==pe.undefined){const r=this._getOrReturnCtx(e);return oe(r,{code:ee.invalid_type,expected:pe.void,received:r.parsedType}),Ne}return ur(e.data)}};Ow.create=t=>new Ow({typeName:$e.ZodVoid,...Re(t)});let Za=class Wu extends We{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==pe.array)return oe(n,{code:ee.invalid_type,expected:pe.array,received:n.parsedType}),Ne;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(oe(n,{code:o?ee.too_big:ee.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(oe(n,{code:ee.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(oe(n,{code:ee.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new Ni(n,o,n.path,a)))).then(o=>Er.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new Ni(n,o,n.path,a)));return Er.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Wu({...this._def,minLength:{value:e,message:ye.toString(n)}})}max(e,n){return new Wu({...this._def,maxLength:{value:e,message:ye.toString(n)}})}length(e,n){return new Wu({...this._def,exactLength:{value:e,message:ye.toString(n)}})}nonempty(e){return this.min(1,e)}};Za.create=(t,e)=>new Za({type:t,minLength:null,maxLength:null,exactLength:null,typeName:$e.ZodArray,...Re(e)});function Xo(t){if(t instanceof Ts){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=pi.create(Xo(r))}return new Ts({...t._def,shape:()=>e})}else return t instanceof Za?new Za({...t._def,type:Xo(t.element)}):t instanceof pi?pi.create(Xo(t.unwrap())):t instanceof qa?qa.create(Xo(t.unwrap())):t instanceof Hc?Hc.create(t.items.map(e=>Xo(e))):t}let Ts=class gr extends We{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Ze.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==pe.object){const c=this._getOrReturnCtx(e);return oe(c,{code:ee.invalid_type,expected:pe.object,received:c.parsedType}),Ne}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ei&&this._def.unknownKeys==="strip"))for(const c in s.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=i[c],f=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ni(s,f,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Ei){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")a.length>0&&(oe(s,{code:ee.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const f=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ni(s,f,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const f=await u.key,h=await u.value;c.push({key:f,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>Er.mergeObjectSync(r,c)):Er.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ye.errToObj,new gr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:ye.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new gr({...this._def,unknownKeys:"strip"})}passthrough(){return new gr({...this._def,unknownKeys:"passthrough"})}extend(e){return new gr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new gr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:$e.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new gr({...this._def,catchall:e})}pick(e){const n={};for(const r of Ze.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new gr({...this._def,shape:()=>n})}omit(e){const n={};for(const r of Ze.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new gr({...this._def,shape:()=>n})}deepPartial(){return Xo(this)}partial(e){const n={};for(const r of Ze.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new gr({...this._def,shape:()=>n})}required(e){const n={};for(const r of Ze.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof pi;)i=i._def.innerType;n[r]=i}return new gr({...this._def,shape:()=>n})}keyof(){return C$(Ze.objectKeys(this.shape))}};Ts.create=(t,e)=>new Ts({shape:()=>t,unknownKeys:"strip",catchall:Ei.create(),typeName:$e.ZodObject,...Re(e)});Ts.strictCreate=(t,e)=>new Ts({shape:()=>t,unknownKeys:"strict",catchall:Ei.create(),typeName:$e.ZodObject,...Re(e)});Ts.lazycreate=(t,e)=>new Ts({shape:t,unknownKeys:"strip",catchall:Ei.create(),typeName:$e.ZodObject,...Re(e)});let Wf=class extends We{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new jo(a.ctx.common.issues));return oe(n,{code:ee.invalid_union,unionErrors:o}),Ne}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new jo(l));return oe(n,{code:ee.invalid_union,unionErrors:a}),Ne}}get options(){return this._def.options}};Wf.create=(t,e)=>new Wf({options:t,typeName:$e.ZodUnion,...Re(e)});function By(t,e){const n=Hs(t),r=Hs(e);if(t===e)return{valid:!0,data:t};if(n===pe.object&&r===pe.object){const s=Ze.objectKeys(e),i=Ze.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const l=By(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===pe.array&&r===pe.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],l=By(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===pe.date&&r===pe.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}let Uf=class extends We{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(ww(i)||ww(o))return Ne;const a=By(i.value,o.value);return a.valid?((bw(i)||bw(o))&&n.dirty(),{status:n.value,value:a.data}):(oe(r,{code:ee.invalid_intersection_types}),Ne)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Uf.create=(t,e,n)=>new Uf({left:t,right:e,typeName:$e.ZodIntersection,...Re(n)});let Hc=class j$ extends We{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==pe.array)return oe(r,{code:ee.invalid_type,expected:pe.array,received:r.parsedType}),Ne;if(r.data.length<this._def.items.length)return oe(r,{code:ee.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ne;!this._def.rest&&r.data.length>this._def.items.length&&(oe(r,{code:ee.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Ni(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>Er.mergeArray(n,o)):Er.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new j$({...this._def,rest:e})}};Hc.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Hc({items:t,typeName:$e.ZodTuple,rest:null,...Re(e)})};let Aw=class extends We{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==pe.map)return oe(r,{code:ee.invalid_type,expected:pe.map,received:r.parsedType}),Ne;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new Ni(r,a,r.path,[c,"key"])),value:i._parse(new Ni(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Ne;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Ne;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}};Aw.create=(t,e,n)=>new Aw({valueType:e,keyType:t,typeName:$e.ZodMap,...Re(n)});let Rw=class Vy extends We{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==pe.set)return oe(r,{code:ee.invalid_type,expected:pe.set,received:r.parsedType}),Ne;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(oe(r,{code:ee.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(oe(r,{code:ee.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Ne;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new Ni(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new Vy({...this._def,minSize:{value:e,message:ye.toString(n)}})}max(e,n){return new Vy({...this._def,maxSize:{value:e,message:ye.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Rw.create=(t,e)=>new Rw({valueType:t,minSize:null,maxSize:null,typeName:$e.ZodSet,...Re(e)});let Iw=class extends We{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};Iw.create=(t,e)=>new Iw({getter:t,typeName:$e.ZodLazy,...Re(e)});let Pw=class extends We{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return oe(n,{received:n.data,code:ee.invalid_literal,expected:this._def.value}),Ne}return{status:"valid",value:e.data}}get value(){return this._def.value}};Pw.create=(t,e)=>new Pw({value:t,typeName:$e.ZodLiteral,...Re(e)});function C$(t,e){return new u1({values:t,typeName:$e.ZodEnum,...Re(e)})}let u1=class Wy extends We{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return oe(n,{expected:Ze.joinValues(r),received:n.parsedType,code:ee.invalid_type}),Ne}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return oe(n,{received:n.data,code:ee.invalid_enum_value,options:r}),Ne}return ur(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Wy.create(e,{...this._def,...n})}exclude(e,n=this._def){return Wy.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};u1.create=C$;let Dw=class extends We{_parse(e){const n=Ze.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==pe.string&&r.parsedType!==pe.number){const s=Ze.objectValues(n);return oe(r,{expected:Ze.joinValues(s),received:r.parsedType,code:ee.invalid_type}),Ne}if(this._cache||(this._cache=new Set(Ze.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=Ze.objectValues(n);return oe(r,{received:r.data,code:ee.invalid_enum_value,options:s}),Ne}return ur(e.data)}get enum(){return this._def.values}};Dw.create=(t,e)=>new Dw({values:t,typeName:$e.ZodNativeEnum,...Re(e)});let Zf=class extends We{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==pe.promise&&n.common.async===!1)return oe(n,{code:ee.invalid_type,expected:pe.promise,received:n.parsedType}),Ne;const r=n.parsedType===pe.promise?n.data:Promise.resolve(n.data);return ur(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Zf.create=(t,e)=>new Zf({type:t,typeName:$e.ZodPromise,...Re(e)});let Ha=class extends We{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$e.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{oe(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Ne;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Ne:l.status==="dirty"||n.value==="dirty"?Gl(l.value):l});{if(n.value==="aborted")return Ne;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Ne:a.status==="dirty"||n.value==="dirty"?Gl(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ne:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ne:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ua(o))return Ne;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Ua(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):Ne);Ze.assertNever(s)}};Ha.create=(t,e,n)=>new Ha({schema:t,typeName:$e.ZodEffects,effect:e,...Re(n)});Ha.createWithPreprocess=(t,e,n)=>new Ha({schema:e,effect:{type:"preprocess",transform:t},typeName:$e.ZodEffects,...Re(n)});let pi=class extends We{_parse(e){return this._getType(e)===pe.undefined?ur(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pi.create=(t,e)=>new pi({innerType:t,typeName:$e.ZodOptional,...Re(e)});let qa=class extends We{_parse(e){return this._getType(e)===pe.null?ur(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};qa.create=(t,e)=>new qa({innerType:t,typeName:$e.ZodNullable,...Re(e)});let Uy=class extends We{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===pe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Uy.create=(t,e)=>new Uy({innerType:t,typeName:$e.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Re(e)});let Zy=class extends We{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Vf(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new jo(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new jo(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Zy.create=(t,e)=>new Zy({innerType:t,typeName:$e.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Re(e)});let zw=class extends We{_parse(e){if(this._getType(e)!==pe.nan){const r=this._getOrReturnCtx(e);return oe(r,{code:ee.invalid_type,expected:pe.nan,received:r.parsedType}),Ne}return{status:"valid",value:e.data}}};zw.create=t=>new zw({typeName:$e.ZodNaN,...Re(t)});let RL=class extends We{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},IL=class _$ extends We{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ne:i.status==="dirty"?(n.dirty(),Gl(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ne:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new _$({in:e,out:n,typeName:$e.ZodPipeline})}},Hy=class extends We{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Ua(s)&&(s.value=Object.freeze(s.value)),s);return Vf(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};Hy.create=(t,e)=>new Hy({innerType:t,typeName:$e.ZodReadonly,...Re(e)});var $e;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})($e||($e={}));const Nm=Dy.create,PL=Fy.create;Ei.create;const DL=Za.create,N$=Ts.create;Wf.create;Uf.create;Hc.create;u1.create;Zf.create;pi.create;qa.create;const zL=N$({team:se.optional(),oncall:Nm().optional(),channel:Nm().optional(),mission:Nm().optional()}).strict(),qy=N$({teams:DL(se).min(1),showUnowned:PL().default(!1)}),Hf="ownership/team",wp={name:"ownership",version:"0.1.0",description:"Teams, who owns what, and how to reach them.",entityKinds:{team:{label:"Team",description:"A group of people who own and run parts of the system."}},facets:{entity:zL},views:{"team-map":{label:"Team map",description:"Every team and the parts of the system it owns.",schema:qy}},validate(t,{index:e,report:n}){t.model.entities.forEach((r,s)=>{const i=Wr(wp,"entity",r);if(!(i!=null&&i.team))return;const o=e.entities.get(i.team);o?o.kind!==Hf&&n(`model.entities.${s}.ext.ownership.team`,`"${i.team}" is not a team`):n(`model.entities.${s}.ext.ownership.team`,`Unknown team "${i.team}"`)}),t.views.forEach((r,s)=>{if(r.type!=="extension"||r.extension!=="ownership/team-map")return;const i=qy.safeParse(r.data);i.success&&i.data.teams.forEach((o,a)=>{var l;((l=e.entities.get(o))==null?void 0:l.kind)!==Hf&&n(`views.${s}.data.teams.${a}`,`"${o}" is not a team`)})})}},Ka=t=>Wr(wp,"entity",t);function LL(t,e){var r;const n=(r=Ka(e))==null?void 0:r.team;return n?t.model.entities.find(s=>s.id===n):void 0}function E$(t,e){return t.model.entities.filter(n=>{var r;return((r=Ka(n))==null?void 0:r.team)===e})}const Dl=248,Em=28,$m=104,Mm=50,Tm=4;function FL(t,e){const n=qy.safeParse(e.data);if(!n.success)throw new Error(`The ${wp.name} team map has invalid data`);const r=[],s=[];let i=24;for(let l=0;l<n.data.teams.length;l+=Tm){const c=n.data.teams.slice(l,l+Tm);let u=0;c.forEach((f,h)=>{const m=t.model.entities.find(v=>v.id===f);if(!m)return;const g=Ka(m),p=24+h*(Dl+Em),x=E$(t,f);x.forEach((v,k)=>s.push({entityId:v.id,team:f,x:p+12,y:i+$m+12+k*(Mm+8),w:Dl-24,h:Mm}));const y=$m+12+x.length*(Mm+8)+8;u=Math.max(u,y),r.push({entityId:f,x:p,y:i,w:Dl,h:y,header:$m,mission:Cf((g==null?void 0:g.mission)??m.summary,Dl-32,12,400,2),oncall:g==null?void 0:g.oncall,channel:g==null?void 0:g.channel})});for(const f of r.filter(h=>h.y===i))f.h=u;i+=u+Em}const o={};for(const l of r)o[de({kind:"entity",id:l.entityId})]=l;for(const l of s)o[de({kind:"entity",id:l.entityId})]=l;const a=Math.min(Tm,n.data.teams.length);return{width:48+a*Dl+(a-1)*Em,height:i,teams:r,owned:s,anchors:o}}function BL({scene:t}){const e=fn(),n=Sn(),{subject:r,selection:s}=Ds(),i=b.useMemo(()=>{var a;if((r==null?void 0:r.kind)!=="entity")return null;const o=e.entities.get(r.id);return(o==null?void 0:o.kind)===Hf?o.id:((a=Ka(o))==null?void 0:a.team)??null},[r,e]);return d.jsxs("g",{children:[t.teams.map(o=>{const a=e.entities.get(o.entityId),l=e.style(a),c=dt(l.tone),u=i&&i!==o.entityId,f=(s==null?void 0:s.kind)==="entity"&&s.id===o.entityId;return d.jsxs("g",{className:`poney-fade ${u?"poney-dim":""}`,children:[d.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,rx:16,fill:"var(--poney-paper)",fillOpacity:.6,stroke:"var(--poney-rule-strong)"}),d.jsxs("g",{transform:`translate(${o.x} ${o.y})`,...n({kind:"entity",id:a.id},`${a.name}. ${a.summary}`),children:[d.jsx("path",{d:`M 0 16 Q 0 0 16 0 H ${o.w-16} Q ${o.w} 0 ${o.w} 16 V ${o.header} H 0 Z`,fill:mn(l.tone,12)}),d.jsx(lr,{name:l.icon,x:16,y:16,size:16,color:c}),d.jsx("text",{x:40,y:29,fontSize:14,fontWeight:650,fill:"var(--poney-ink)",children:a.name}),o.mission.map((h,m)=>d.jsx("text",{x:16,y:52+m*15,fontSize:12,fill:"var(--poney-ink-2)",children:h},m)),d.jsxs("text",{x:16,y:o.header-12,fontSize:11,fill:"var(--poney-ink-3)",children:["On call: ",o.oncall??"none"]}),d.jsx(xn,{w:o.w,h:o.header,rx:16,selected:f})]})]},o.entityId)}),t.owned.map(o=>{var u;const a=e.entities.get(o.entityId),l=i&&i!==o.team,c=(s==null?void 0:s.kind)==="entity"&&s.id===a.id;return d.jsx("g",{transform:`translate(${o.x} ${o.y})`,...n({kind:"entity",id:a.id},`${a.name}, owned by ${(u=e.entities.get(o.team))==null?void 0:u.name}`),className:`poney-el ${l?"poney-dim":""}`,children:d.jsx(kp,{entity:a,style:{...e.style(a),shape:"chip"},w:o.w,h:o.h,emphasis:c?"selected":"normal",detail:!1})},o.entityId)})]})}const VL={key:"ownership/team-map",label:"Team map",icon:l1,howToRead:"One column per team, with everything it owns. Select a part anywhere in the studio to see its team and who is on call.",Renderer:BL},Lw=t=>{let e;const n=new Set,r=(c,u)=>{const f=typeof c=="function"?c(e):c;if(!Object.is(f,e)){const h=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(m=>m(e,h))}},s=()=>e,a={setState:r,getState:s,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=e=t(r,s,a);return a},WL=t=>t?Lw(t):Lw,UL=t=>t;function ZL(t,e=UL){const n=wr.useSyncExternalStore(t.subscribe,wr.useCallback(()=>e(t.getState()),[t,e]),()=>e(t.getInitialState()));return wr.useDebugValue(n),n}const HL=t=>{const e=WL(t),n=r=>ZL(e,r);return Object.assign(n,e),n},qL=t=>HL,xt="__overview",Fr="walk:",bp=t=>t.startsWith(Fr)?t.slice(Fr.length):void 0,Od=t=>t.live.state==="on"&&(!!t.agent.session||t.agent.listening),cu={get(t,e){try{const n=localStorage.getItem(`poney:${t}`);return n?JSON.parse(n):e}catch{return e}},set(t,e){try{localStorage.setItem(`poney:${t}`,JSON.stringify(e))}catch{}}};let KL=0;const Zo=(t,e=null)=>({ref:e,mode:t,nonce:++KL}),T=qL()((t,e)=>({projects:[],projectId:"",importOpen:!1,importText:"",shortcutsOpen:!1,setImportOpen:(n,r)=>t({importOpen:n,importText:r??(n?e().importText:"")}),setShortcutsOpen:n=>t({shortcutsOpen:n}),history:void 0,viewId:xt,selection:null,hover:null,focus:null,back:[],forward:[],sidebarOpen:typeof window>"u"||window.innerWidth>900,inspectorOpen:typeof window>"u"||window.innerWidth>1180,paletteOpen:!1,theme:cu.get("theme","light"),pinned:cu.get("pinned",[]),viewUi:{},notice:null,live:{state:"off"},activeScene:null,conversation:[],agent:{session:null,listening:!1},jump:null,startOpen:!0,showStart:n=>t({startOpen:n||!e().history}),setLive:n=>t({live:n}),setActiveScene:n=>t({activeScene:n}),setConversation:n=>t({conversation:n}),putMessage(n){const r=e().conversation,s=r.findIndex(i=>i.id===n.id);t({conversation:s<0?[...r,n]:r.map((i,o)=>o===s?n:i)})},setAgent:n=>t({agent:n}),connectOpen:!1,agentPanelOpen:!1,setConnectOpen:n=>t({connectOpen:n}),setAgentPanelOpen:n=>t({agentPanelOpen:n}),liveFile:null,fileOpen:!1,setLiveFile:n=>t({liveFile:n}),setFileOpen:n=>t({fileOpen:n}),project:null,overlays:{},importCodeOpen:!1,projectOpen:!1,setProject:n=>t({project:n}),setOverlays:n=>t({overlays:n}),setImportCodeOpen:n=>t({importCodeOpen:n}),setProjectOpen:n=>t({projectOpen:n}),renaming:null,setRenaming:n=>t({renaming:n}),chips:[],pointing:!1,contextMenu:null,addChip(n){const r=e().chips,s=r.some(i=>n.ref?i.ref===n.ref:i.quote===n.quote);t({chips:s?r:[...r,n]})},removeChip:n=>t({chips:e().chips.filter((r,s)=>s!==n)}),clearChips:()=>t({chips:[]}),takeChips(){const n=e().chips;return n.length&&t({chips:[]}),n},setPointing:n=>t({pointing:n}),openContextMenu:n=>t({contextMenu:n}),jumpTo:n=>t({jump:{scene:n,nonce:Date.now()}}),reviseDocument(n,r){var h,m;const{viewId:s,selection:i,projectId:o}=e();if(n.project.id!==o)return e().loadDocument(n,r);const a=ft(n),l=(h=e().history)==null?void 0:h.present,u=!(!!l&&l.views.length===0&&l.walkthroughs.length===0)&&(s===xt||a.views.has(s)||n.walkthroughs.some(g=>`${Fr}${g.id}`===s)),f=i&&a.exists(i)?i:null;t({startOpen:!1,projects:[...e().projects.filter(g=>g.id!==n.project.id),{id:n.project.id,doc:n,origin:r}],history:iw(n),viewId:u?s:n.walkthroughs[0]?`${Fr}${n.walkthroughs[0].id}`:n.project.defaultView??((m=n.views[0])==null?void 0:m.id)??xt,selection:f,hover:null})},loadDocument(n,r="imported"){var u;const{projects:s,projectId:i,history:o}=e(),l=s.map(f=>f.id===i&&o?{...f,doc:o.present}:f).filter(f=>f.id!==n.project.id),c=n.walkthroughs[0]?`${Fr}${n.walkthroughs[0].id}`:n.project.defaultView??((u=n.views[0])==null?void 0:u.id)??xt;t({startOpen:!1,projects:[...l,{id:n.project.id,doc:n,origin:r}],projectId:n.project.id,history:iw(n),viewId:c,selection:null,hover:null,back:[],forward:[],viewUi:{},focus:null})},keepProject(n,r){t({projects:[...e().projects.filter(s=>s.id!==n.project.id),{id:n.project.id,doc:n,origin:r}]})},switchProject(n){const r=e().projects.find(s=>s.id===n);!r||n===e().projectId||e().loadDocument(r.doc,r.origin)},dispatch(n){try{t({history:GI(e().history,n)})}catch(r){t({notice:r instanceof Error?r.message:String(r)})}},undo:()=>t({history:YI(e().history)}),redo:()=>t({history:QI(e().history)}),navigate(n,r={}){const{viewId:s,selection:i,history:o}=e(),a=ft(o.present);let l=r.select!==void 0?r.select:i;if(l&&n!==xt&&!n.startsWith(Fr)){const u=a.views.get(n);(!u||!a.viewShows(u,l))&&(l=r.select??null)}(n===xt||n.startsWith(Fr))&&(l=r.select??null);const c=s!==n;c&&n.startsWith(Fr)&&typeof window<"u"&&window.innerWidth<1700&&t({sidebarOpen:!1}),t({viewId:n,selection:l,hover:null,back:c?[...e().back,{viewId:s,selection:i}].slice(-50):e().back,forward:c?[]:e().forward,focus:r.focus?Zo(r.focus,l):l?Zo("center",l):null})},goBack(){const{back:n,viewId:r,selection:s}=e(),i=n[n.length-1];i&&t({viewId:i.viewId,selection:i.selection,back:n.slice(0,-1),forward:[{viewId:r,selection:s},...e().forward],focus:i.selection?Zo("center",i.selection):null})},goForward(){const{forward:n,viewId:r,selection:s}=e(),i=n[0];i&&t({viewId:i.viewId,selection:i.selection,forward:n.slice(1),back:[...e().back,{viewId:r,selection:s}],focus:i.selection?Zo("center",i.selection):null})},select(n,r={}){const s=e().selection;n&&s&&de(n)===de(s)&&!r.focus||(t({selection:n,focus:r.focus?Zo(r.focus,n):e().focus}),n&&!e().inspectorOpen&&typeof window<"u"&&window.innerWidth>1180&&t({inspectorOpen:!0}))},setHover(n){const r=e().hover;r===n||r&&n&&de(r)===de(n)||t({hover:n})},requestFocus:(n,r=null)=>t({focus:Zo(n,r)}),toggleSidebar:n=>t({sidebarOpen:n??!e().sidebarOpen}),toggleInspector:n=>t({inspectorOpen:n??!e().inspectorOpen}),setPaletteOpen:n=>t({paletteOpen:n}),toggleTheme(){const n=e().theme==="light"?"dark":"light";cu.set("theme",n),t({theme:n})},togglePin(n){const r=e().pinned.includes(n)?e().pinned.filter(s=>s!==n):[...e().pinned,n];cu.set("pinned",r),t({pinned:r})},updateViewUi(n,r){t({viewUi:{...e().viewUi,[n]:{...e().viewUi[n],...r}}})},notify:n=>t({notice:n})})),f1=()=>T(t=>t.history.present),ze=()=>ft(f1());function Ad(t){const e=T.getState(),n=ft(e.history.present),r=e.viewId!==xt?n.views.get(e.viewId):void 0;if(r&&n.viewShows(r,t)){e.select(t,{focus:"center"});return}const s=n.bestViewFor(t);s?e.navigate(s.id,{select:t,focus:"center"}):e.select(t)}function JL(t,e){T.getState().navigate(t,{select:e??null,focus:e?"center":void 0})}function ve({title:t,count:e,children:n}){return d.jsxs("section",{className:"border-t border-rule px-4 py-3.5 first:border-t-0",children:[d.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-[12px] font-semibold text-ink-3",children:[t,e!==void 0&&d.jsx("span",{className:"font-tabular font-normal text-ink-4",children:e})]}),n]})}function An({items:t}){const e=t.filter(([,n])=>n!==void 0&&n!==""&&n!==null);return e.length?d.jsx("dl",{className:"grid grid-cols-[96px_1fr] gap-x-3 gap-y-1.5 text-[12.5px]",children:e.map(([n,r])=>d.jsxs("div",{className:"contents",children:[d.jsx("dt",{className:"text-ink-3",children:n}),d.jsx("dd",{className:"min-w-0 break-words text-ink",children:r})]},n))}):null}function vt({to:t,label:e,secondary:n,icon:r,tone:s,onClick:i}){return d.jsxs("button",{type:"button",onClick:i??(()=>t&&Ad(t)),className:"group -mx-2 flex w-[calc(100%+16px)] items-start gap-2.5 rounded-md px-2 py-1.5 text-left hover:bg-sunken",children:[r&&d.jsx("span",{className:"mt-[1px] shrink-0",style:{color:s},children:r}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block text-[12.5px] leading-snug text-ink",children:e}),n&&d.jsx("span",{className:"block text-[11.5px] leading-snug text-ink-3",children:n})]}),d.jsx(_d,{size:13,className:"mt-0.5 shrink-0 text-ink-4 opacity-0 transition-opacity group-hover:opacity-100"})]})}function Mt({id:t,secondary:e}){const n=ze(),r=n.entities.get(t);if(!r)return null;const s=n.style(r),i=Md(s.icon);return d.jsx(vt,{to:{kind:"entity",id:t},label:r.name,secondary:e??s.label,icon:d.jsx(i,{size:14}),tone:dt(s.tone)})}function Rd({view:t,select:e,verb:n="Open"}){const r=Yr(t),s=(r==null?void 0:r.icon)??bo;return d.jsxs("button",{type:"button",onClick:()=>JL(t.id,e),className:"group -mx-2 flex w-[calc(100%+16px)] items-center gap-2.5 rounded-md px-2 py-1.5 text-left hover:bg-sunken",children:[d.jsx(s,{size:14,className:"shrink-0 text-ink-3"}),d.jsxs("span",{className:"min-w-0 flex-1 text-[12.5px] text-ink",children:[n," ",t.title.charAt(0).toLowerCase()+t.title.slice(1)]}),d.jsx(Ff,{size:13,className:"shrink-0 text-ink-4 group-hover:text-poney"})]})}function $$({refs:t}){return t.length?d.jsx(ve,{title:"In the code",count:t.length,children:d.jsx("ul",{className:"space-y-1",children:t.map((e,n)=>d.jsxs("li",{className:"flex items-start gap-2 text-[12px]",children:[d.jsx(yp,{size:13,className:"mt-0.5 shrink-0 text-ink-3"}),d.jsxs("span",{className:"min-w-0",children:[d.jsxs("code",{className:"block break-all font-mono text-[11.5px] text-ink",children:[e.path,e.line?`:${e.line}`:""]}),e.symbol&&d.jsx("span",{className:"text-ink-3",children:e.symbol})]})]},n))})}):null}function Bt({children:t}){return d.jsx("p",{className:"text-[13px] leading-relaxed text-ink-2",children:t})}function GL({items:t}){return t.length?d.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map(e=>d.jsx("span",{className:"rounded-md bg-sunken px-1.5 py-0.5 text-[11.5px] text-ink-2",children:e},e))}):null}const YL={core:wp,diagrams:[VL],layouts:{"ownership/team-map":FL},inspector:[{id:"ownership",title:"Ownership",render({ref:t,doc:e,idx:n}){if(t.kind!=="entity")return null;const r=n.entities.get(t.id);if(!r)return null;if(r.kind===Hf){const o=Ka(r),a=E$(e,r.id);return d.jsxs("div",{children:[d.jsx(An,{items:[["On call",(o==null?void 0:o.oncall)&&d.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[d.jsx(zD,{size:12,className:"text-ink-3"}),o.oncall]})],["Channel",(o==null?void 0:o.channel)&&d.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[d.jsx(xD,{size:12,className:"text-ink-3"}),o.channel.replace(/^#/,"")]})]]}),d.jsxs("p",{className:"mb-1 mt-3 text-[11.5px] text-ink-3",children:["Owns ",a.length]}),a.map(l=>d.jsx(Mt,{id:l.id},l.id))]})}const s=LL(e,r);if(!s)return null;const i=Ka(s);return d.jsxs("div",{children:[d.jsx(Mt,{id:s.id,secondary:"Owning team"}),d.jsx("div",{className:"mt-2",children:d.jsx(An,{items:[["On call",i==null?void 0:i.oncall],["Channel",i==null?void 0:i.channel]]})})]})}}]};var He;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(He||(He={}));var Fw;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Fw||(Fw={}));const me=He.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),qs=t=>{switch(typeof t){case"undefined":return me.undefined;case"string":return me.string;case"number":return Number.isNaN(t)?me.nan:me.number;case"boolean":return me.boolean;case"function":return me.function;case"bigint":return me.bigint;case"symbol":return me.symbol;case"object":return Array.isArray(t)?me.array:t===null?me.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?me.promise:typeof Map<"u"&&t instanceof Map?me.map:typeof Set<"u"&&t instanceof Set?me.set:typeof Date<"u"&&t instanceof Date?me.date:me.object;default:return me.unknown}},te=He.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Os extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),r}static assert(e){if(!(e instanceof Os))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,He.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Os.create=t=>new Os(t);const Ky=(t,e)=>{let n;switch(t.code){case te.invalid_type:t.received===me.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case te.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,He.jsonStringifyReplacer)}`;break;case te.unrecognized_keys:n=`Unrecognized key(s) in object: ${He.joinValues(t.keys,", ")}`;break;case te.invalid_union:n="Invalid input";break;case te.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${He.joinValues(t.options)}`;break;case te.invalid_enum_value:n=`Invalid enum value. Expected ${He.joinValues(t.options)}, received '${t.received}'`;break;case te.invalid_arguments:n="Invalid function arguments";break;case te.invalid_return_type:n="Invalid function return type";break;case te.invalid_date:n="Invalid date";break;case te.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:He.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case te.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case te.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case te.custom:n="Invalid input";break;case te.invalid_intersection_types:n="Intersection results could not be merged";break;case te.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case te.not_finite:n="Number must be finite";break;default:n=e.defaultError,He.assertNever(t)}return{message:n}};let QL=Ky;function XL(){return QL}const e6=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function ae(t,e){const n=XL(),r=e6({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Ky?void 0:Ky].filter(s=>!!s)});t.common.issues.push(r)}class qn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return Ee;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return qn.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return Ee;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const Ee=Object.freeze({status:"aborted"}),Ql=t=>({status:"dirty",value:t}),fr=t=>({status:"valid",value:t}),Bw=t=>t.status==="aborted",Vw=t=>t.status==="dirty",Ja=t=>t.status==="valid",qf=t=>typeof Promise<"u"&&t instanceof Promise;var xe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(xe||(xe={}));class $i{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ww=(t,e)=>{if(Ja(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Os(t.common.issues);return this._error=n,this._error}}};function Ie(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}class Ue{get description(){return this._def.description}_getType(e){return qs(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:qs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new qn,ctx:{common:e.parent.common,data:e.data,parsedType:qs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(qf(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qs(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Ww(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qs(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return Ja(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>Ja(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qs(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(qf(s)?s:Promise.resolve(s));return Ww(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:te.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new Ya({schema:this,typeName:Me.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return mi.create(this,this._def)}nullable(){return Qa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Kr.create(this)}promise(){return Yf.create(this,this._def)}or(e){return Jf.create([this,e],this._def)}and(e){return Gf.create(this,e,this._def)}transform(e){return new Ya({...Ie(this._def),schema:this,typeName:Me.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Yy({...Ie(this._def),innerType:this,defaultValue:n,typeName:Me.ZodDefault})}brand(){return new S6({typeName:Me.ZodBranded,type:this,...Ie(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Qy({...Ie(this._def),innerType:this,catchValue:n,typeName:Me.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return h1.create(this,e)}readonly(){return Xy.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const t6=/^c[^\s-]{8,}$/i,n6=/^[0-9a-z]+$/,r6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,s6=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,i6=/^[a-z0-9_-]{21}$/i,o6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,a6=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,l6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,c6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Om;const d6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,u6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,f6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,h6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,p6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,m6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,M$="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",g6=new RegExp(`^${M$}$`);function T$(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function y6(t){return new RegExp(`^${T$(t)}$`)}function x6(t){let e=`${M$}T${T$(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function v6(t,e){return!!((e==="v4"||!e)&&d6.test(t)||(e==="v6"||!e)&&f6.test(t))}function k6(t,e){if(!o6.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function w6(t,e){return!!((e==="v4"||!e)&&u6.test(t)||(e==="v6"||!e)&&h6.test(t))}class ri extends Ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==me.string){const i=this._getOrReturnCtx(e);return ae(i,{code:te.invalid_type,expected:me.string,received:i.parsedType}),Ee}const r=new qn;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),ae(s,{code:te.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),ae(s,{code:te.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?ae(s,{code:te.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&ae(s,{code:te.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")l6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"email",code:te.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Om||(Om=new RegExp(c6,"u")),Om.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"emoji",code:te.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")s6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"uuid",code:te.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")i6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"nanoid",code:te.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")t6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"cuid",code:te.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")n6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"cuid2",code:te.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")r6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"ulid",code:te.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),ae(s,{validation:"url",code:te.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"regex",code:te.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),ae(s,{code:te.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),ae(s,{code:te.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),ae(s,{code:te.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?x6(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{code:te.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?g6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{code:te.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?y6(i).test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{code:te.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?a6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"duration",code:te.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?v6(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"ip",code:te.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?k6(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"jwt",code:te.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?w6(e.data,i.version)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"cidr",code:te.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?p6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"base64",code:te.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?m6.test(e.data)||(s=this._getOrReturnCtx(e,s),ae(s,{validation:"base64url",code:te.invalid_string,message:i.message}),r.dirty()):He.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:te.invalid_string,...xe.errToObj(r)})}_addCheck(e){return new ri({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...xe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...xe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...xe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...xe.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...xe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...xe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...xe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...xe.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...xe.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...xe.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...xe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...xe.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...xe.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...xe.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...xe.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...xe.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...xe.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...xe.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...xe.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...xe.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...xe.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...xe.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...xe.errToObj(n)})}nonempty(e){return this.min(1,xe.errToObj(e))}trim(){return new ri({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ri({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ri({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}ri.create=t=>new ri({checks:[],typeName:Me.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Ie(t)});function b6(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}class qc extends Ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==me.number){const i=this._getOrReturnCtx(e);return ae(i,{code:te.invalid_type,expected:me.number,received:i.parsedType}),Ee}let r;const s=new qn;for(const i of this._def.checks)i.kind==="int"?He.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ae(r,{code:te.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ae(r,{code:te.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ae(r,{code:te.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?b6(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),ae(r,{code:te.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ae(r,{code:te.not_finite,message:i.message}),s.dirty()):He.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,xe.toString(n))}gt(e,n){return this.setLimit("min",e,!1,xe.toString(n))}lte(e,n){return this.setLimit("max",e,!0,xe.toString(n))}lt(e,n){return this.setLimit("max",e,!1,xe.toString(n))}setLimit(e,n,r,s){return new qc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:xe.toString(s)}]})}_addCheck(e){return new qc({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:xe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:xe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:xe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:xe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:xe.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:xe.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:xe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:xe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:xe.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&He.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}qc.create=t=>new qc({checks:[],typeName:Me.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Ie(t)});class Kc extends Ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==me.bigint)return this._getInvalidInput(e);let r;const s=new qn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),ae(r,{code:te.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ae(r,{code:te.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ae(r,{code:te.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):He.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return ae(n,{code:te.invalid_type,expected:me.bigint,received:n.parsedType}),Ee}gte(e,n){return this.setLimit("min",e,!0,xe.toString(n))}gt(e,n){return this.setLimit("min",e,!1,xe.toString(n))}lte(e,n){return this.setLimit("max",e,!0,xe.toString(n))}lt(e,n){return this.setLimit("max",e,!1,xe.toString(n))}setLimit(e,n,r,s){return new Kc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:xe.toString(s)}]})}_addCheck(e){return new Kc({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:xe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:xe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:xe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:xe.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:xe.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Kc.create=t=>new Kc({checks:[],typeName:Me.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Ie(t)});class Jy extends Ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==me.boolean){const r=this._getOrReturnCtx(e);return ae(r,{code:te.invalid_type,expected:me.boolean,received:r.parsedType}),Ee}return fr(e.data)}}Jy.create=t=>new Jy({typeName:Me.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Ie(t)});class Kf extends Ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==me.date){const i=this._getOrReturnCtx(e);return ae(i,{code:te.invalid_type,expected:me.date,received:i.parsedType}),Ee}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return ae(i,{code:te.invalid_date}),Ee}const r=new qn;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),ae(s,{code:te.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),ae(s,{code:te.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):He.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kf({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:xe.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:xe.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Kf.create=t=>new Kf({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Me.ZodDate,...Ie(t)});class Uw extends Ue{_parse(e){if(this._getType(e)!==me.symbol){const r=this._getOrReturnCtx(e);return ae(r,{code:te.invalid_type,expected:me.symbol,received:r.parsedType}),Ee}return fr(e.data)}}Uw.create=t=>new Uw({typeName:Me.ZodSymbol,...Ie(t)});class Zw extends Ue{_parse(e){if(this._getType(e)!==me.undefined){const r=this._getOrReturnCtx(e);return ae(r,{code:te.invalid_type,expected:me.undefined,received:r.parsedType}),Ee}return fr(e.data)}}Zw.create=t=>new Zw({typeName:Me.ZodUndefined,...Ie(t)});class Hw extends Ue{_parse(e){if(this._getType(e)!==me.null){const r=this._getOrReturnCtx(e);return ae(r,{code:te.invalid_type,expected:me.null,received:r.parsedType}),Ee}return fr(e.data)}}Hw.create=t=>new Hw({typeName:Me.ZodNull,...Ie(t)});class qw extends Ue{constructor(){super(...arguments),this._any=!0}_parse(e){return fr(e.data)}}qw.create=t=>new qw({typeName:Me.ZodAny,...Ie(t)});class Kw extends Ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return fr(e.data)}}Kw.create=t=>new Kw({typeName:Me.ZodUnknown,...Ie(t)});class Mi extends Ue{_parse(e){const n=this._getOrReturnCtx(e);return ae(n,{code:te.invalid_type,expected:me.never,received:n.parsedType}),Ee}}Mi.create=t=>new Mi({typeName:Me.ZodNever,...Ie(t)});class Jw extends Ue{_parse(e){if(this._getType(e)!==me.undefined){const r=this._getOrReturnCtx(e);return ae(r,{code:te.invalid_type,expected:me.void,received:r.parsedType}),Ee}return fr(e.data)}}Jw.create=t=>new Jw({typeName:Me.ZodVoid,...Ie(t)});class Kr extends Ue{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==me.array)return ae(n,{code:te.invalid_type,expected:me.array,received:n.parsedType}),Ee;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(ae(n,{code:o?te.too_big:te.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(ae(n,{code:te.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(ae(n,{code:te.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new $i(n,o,n.path,a)))).then(o=>qn.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new $i(n,o,n.path,a)));return qn.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Kr({...this._def,minLength:{value:e,message:xe.toString(n)}})}max(e,n){return new Kr({...this._def,maxLength:{value:e,message:xe.toString(n)}})}length(e,n){return new Kr({...this._def,exactLength:{value:e,message:xe.toString(n)}})}nonempty(e){return this.min(1,e)}}Kr.create=(t,e)=>new Kr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Me.ZodArray,...Ie(e)});function ea(t){if(t instanceof wt){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=mi.create(ea(r))}return new wt({...t._def,shape:()=>e})}else return t instanceof Kr?new Kr({...t._def,type:ea(t.element)}):t instanceof mi?mi.create(ea(t.unwrap())):t instanceof Qa?Qa.create(ea(t.unwrap())):t instanceof Co?Co.create(t.items.map(e=>ea(e))):t}class wt extends Ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=He.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==me.object){const c=this._getOrReturnCtx(e);return ae(c,{code:te.invalid_type,expected:me.object,received:c.parsedType}),Ee}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Mi&&this._def.unknownKeys==="strip"))for(const c in s.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=i[c],f=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new $i(s,f,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Mi){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")a.length>0&&(ae(s,{code:te.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const f=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new $i(s,f,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const f=await u.key,h=await u.value;c.push({key:f,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>qn.mergeObjectSync(r,c)):qn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return xe.errToObj,new wt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:xe.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new wt({...this._def,unknownKeys:"strip"})}passthrough(){return new wt({...this._def,unknownKeys:"passthrough"})}extend(e){return new wt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new wt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Me.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new wt({...this._def,catchall:e})}pick(e){const n={};for(const r of He.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new wt({...this._def,shape:()=>n})}omit(e){const n={};for(const r of He.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new wt({...this._def,shape:()=>n})}deepPartial(){return ea(this)}partial(e){const n={};for(const r of He.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new wt({...this._def,shape:()=>n})}required(e){const n={};for(const r of He.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof mi;)i=i._def.innerType;n[r]=i}return new wt({...this._def,shape:()=>n})}keyof(){return O$(He.objectKeys(this.shape))}}wt.create=(t,e)=>new wt({shape:()=>t,unknownKeys:"strip",catchall:Mi.create(),typeName:Me.ZodObject,...Ie(e)});wt.strictCreate=(t,e)=>new wt({shape:()=>t,unknownKeys:"strict",catchall:Mi.create(),typeName:Me.ZodObject,...Ie(e)});wt.lazycreate=(t,e)=>new wt({shape:t,unknownKeys:"strip",catchall:Mi.create(),typeName:Me.ZodObject,...Ie(e)});class Jf extends Ue{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Os(a.ctx.common.issues));return ae(n,{code:te.invalid_union,unionErrors:o}),Ee}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new Os(l));return ae(n,{code:te.invalid_union,unionErrors:a}),Ee}}get options(){return this._def.options}}Jf.create=(t,e)=>new Jf({options:t,typeName:Me.ZodUnion,...Ie(e)});function Gy(t,e){const n=qs(t),r=qs(e);if(t===e)return{valid:!0,data:t};if(n===me.object&&r===me.object){const s=He.objectKeys(e),i=He.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const l=Gy(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===me.array&&r===me.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],l=Gy(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===me.date&&r===me.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Gf extends Ue{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Bw(i)||Bw(o))return Ee;const a=Gy(i.value,o.value);return a.valid?((Vw(i)||Vw(o))&&n.dirty(),{status:n.value,value:a.data}):(ae(r,{code:te.invalid_intersection_types}),Ee)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Gf.create=(t,e,n)=>new Gf({left:t,right:e,typeName:Me.ZodIntersection,...Ie(n)});class Co extends Ue{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==me.array)return ae(r,{code:te.invalid_type,expected:me.array,received:r.parsedType}),Ee;if(r.data.length<this._def.items.length)return ae(r,{code:te.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ee;!this._def.rest&&r.data.length>this._def.items.length&&(ae(r,{code:te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new $i(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>qn.mergeArray(n,o)):qn.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new Co({...this._def,rest:e})}}Co.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Co({items:t,typeName:Me.ZodTuple,rest:null,...Ie(e)})};class Gw extends Ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==me.map)return ae(r,{code:te.invalid_type,expected:me.map,received:r.parsedType}),Ee;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new $i(r,a,r.path,[c,"key"])),value:i._parse(new $i(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Ee;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Ee;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Gw.create=(t,e,n)=>new Gw({valueType:e,keyType:t,typeName:Me.ZodMap,...Ie(n)});class Jc extends Ue{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==me.set)return ae(r,{code:te.invalid_type,expected:me.set,received:r.parsedType}),Ee;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(ae(r,{code:te.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(ae(r,{code:te.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Ee;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new $i(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new Jc({...this._def,minSize:{value:e,message:xe.toString(n)}})}max(e,n){return new Jc({...this._def,maxSize:{value:e,message:xe.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Jc.create=(t,e)=>new Jc({valueType:t,minSize:null,maxSize:null,typeName:Me.ZodSet,...Ie(e)});class Yw extends Ue{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Yw.create=(t,e)=>new Yw({getter:t,typeName:Me.ZodLazy,...Ie(e)});class Qw extends Ue{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ae(n,{received:n.data,code:te.invalid_literal,expected:this._def.value}),Ee}return{status:"valid",value:e.data}}get value(){return this._def.value}}Qw.create=(t,e)=>new Qw({value:t,typeName:Me.ZodLiteral,...Ie(e)});function O$(t,e){return new Ga({values:t,typeName:Me.ZodEnum,...Ie(e)})}class Ga extends Ue{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return ae(n,{expected:He.joinValues(r),received:n.parsedType,code:te.invalid_type}),Ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return ae(n,{received:n.data,code:te.invalid_enum_value,options:r}),Ee}return fr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Ga.create(e,{...this._def,...n})}exclude(e,n=this._def){return Ga.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Ga.create=O$;class Xw extends Ue{_parse(e){const n=He.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==me.string&&r.parsedType!==me.number){const s=He.objectValues(n);return ae(r,{expected:He.joinValues(s),received:r.parsedType,code:te.invalid_type}),Ee}if(this._cache||(this._cache=new Set(He.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=He.objectValues(n);return ae(r,{received:r.data,code:te.invalid_enum_value,options:s}),Ee}return fr(e.data)}get enum(){return this._def.values}}Xw.create=(t,e)=>new Xw({values:t,typeName:Me.ZodNativeEnum,...Ie(e)});class Yf extends Ue{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==me.promise&&n.common.async===!1)return ae(n,{code:te.invalid_type,expected:me.promise,received:n.parsedType}),Ee;const r=n.parsedType===me.promise?n.data:Promise.resolve(n.data);return fr(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Yf.create=(t,e)=>new Yf({type:t,typeName:Me.ZodPromise,...Ie(e)});class Ya extends Ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Me.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{ae(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Ee;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Ee:l.status==="dirty"||n.value==="dirty"?Ql(l.value):l});{if(n.value==="aborted")return Ee;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Ee:a.status==="dirty"||n.value==="dirty"?Ql(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ja(o))return Ee;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Ja(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):Ee);He.assertNever(s)}}Ya.create=(t,e,n)=>new Ya({schema:t,typeName:Me.ZodEffects,effect:e,...Ie(n)});Ya.createWithPreprocess=(t,e,n)=>new Ya({schema:e,effect:{type:"preprocess",transform:t},typeName:Me.ZodEffects,...Ie(n)});class mi extends Ue{_parse(e){return this._getType(e)===me.undefined?fr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}mi.create=(t,e)=>new mi({innerType:t,typeName:Me.ZodOptional,...Ie(e)});class Qa extends Ue{_parse(e){return this._getType(e)===me.null?fr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Qa.create=(t,e)=>new Qa({innerType:t,typeName:Me.ZodNullable,...Ie(e)});class Yy extends Ue{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===me.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Yy.create=(t,e)=>new Yy({innerType:t,typeName:Me.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ie(e)});class Qy extends Ue{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return qf(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Os(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Os(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Qy.create=(t,e)=>new Qy({innerType:t,typeName:Me.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ie(e)});class eb extends Ue{_parse(e){if(this._getType(e)!==me.nan){const r=this._getOrReturnCtx(e);return ae(r,{code:te.invalid_type,expected:me.nan,received:r.parsedType}),Ee}return{status:"valid",value:e.data}}}eb.create=t=>new eb({typeName:Me.ZodNaN,...Ie(t)});class S6 extends Ue{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class h1 extends Ue{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ee:i.status==="dirty"?(n.dirty(),Ql(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ee:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new h1({in:e,out:n,typeName:Me.ZodPipeline})}}class Xy extends Ue{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Ja(s)&&(s.value=Object.freeze(s.value)),s);return qf(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Xy.create=(t,e)=>new Xy({innerType:t,typeName:Me.ZodReadonly,...Ie(e)});var Me;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Me||(Me={}));const j6=ri.create,C6=Jy.create;Mi.create;const _6=Kr.create,p1=wt.create;Jf.create;Gf.create;Co.create;const A$=Ga.create;Yf.create;mi.create;Qa.create;const N6=A$(["personal","secret","payment","health"]),Qf={personal:"Personal data",secret:"Secrets",payment:"Payment data",health:"Health data"},E6=A$(["public","internal","restricted"]),$6=p1({zone:se.optional(),trust:E6.optional()}).strict(),M6=p1({classes:_6(N6).min(1)}).strict(),T6=p1({encrypted:C6().optional(),auth:j6().min(1).optional()}).strict(),Gc="security/zone",xs={name:"security",version:"0.1.0",description:"Trust zones, sensitive data, and how connections are protected.",entityKinds:{zone:{label:"Trust zone",description:"Where parts trust each other. A line between zones crosses a trust boundary."}},facets:{entity:$6,dataType:M6,relationship:T6},validate(t,{index:e,report:n}){t.model.entities.forEach((r,s)=>{var a;const i=(a=Wr(xs,"entity",r))==null?void 0:a.zone;if(!i)return;const o=e.entities.get(i);o?o.kind!==Gc&&n(`model.entities.${s}.ext.security.zone`,`"${i}" is not a zone (kind "${Gc}")`):n(`model.entities.${s}.ext.security.zone`,`Unknown zone "${i}"`)})},lint(t,{warn:e}){var n,r;for(const s of I$(t)){if(!s.classes.length)continue;const i=s.classes.map(a=>Qf[a].toLowerCase()).join(" and "),o=`from ${s.from.name} to ${s.to.name}`;((n=s.protection)==null?void 0:n.encrypted)!==!0&&e(`model.relationships.${s.index}`,"security-unencrypted-crossing",`"${s.relationship.label}" carries ${i} ${o} without encryption.`,"If it is encrypted (TLS counts), set ext.security.encrypted to true on the relationship. If not, the data should not cross this boundary as it is."),(r=s.protection)!=null&&r.auth||e(`model.relationships.${s.index}`,"security-unknown-auth",`"${s.relationship.label}" carries ${i} ${o}, and the document does not say how the caller is authenticated.`,'Set ext.security.auth on the relationship, e.g. "mTLS", "OAuth token" or "none".')}t.model.relationships.forEach((s,i)=>{var c,u;const o=(c=Wr(xs,"relationship",s))==null?void 0:c.auth,a=t.model.entities.find(f=>f.id===s.target),l=Xa(t,a);(o==null?void 0:o.toLowerCase())==="none"&&l&&((u=Wr(xs,"entity",l))==null?void 0:u.trust)==="restricted"&&e(`model.relationships.${i}`,"security-open-restricted",`"${s.label}" reaches the restricted zone ${l.name} with no authentication.`,"Name the authentication, or say why this part of a restricted zone is open.")}),t.model.dataTypes.forEach((s,i)=>{var l;if(!Xf(s).length||!s.storedIn)return;const o=t.model.entities.find(c=>c.id===s.storedIn),a=Xa(t,o);a&&((l=Wr(xs,"entity",a))==null?void 0:l.trust)==="public"&&e(`model.dataTypes.${i}`,"security-sensitive-in-public",`${s.name} holds ${Xf(s).map(c=>Qf[c].toLowerCase()).join(" and ")}, and is stored in ${o.name}, in the public zone ${a.name}.`,"Move the store to a zone that is not public, or check that the zone is right.")})}};function Xa(t,e){var s;const n=new Map(t.model.entities.map(i=>[i.id,i])),r=new Set;for(let i=e;i&&!r.has(i.id);i=i.parent?n.get(i.parent):void 0){if(r.add(i.id),i.kind===Gc)return i;const o=(s=Wr(xs,"entity",i))==null?void 0:s.zone;if(o)return n.get(o)}}const Xf=t=>{var e;return((e=Wr(xs,"dataType",t))==null?void 0:e.classes)??[]},R$=t=>Wr(xs,"relationship",t);function I$(t){const e=new Map(t.model.entities.map(s=>[s.id,s])),n=new Map(t.model.dataTypes.map(s=>[s.id,s])),r=[];return t.model.relationships.forEach((s,i)=>{const o=e.get(s.source),a=e.get(s.target),l=Xa(t,o),c=Xa(t,a);if(!o||!a||!l||!c||l.id===c.id)return;const u=new Set([...s.data,...t.model.dataFlows.filter(h=>h.via===s.id).flatMap(h=>h.data)]),f=[...new Set([...u].flatMap(h=>Xf(n.get(h))))];r.push({index:i,relationship:s,from:o,to:a,fromZone:l,toZone:c,classes:f,protection:R$(s)})}),r}function O6(t,e){return t.model.entities.filter(n=>{var r;return n.id!==e&&n.kind!==Gc&&((r=Xa(t,n))==null?void 0:r.id)===e})}const A6={public:"Public: anyone can reach it",internal:"Internal",restricted:"Restricted"},R6=(t,e,n)=>t===void 0?"Not stated":t?e:n,I6={core:xs,inspector:[{id:"security",title:"Security",render({ref:t,doc:e,idx:n}){var r;if(!e.extensions.some(s=>s.name==="security"))return null;if(t.kind==="entity"){const s=n.entities.get(t.id);if(!s)return null;if(s.kind===Gc){const o=(r=Wr(xs,"entity",s))==null?void 0:r.trust,a=O6(e,s.id);return d.jsxs("div",{children:[d.jsx(An,{items:[["Trust",o&&A6[o]]]}),d.jsxs("p",{className:"mb-1 mt-3 text-[11.5px] text-ink-3",children:["In this zone: ",a.length]}),a.map(l=>d.jsx(Mt,{id:l.id},l.id))]})}const i=Xa(e,s);return i?d.jsx(Mt,{id:i.id,secondary:"Trust zone"}):null}if(t.kind==="relationship"){const s=I$(e).find(o=>o.relationship.id===t.id),i=R$(n.relationships.get(t.id));return!s&&!i?null:d.jsx(An,{items:[["Crosses",s&&`${s.fromZone.name} → ${s.toZone.name}`],["Carries",s!=null&&s.classes.length?s.classes.map(o=>Qf[o]).join(", "):void 0],["Encrypted",R6(i==null?void 0:i.encrypted,"Yes","No")],["Auth",(i==null?void 0:i.auth)??"Not stated"]]})}if(t.kind==="dataType"){const s=Xf(n.dataTypes.get(t.id));return s.length?d.jsx(An,{items:[["Sensitive",s.map(i=>Qf[i]).join(", ")]]}):null}return null}}]};var P6=Object.defineProperty,bl=(t,e)=>P6(t,"name",{value:e,configurable:!0}),P$=!!(typeof window<"u"&&window.document&&window.document.createElement);function _n(t,e,{checkForDefaultPrevented:n=!0}={}){return bl(function(s){if(t==null||t(s),n===!1||!s||!s.defaultPrevented)return e==null?void 0:e(s)},"handleEvent")}bl(_n,"composeEventHandlers");function D6(t){var e;if(!P$)throw new Error("Cannot access window outside of the DOM");return((e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)??window}bl(D6,"getOwnerWindow");function ex(t){if(!P$)throw new Error("Cannot access document outside of the DOM");return(t==null?void 0:t.ownerDocument)??document}bl(ex,"getOwnerDocument");function D$(t,e=!1){const{activeElement:n}=ex(t);if(!(n!=null&&n.nodeName))return null;if(z$(n)&&n.contentDocument)return D$(n.contentDocument.body,e);if(e){const r=n.getAttribute("aria-activedescendant");if(r){const s=ex(n).getElementById(r);if(s)return s}}return n}bl(D$,"getActiveElement");function z$(t){return t.tagName==="IFRAME"}bl(z$,"isFrame");var z6=Object.defineProperty,m1=(t,e)=>z6(t,"name",{value:e,configurable:!0});function tx(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}m1(tx,"setRef");function _o(...t){return e=>{let n=!1;const r=t.map(s=>{const i=tx(s,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():tx(t[s],null)}}}}m1(_o,"composeRefs");function Tr(...t){return b.useCallback(_o(...t),t)}m1(Tr,"useComposedRefs");var L6=Object.defineProperty,rr=(t,e)=>L6(t,"name",{value:e,configurable:!0});function F6(t,e){const n=b.createContext(e);n.displayName=t+"Context";const r=rr(i=>{const{children:o,...a}=i,l=b.useMemo(()=>a,Object.values(a));return d.jsx(n.Provider,{value:l,children:o})},"Provider");r.displayName=t+"Provider";function s(i,o={}){const{optional:a=!1}=o,l=b.useContext(n);if(l)return l;if(e!==void 0)return e;if(!a)throw new Error(`\`${i}\` must be used within \`${t}\``)}return rr(s,"useContext"),[r,s]}rr(F6,"createContext");function Sp(t,e=[]){let n=[];function r(i,o){const a=b.createContext(o);a.displayName=i+"Context";const l=n.length;n=[...n,o];const c=rr(f=>{var y;const{scope:h,children:m,...g}=f,p=((y=h==null?void 0:h[t])==null?void 0:y[l])||a,x=b.useMemo(()=>g,Object.values(g));return d.jsx(p.Provider,{value:x,children:m})},"Provider");c.displayName=i+"Provider";function u(f,h,m={}){var y;const{optional:g=!1}=m,p=((y=h==null?void 0:h[t])==null?void 0:y[l])||a,x=b.useContext(p);if(x)return x;if(o!==void 0)return o;if(!g)throw new Error(`\`${f}\` must be used within \`${i}\``)}return rr(u,"useContext"),[c,u]}rr(r,"createContext");const s=rr(()=>{const i=n.map(o=>b.createContext(o));return rr(function(a){const l=(a==null?void 0:a[t])||i;return b.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])},"useScope")},"createScope");return s.scopeName=t,[r,L$(s,...e)]}rr(Sp,"createContextScope");function L$(...t){const e=t[0];if(t.length===1)return e;const n=rr(()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return rr(function(i){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}rr(L$,"composeContextScopes");var B6=Object.defineProperty,Gn=(t,e)=>B6(t,"name",{value:e,configurable:!0});function g1(t){const e=b.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const l=[];s=H$(s),b.Children.forEach(s,h=>{var m;if(U$(h)){a=!0;const g=h;let p="child"in g.props?g.props.child:g.props.children;for(;y1(p)&&typeof eh=="function";)p=eh(p._payload);o=V6(g,p),l.push((m=o==null?void 0:o.props)==null?void 0:m.children)}else l.push(h)}),o?o=b.cloneElement(o,void 0,l):!a&&b.Children.count(s)===1&&b.isValidElement(s)&&(o=s);const c=o?W$(o):void 0,u=Tr(r,c);if(!o){if(s||s===0)throw new Error(a?Z6(t):U6(t));return s}const f=V$(i,o.props??{});return o.type!==b.Fragment&&(f.ref=r?u:c),b.cloneElement(o,f)});return e.displayName=`${t}.Slot`,e}Gn(g1,"createSlot");var F$=Symbol.for("radix.slottable");function B$(t){const e=Gn(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=F$,e}Gn(B$,"createSlottable");var V6=Gn((t,e)=>"child"in t.props?b.isValidElement(e)?b.cloneElement(e,void 0,t.props.children(e.props.children)):null:b.isValidElement(e)?e:null,"getSlottableElementFromSlottable");function V$(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{const l=i(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"?n[r]=[s,i].filter(Boolean).join(" "):r==="aria-describedby"&&(n[r]=q$(i,s))}return{...t,...n}}Gn(V$,"mergeProps");function W$(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}Gn(W$,"getElementRef");function U$(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===F$}Gn(U$,"isSlottable");var W6=Symbol.for("react.lazy");function y1(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===W6&&"_payload"in t&&Z$(t._payload)}Gn(y1,"isLazyComponent");function Z$(t){return typeof t=="object"&&t!==null&&"then"in t}Gn(Z$,"isPromiseLike");function H$(t){let e=t;for(;y1(e)&&typeof eh=="function";)e=eh(e._payload);return e}Gn(H$,"useUnwrappedLazy");function q$(...t){const e=new Set;for(const n of t)if(typeof n=="string")for(const r of String(n).trim().split(/\s+/))r&&e.add(r);return e.size>0?Array.from(e).join(" "):void 0}Gn(q$,"concatAriaDescribedby");var U6=Gn(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Z6=Gn(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),eh=pl[" use ".trim().toString()],H6=Object.defineProperty,q6=(t,e)=>H6(t,"name",{value:e,configurable:!0}),K6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ot=K6.reduce((t,e)=>{const n=g1(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:o,...a}=s,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function K$(t,e){t&&kd.flushSync(()=>t.dispatchEvent(e))}q6(K$,"dispatchDiscreteCustomEvent");var Rn=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},J6=Object.defineProperty,G6=(t,e)=>J6(t,"name",{value:e,configurable:!0}),tb=pl[" useInsertionEffect ".trim().toString()];function No(t){const e=b.useRef(t);return typeof tb=="function"?tb(()=>{e.current=t}):Rn(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}G6(No,"useCallbackRef");var Y6=Object.defineProperty,Pt=(t,e)=>Y6(t,"name",{value:e,configurable:!0}),nx="dismissableLayer.update",Q6="dismissableLayer.pointerDownOutside",X6="dismissableLayer.focusOutside",nb,J$=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),G$=b.forwardRef(Pt(function(e,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...u}=e,f=b.useContext(J$),[h,m]=b.useState(null),g=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=b.useState({}),x=Tr(n,m),y=Array.from(f.layers),[v]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),k=v?y.indexOf(v):-1,w=h?y.indexOf(h):-1,j=f.layersWithOutsidePointerEventsDisabled.size>0,C=w>=k,E=b.useRef(!1),S=Q$(P=>{o==null||o(P),l==null||l(P),P.defaultPrevented||c==null||c()},{ownerDocument:g,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:E,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:b.useCallback(P=>{if(!(P instanceof Node))return!1;const V=[...f.branches].some(Z=>Z.contains(P));return C&&!V},[f.branches,C])}),_=X$(P=>{if(s&&E.current)return;const V=P.target;[...f.branches].some(Y=>Y.contains(V))||(a==null||a(P),l==null||l(P),P.defaultPrevented||c==null||c())},g),N=h?w===y.length-1:!1,M=No(P=>{P.key==="Escape"&&(i==null||i(P),!P.defaultPrevented&&c&&(P.preventDefault(),c()))});return b.useEffect(()=>{if(N)return g.addEventListener("keydown",M,{capture:!0}),()=>g.removeEventListener("keydown",M,{capture:!0})},[g,N,M]),b.useEffect(()=>{if(h)return r&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(nb=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(h)),f.layers.add(h),rx(),()=>{r&&(f.layersWithOutsidePointerEventsDisabled.delete(h),f.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=nb))}},[h,g,r,f]),b.useEffect(()=>()=>{h&&(f.layers.delete(h),f.layersWithOutsidePointerEventsDisabled.delete(h),rx())},[h,f]),b.useEffect(()=>{const P=Pt(()=>p({}),"handleUpdate");return document.addEventListener(nx,P),()=>document.removeEventListener(nx,P)},[]),d.jsx(Ot.div,{...u,ref:x,style:{pointerEvents:j?C?"auto":"none":void 0,...e.style},onFocusCapture:_n(e.onFocusCapture,_.onFocusCapture),onBlurCapture:_n(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:_n(e.onPointerDownCapture,S.onPointerDownCapture)})},"DismissableLayer"));function Y$(){const t=b.useContext(J$),[e,n]=b.useState(null);return b.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}Pt(Y$,"useDismissableLayerSurface");var e8=Pt(()=>!0,"IS_TRUE");function Q$(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i,shouldHandlePointerDownOutside:o=e8}=e,a=No(t),l=b.useRef(!1),c=b.useRef(!1),u=b.useRef(new Map),f=b.useRef(()=>{});return b.useEffect(()=>{function h(){c.current=!1,s.current=!1,u.current.clear()}Pt(h,"resetOutsideInteraction");function m(){return Array.from(u.current.values()).some(Boolean)}Pt(m,"isOutsideInteractionIntercepted");function g(k){if(!c.current)return;const w=k.target;w instanceof Node&&[...i].some(C=>C.contains(w))||u.current.set(k.type,!0),k.type==="click"&&window.setTimeout(()=>{c.current&&f.current()},0)}Pt(g,"handleInteractionCapture");function p(k){c.current&&u.current.set(k.type,!1)}Pt(p,"handleInteractionBubble");const x=Pt(k=>{if(k.target&&!l.current){let w=function(){n.removeEventListener("click",f.current);const C=m();h(),C||x1(Q6,a,j,{discrete:!0})};if(Pt(w,"handleAndDispatchPointerDownOutsideEvent"),!o(k.target)){n.removeEventListener("click",f.current),h(),l.current=!1;return}const j={originalEvent:k};c.current=!0,s.current=r&&k.button===0,u.current.clear(),!r||k.button!==0?w():(n.removeEventListener("click",f.current),f.current=w,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),h();l.current=!1},"handlePointerDown"),y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const k of y)n.addEventListener(k,g,!0),n.addEventListener(k,p);const v=window.setTimeout(()=>{n.addEventListener("pointerdown",x)},0);return()=>{window.clearTimeout(v),n.removeEventListener("pointerdown",x),n.removeEventListener("click",f.current);for(const k of y)n.removeEventListener(k,g,!0),n.removeEventListener(k,p)}},[n,a,r,s,i,o]),{onPointerDownCapture:Pt(()=>l.current=!0,"onPointerDownCapture")}}Pt(Q$,"usePointerDownOutside");function X$(t,e=globalThis==null?void 0:globalThis.document){const n=No(t),r=b.useRef(!1);return b.useEffect(()=>{const s=Pt(i=>{i.target&&!r.current&&x1(X6,n,{originalEvent:i},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:Pt(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Pt(()=>r.current=!1,"onBlurCapture")}}Pt(X$,"useFocusOutside");function rx(){const t=new CustomEvent(nx);document.dispatchEvent(t)}Pt(rx,"dispatchUpdate");function x1(t,e,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?K$(s,i):s.dispatchEvent(i)}Pt(x1,"handleAndDispatchCustomEvent");var t8=Object.defineProperty,jt=(t,e)=>t8(t,"name",{value:e,configurable:!0}),Am="focusScope.autoFocusOnMount",Rm="focusScope.autoFocusOnUnmount",rb={bubbles:!1,cancelable:!0},n8=b.forwardRef(jt(function(e,n){const{loop:r=!1,trapped:s=!1,branches:i,onMountAutoFocus:o,onUnmountAutoFocus:a,...l}=e,[c,u]=b.useState(null),f=No(o),h=No(a),m=b.useRef(null),g=Tr(n,u),p=b.useRef(i);b.useEffect(()=>{p.current=i});const x=b.useCallback(k=>{var w;return k?c!=null&&c.contains(k)?!0:!!((w=p.current)!=null&&w.some(j=>j.contains(k))):!1},[c]),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(s){let k=function(E){if(y.paused||!c)return;const S=E.target;x(S)?m.current=S:hs(m.current,{select:!0})},w=function(E){if(y.paused||!c)return;const S=E.relatedTarget;S!==null&&(x(S)||hs(m.current,{select:!0}))},j=function(E){if(document.activeElement===document.body)for(const _ of E)_.removedNodes.length>0&&hs(c)};jt(k,"handleFocusIn"),jt(w,"handleFocusOut"),jt(j,"handleMutations"),document.addEventListener("focusin",k),document.addEventListener("focusout",w);const C=new MutationObserver(j);return c&&C.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",w),C.disconnect()}}},[s,c,y.paused,x]),b.useEffect(()=>{if(c){sb.add(y);const k=document.activeElement;if(!c.contains(k)){const j=new CustomEvent(Am,rb);c.addEventListener(Am,f),c.dispatchEvent(j),j.defaultPrevented||(sM(cM(v1(c)),{select:!0}),document.activeElement===k&&hs(c))}return()=>{c.removeEventListener(Am,f);const j=c.ownerDocument,C=CustomEvent;setTimeout(()=>{const E=new C(Rm,rb);c.addEventListener(Rm,h),c.dispatchEvent(E),E.defaultPrevented||hs(k??j.body,{select:!0}),c.removeEventListener(Rm,h),sb.remove(y)},0)}}},[c,f,h,y]);const v=b.useCallback(k=>{if(!r&&!s||y.paused)return;const w=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,j=document.activeElement;if(w&&j){const C=k.currentTarget,[E,S]=iM(C);E&&S?!k.shiftKey&&j===S?(k.preventDefault(),r&&hs(E,{select:!0})):k.shiftKey&&j===E&&(k.preventDefault(),r&&hs(S,{select:!0})):j===C&&k.preventDefault()}},[r,s,y.paused]);return d.jsx(Ot.div,{tabIndex:-1,...l,ref:g,onKeyDown:v})},"FocusScope")),eM=b.createContext(null);function tM({registry:t,children:e}){return t?d.jsx(eM.Provider,{value:t,children:e}):e}jt(tM,"FocusScopeBranchProvider");function nM(){const[t,e]=b.useState([]),n=b.useMemo(()=>({add:jt(r=>e(s=>s.includes(r)?s:[...s,r]),"add"),remove:jt(r=>e(s=>s.filter(i=>i!==r)),"remove")}),[]);return{nodes:t,registry:n}}jt(nM,"useFocusScopeBranchRegistry");function rM(t){const e=b.useContext(eM);b.useEffect(()=>{if(!(!t||!e))return e.add(t),()=>e.remove(t)},[t,e])}jt(rM,"useFocusScopeBranch");function sM(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(hs(r,{select:e}),document.activeElement!==n)return}jt(sM,"focusFirst");function iM(t){const e=v1(t),n=sx(e,t),r=sx(e.reverse(),t);return[n,r]}jt(iM,"getTabbableEdges");function v1(t){const e=[],r=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:jt(s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;r.nextNode();)e.push(r.currentNode);return e}jt(v1,"getTabbableCandidates");function sx(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const r of t)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):oM(r,{upTo:e})))return r}jt(sx,"findVisible");function oM(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}jt(oM,"isHidden");function aM(t){return t.tagName==="INPUT"&&typeof t.select=="function"}jt(aM,"isSelectableInput");function hs(t,{select:e=!1}={}){if(t&&t.focus){const r=(t.ownerDocument??document).activeElement;t.focus({preventScroll:!0}),t!==r&&aM(t)&&e&&t.select()}}jt(hs,"focus");var sb=lM();function lM(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=ix(t,e),t.unshift(e)},remove(e){var n;t=ix(t,e),(n=t[0])==null||n.resume()}}}jt(lM,"createFocusScopesStack");function ix(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}jt(ix,"arrayRemove");function cM(t){return t.filter(e=>e.tagName!=="A")}jt(cM,"removeLinks");var r8=Object.defineProperty,s8=(t,e)=>r8(t,"name",{value:e,configurable:!0}),i8=pl[" useId ".trim().toString()]||(()=>{}),o8=0;function Cr(t){const[e,n]=b.useState(i8());return Rn(()=>{t||n(r=>r??String(o8++))},[t]),t||(e?`radix-${e}`:"")}s8(Cr,"useId");const a8=["top","right","bottom","left"],Ti=Math.min,Ss=Math.max,th=Math.round,du=Math.floor,js=t=>({x:t,y:t}),l8={left:"right",right:"left",bottom:"top",top:"bottom"};function dM(t,e,n){return Ss(t,Ti(e,n))}function As(t,e){return typeof t=="function"?t(e):t}function Oi(t){return t.split("-")[0]}function Sl(t){return t.split("-")[1]}function k1(t){return t==="x"?"y":"x"}function w1(t){return t==="y"?"height":"width"}function Ur(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function b1(t){return k1(Ur(t))}function c8(t,e,n){n===void 0&&(n=!1);const r=Sl(t),s=b1(t),i=w1(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=nh(o)),[o,nh(o)]}function d8(t){const e=nh(t);return[ox(t),e,ox(e)]}function ox(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const ib=["left","right"],ob=["right","left"],u8=["top","bottom"],f8=["bottom","top"];function h8(t,e,n){switch(t){case"top":case"bottom":return n?e?ob:ib:e?ib:ob;case"left":case"right":return e?u8:f8;default:return[]}}function p8(t,e,n,r){const s=Sl(t);let i=h8(Oi(t),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(ox)))),i}function nh(t){const e=Oi(t);return l8[e]+t.slice(e.length)}function m8(t){var e,n,r,s;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(r=t.bottom)!=null?r:0,left:(s=t.left)!=null?s:0}}function uM(t){return typeof t!="number"?m8(t):{top:t,right:t,bottom:t,left:t}}function rh(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function ab(t,e,n){let{reference:r,floating:s}=t;const i=Ur(e),o=b1(e),a=w1(o),l=Oi(e),c=i==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,h=r[a]/2-s[a]/2;let m;switch(l){case"top":m={x:u,y:r.y-s.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-s.width,y:f};break;default:m={x:r.x,y:r.y}}const g=Sl(e);return g&&(m[o]+=h*(g==="end"?1:-1)*(n&&c?-1:1)),m}async function g8(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=As(e,t),g=uM(m),x=a[h?f==="floating"?"reference":"floating":f],y=rh(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),w=await(i.isElement==null?void 0:i.isElement(k))&&await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1},j=rh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:k,strategy:l}):v);return{top:(y.top-j.top+g.top)/w.y,bottom:(j.bottom-y.bottom+g.bottom)/w.y,left:(y.left-j.left+g.left)/w.x,right:(j.right-y.right+g.right)/w.x}}const y8=50,x8=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:g8},l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:u,y:f}=ab(c,r,l),h=r,m=0;const g={};for(let p=0;p<i.length;p++){const x=i[p];if(!x)continue;const{name:y,fn:v}=x,{x:k,y:w,data:j,reset:C}=await v({x:u,y:f,initialPlacement:r,placement:h,strategy:s,middlewareData:g,rects:c,platform:a,elements:{reference:t,floating:e}});u=k??u,f=w??f,g[y]={...g[y],...j},C&&m<y8&&(m++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(c=C.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:s}):C.rects),{x:u,y:f}=ab(c,h,l)),p=-1)}return{x:u,y:f,placement:h,strategy:s,middlewareData:g}},v8=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=As(t,e)||{};if(c==null)return{};const f=uM(u),h={x:n,y:r},m=b1(s),g=w1(m),p=await o.getDimensions(c),x=m==="y",y=x?"top":"left",v=x?"bottom":"right",k=x?"clientHeight":"clientWidth",w=i.reference[g]+i.reference[m]-h[m]-i.floating[g],j=h[m]-i.reference[m],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let E=C?C[k]:0;(!E||!await(o.isElement==null?void 0:o.isElement(C)))&&(E=a.floating[k]||i.floating[g]);const S=w/2-j/2,_=E/2-p[g]/2-1,N=Ti(f[y],_),M=Ti(f[v],_),P=E-p[g]-M,V=E/2-p[g]/2+S,Z=dM(N,V,P),Y=!l.arrow&&Sl(s)!=null&&V!==Z&&i.reference[g]/2-(V<N?N:M)-p[g]/2<0,O=Y?V<N?V-N:V-P:0;return{[m]:h[m]+O,data:{[m]:Z,centerOffset:V-Z-O,...Y&&{alignmentOffset:O}},reset:Y}}}),k8=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...x}=As(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=Oi(s),v=Ur(a),k=Oi(a)===a,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),j=h||(k||!p?[nh(a)]:d8(a)),C=g!=="none";!h&&C&&j.push(...p8(a,p,g,w));const E=[a,...j],S=await l.detectOverflow(e,x),_=[];let N=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&_.push(S[y]),f){const Z=c8(s,o,w);_.push(S[Z[0]],S[Z[1]])}if(N=[...N,{placement:s,overflows:_}],!_.every(Z=>Z<=0)){var M,P;const Z=(((M=i.flip)==null?void 0:M.index)||0)+1,Y=E[Z];if(Y&&(!(f==="alignment"?v!==Ur(Y):!1)||N.every(I=>Ur(I.placement)===v?I.overflows[0]>0:!0)))return{data:{index:Z,overflows:N},reset:{placement:Y}};let O=(P=N.filter(R=>R.overflows[0]<=0).sort((R,I)=>R.overflows[1]-I.overflows[1])[0])==null?void 0:P.placement;if(!O)switch(m){case"bestFit":{var V;const R=(V=N.filter(I=>{if(C){const L=Ur(I.placement);return L===v||L==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(L=>L>0).reduce((L,K)=>L+K,0)]).sort((I,L)=>I[1]-L[1])[0])==null?void 0:V[0];R&&(O=R);break}case"initialPlacement":O=a;break}if(s!==O)return{reset:{placement:O}}}return{}}}};function lb(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function cb(t){return a8.some(e=>t[e]>=0)}const w8=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:s="referenceHidden",...i}=As(t,e);switch(s){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),a=lb(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:cb(a)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),a=lb(o,n.floating);return{data:{escapedOffsets:a,escaped:cb(a)}}}default:return{}}}}},fM=new Set(["left","top"]);async function b8(t,e){const{placement:n,platform:r,elements:s}=t,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Oi(n),a=Sl(n),l=Ur(n)==="y",c=fM.has(o)?-1:1,u=i&&l?-1:1,f=As(e,t);let{mainAxis:h,crossAxis:m,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof g=="number"&&(m=a==="end"?g*-1:g),l?{x:m*u,y:h*c}:{x:h*c,y:m*u}}const S8=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:i,placement:o,middlewareData:a}=e,l=await b8(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:o}}}}},j8=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s,platform:i}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:v=>{let{x:k,y:w}=v;return{x:k,y:w}}},...c}=As(t,e),u={x:n,y:r},f=await i.detectOverflow(e,c),h=Ur(s),m=k1(h);let g=u[m],p=u[h];const x=(v,k)=>dM(k+f[v==="y"?"top":"left"],k,k-f[v==="y"?"bottom":"right"]);o&&(g=x(m,g)),a&&(p=x(h,p));const y=l.fn({...e,[m]:g,[h]:p});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[m]:o,[h]:a}}}}}},C8=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,r;const{x:s,y:i,placement:o,rects:a,middlewareData:l}=e,{offset:c=0,mainAxis:u=!0,crossAxis:f=!0}=As(t,e),h={x:s,y:i},m=Ur(o),g=k1(m);let p=h[g],x=h[m];const y=As(c,e),v=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(r=y.crossAxis)!=null?r:0};if(u){const j=g==="y"?"height":"width",C=a.reference[g]-a.floating[j]+v.mainAxis,E=a.reference[g]+a.reference[j]-v.mainAxis;p<C?p=C:p>E&&(p=E)}if(f){var k,w;const j=g==="y"?"width":"height",C=fM.has(Oi(o)),E=a.reference[m]-a.floating[j]+(C&&((k=l.offset)==null?void 0:k[m])||0)+(C?0:v.crossAxis),S=a.reference[m]+a.reference[j]+(C?0:((w=l.offset)==null?void 0:w[m])||0)-(C?v.crossAxis:0);x<E?x=E:x>S&&(x=S)}return{[g]:p,[m]:x}}}},_8=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:s,elements:i}=e,{apply:o=()=>{},...a}=As(t,e),l=await s.detectOverflow(e,a),c=Oi(n),u=Sl(n),f=Ur(n)==="y",{width:h,height:m}=r.floating;let g,p;c==="top"||c==="bottom"?(g=c,p=u===(await(s.isRTL==null?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(p=c,g=u==="end"?"top":"bottom");const x=m-l.top-l.bottom,y=h-l.left-l.right,v=Ti(m-l[g],x),k=Ti(h-l[p],y),w=e.middlewareData.shift,j=!w;let C=v,E=k;w!=null&&w.enabled.x&&(E=y),w!=null&&w.enabled.y&&(C=x),j&&!u&&(f?E=h-2*Ss(l.left,l.right):C=m-2*Ss(l.top,l.bottom)),await o({...e,availableWidth:E,availableHeight:C});const S=await s.getDimensions(i.floating);return h!==S.width||m!==S.height?{reset:{rects:!0}}:{}}}};function jp(){return typeof window<"u"}function jl(t){return hM(t)?(t.nodeName||"").toLowerCase():"#document"}function In(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function zs(t){var e;return(e=(hM(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function hM(t){return jp()?t instanceof Node||t instanceof In(t).Node:!1}function Qr(t){return jp()?t instanceof Element||t instanceof In(t).Element:!1}function Li(t){return jp()?t instanceof HTMLElement||t instanceof In(t).HTMLElement:!1}function db(t){return!jp()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof In(t).ShadowRoot}function Cp(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Xr(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&s!=="inline"&&s!=="contents"}function N8(t){return/^(table|td|th)$/.test(jl(t))}function _p(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const E8=/transform|translate|scale|rotate|perspective|filter/,$8=/paint|layout|strict|content/,Vi=t=>!!t&&t!=="none";let Im;function S1(t){const e=Qr(t)?Xr(t):t;return Vi(e.transform)||Vi(e.translate)||Vi(e.scale)||Vi(e.rotate)||Vi(e.perspective)||!j1()&&(Vi(e.backdropFilter)||Vi(e.filter))||E8.test(e.willChange||"")||$8.test(e.contain||"")}function M8(t){let e=Eo(t);for(;Li(e)&&!Yc(e);){if(S1(e))return e;if(_p(e))return null;e=Eo(e)}return null}function j1(){return Im==null&&(Im=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Im}function Yc(t){return/^(html|body|#document)$/.test(jl(t))}function Xr(t){return In(t).getComputedStyle(t)}function Np(t){return Qr(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Eo(t){if(jl(t)==="html")return t;const e=t.assignedSlot||t.parentNode||db(t)&&t.host||zs(t);return db(e)?e.host:e}function pM(t){const e=Eo(t);return Yc(e)?(t.ownerDocument||t).body:Li(e)&&Cp(e)?e:pM(e)}function Qc(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=pM(t),i=s===((r=t.ownerDocument)==null?void 0:r.body),o=In(s);if(i){const a=ax(o);return e.concat(o,o.visualViewport||[],Cp(s)?s:[],a&&n?Qc(a):[])}else return e.concat(s,Qc(s,[],n))}function ax(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function mM(t){const e=Xr(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Li(t),i=s?t.offsetWidth:n,o=s?t.offsetHeight:r,a=th(n)!==i||th(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function C1(t){return Qr(t)?t:t.contextElement}function Ma(t){const e=C1(t);if(!Li(e))return js(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:i}=mM(e);let o=(i?th(n.width):n.width)/r,a=(i?th(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const T8=js(0);function gM(t){const e=In(t);return!j1()||!e.visualViewport?T8:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function O8(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===In(t)}function $o(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=C1(t);let o=js(1);e&&(r?Qr(r)&&(o=Ma(r)):o=Ma(t));const a=O8(i,n,r)?gM(i):js(0);let l=(s.left+a.x)/o.x,c=(s.top+a.y)/o.y,u=s.width/o.x,f=s.height/o.y;if(i&&r){const h=In(i),m=Qr(r)?In(r):r;let g=h,p=ax(g);for(;p&&m!==g;){const x=Ma(p),y=p.getBoundingClientRect(),v=Xr(p),k=y.left+(p.clientLeft+parseFloat(v.paddingLeft))*x.x,w=y.top+(p.clientTop+parseFloat(v.paddingTop))*x.y;l*=x.x,c*=x.y,u*=x.x,f*=x.y,l+=k,c+=w,g=In(p),p=ax(g)}}return rh({width:u,height:f,x:l,y:c})}function Ep(t,e){const n=Np(t).scrollLeft;return e?e.left+n:$o(zs(t)).left+n}function yM(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Ep(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function A8(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const i=s==="fixed",o=zs(r),a=e?_p(e.floating):!1;if(r===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=js(1);const u=js(0),f=Li(r);if((f||!i)&&((jl(r)!=="body"||Cp(o))&&(l=Np(r)),f)){const m=$o(r);c=Ma(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}const h=o&&!f&&!i?yM(o,l):js(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function R8(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function I8(t){const e=Np(t),n=t.ownerDocument.body,r=Ss(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=Ss(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-e.scrollLeft+Ep(t);const o=-e.scrollTop;return Xr(n).direction==="rtl"&&(i+=Ss(t.clientWidth,n.clientWidth)-r),{width:r,height:s,x:i,y:o}}const P8=25;function D8(t,e,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",s=In(t),i=zs(t),o=s.visualViewport;let a=i.clientWidth,l=i.clientHeight,c=0,u=0;if(o){const h=!j1()||e==="fixed";r?h||(c=-o.offsetLeft,u=-o.offsetTop):(a=o.width,l=o.height,h&&(c=o.offsetLeft,u=o.offsetTop))}if(Ep(i)<=0){const h=i.ownerDocument,m=h.body,g=getComputedStyle(m),p=h.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,x=Math.abs(i.clientWidth-m.clientWidth-p),y=getComputedStyle(i).scrollbarGutter==="stable both-edges"?x/2:x;y<=P8&&(a-=y)}return{width:a,height:l,x:c,y:u}}function z8(t,e){const n=$o(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,i=Ma(t),o=t.clientWidth*i.x,a=t.clientHeight*i.y,l=s*i.x,c=r*i.y;return{width:o,height:a,x:l,y:c}}function ub(t,e,n){let r;if(e==="viewport"||e==="layoutViewport")r=D8(t,n,e);else if(e==="document")r=I8(zs(t));else if(Qr(e))r=z8(e,n);else{const s=gM(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return rh(r)}function L8(t,e){const n=e.get(t);if(n)return n;let r=Qc(t,[],!1).filter(a=>Qr(a)&&jl(a)!=="body"),s=null;const i=Xr(t).position==="fixed";let o=i?Eo(t):t;for(;Qr(o)&&!Yc(o);){const a=Xr(o),l=S1(o),c=s?s.position:i?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?r=r.filter(f=>f!==o):s=a,o=Eo(o)}return e.set(t,r),r}function F8(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?_p(e)?[]:L8(e,this._c):[].concat(n),r],a=ub(e,o[0],s);let l=a.top,c=a.right,u=a.bottom,f=a.left;for(let h=1;h<o.length;h++){const m=ub(e,o[h],s);l=Ss(m.top,l),c=Ti(m.right,c),u=Ti(m.bottom,u),f=Ss(m.left,f)}return{width:c-f,height:u-l,x:f,y:l}}function B8(t){const{width:e,height:n}=mM(t);return{width:e,height:n}}function V8(t,e,n){const r=Li(e),s=zs(e),i=n==="fixed",o=$o(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const l=js(0);if((r||!i)&&((jl(e)!=="body"||Cp(s))&&(a=Np(e)),r)){const h=$o(e,!0,i,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}!r&&s&&(l.x=Ep(s));const c=s&&!r&&!i?yM(s,a):js(0),u=o.left+a.scrollLeft-l.x-c.x,f=o.top+a.scrollTop-l.y-c.y;return{x:u,y:f,width:o.width,height:o.height}}function Pm(t){return Xr(t).position==="static"}function fb(t,e){if(!Li(t)||Xr(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return zs(t)===n&&(n=n.ownerDocument.body),n}function xM(t,e){const n=In(t);if(_p(t))return n;if(!Li(t)){let s=Eo(t);for(;s&&!Yc(s);){if(Qr(s)&&!Pm(s))return s;s=Eo(s)}return n}let r=fb(t,e);for(;r&&N8(r)&&Pm(r);)r=fb(r,e);return r&&Yc(r)&&Pm(r)&&!S1(r)?n:r||M8(t)||n}const W8=async function(t){const e=this.getOffsetParent||xM,n=this.getDimensions,r=await n(t.floating);return{reference:V8(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function U8(t){return Xr(t).direction==="rtl"}const Z8={convertOffsetParentRelativeRectToViewportRelativeRect:A8,getDocumentElement:zs,getClippingRect:F8,getOffsetParent:xM,getElementRects:W8,getClientRects:R8,getDimensions:B8,getScale:Ma,isElement:Qr,isRTL:U8};function vM(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function H8(t,e,n){let r=null,s;const i=zs(t);function o(){var u;clearTimeout(s),(u=r)==null||u.disconnect(),r=null}function a(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),o();const h=t.getBoundingClientRect(),{left:m,top:g,width:p,height:x}=h;if(u||e(),!p||!x)return;const y=du(g),v=du(i.clientWidth-(m+p)),k=du(i.clientHeight-(g+x)),w=du(m),C={rootMargin:-y+"px "+-v+"px "+-k+"px "+-w+"px",threshold:Ss(0,Ti(1,f))||1};let E=!0;function S(_){const N=_[0].intersectionRatio;if(!vM(h,t.getBoundingClientRect()))return a();if(N!==f){if(!E)return a();N?a(!1,N):s=setTimeout(()=>{a(!1,1e-7)},1e3)}E=!1}try{r=new IntersectionObserver(S,{...C,root:i.ownerDocument})}catch{r=new IntersectionObserver(S,C)}r.observe(t)}const l=In(t),c=()=>a(n);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),o()}}function q8(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=C1(t),u=s||i?[...c?Qc(c):[],...e?Qc(e):[]]:[];u.forEach(y=>{s&&y.addEventListener("scroll",n),i&&y.addEventListener("resize",n)});const f=c&&a?H8(c,n,i):null;let h=-1,m=null;o&&(m=new ResizeObserver(y=>{let[v]=y;v&&v.target===c&&m&&e&&(m.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=m)==null||k.observe(e)})),n()}),c&&!l&&m.observe(c),e&&m.observe(e));let g,p=l?$o(t):null;l&&x();function x(){const y=$o(t);p&&!vM(p,y)&&n(),p=y,g=requestAnimationFrame(x)}return n(),()=>{var y;u.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(y=m)==null||y.disconnect(),m=null,l&&cancelAnimationFrame(g)}}const K8=S8,J8=j8,G8=k8,Y8=_8,Q8=w8,hb=v8,X8=C8,eF=(t,e,n)=>{const r=new Map,s=n??{},i={...Z8,...s.platform,_c:r};return x8(t,e,{...s,platform:i})};var tF=typeof document<"u",nF=function(){},Uu=tF?b.useLayoutEffect:nF;function sh(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!sh(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&t.$$typeof)&&!sh(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function kM(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function pb(t,e){const n=kM(t);return Math.round(e*n)/n}function Dm(t){const e=b.useRef(t);return Uu(()=>{e.current=t}),e}function rF(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[u,f]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,m]=b.useState(r);sh(h,r)||m(r);const[g,p]=b.useState(null),[x,y]=b.useState(null),v=b.useCallback(I=>{I!==C.current&&(C.current=I,p(I))},[]),k=b.useCallback(I=>{I!==E.current&&(E.current=I,y(I))},[]),w=i||g,j=o||x,C=b.useRef(null),E=b.useRef(null),S=b.useRef(u),_=l!=null,N=Dm(l),M=Dm(s),P=Dm(c),V=b.useCallback(()=>{if(!C.current||!E.current)return;const I={placement:e,strategy:n,middleware:h};M.current&&(I.platform=M.current),eF(C.current,E.current,I).then(L=>{const K={...L,isPositioned:P.current!==!1};Z.current&&!sh(S.current,K)&&(S.current=K,kd.flushSync(()=>{f(K)}))})},[h,e,n,M,P]);Uu(()=>{c===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,f(I=>({...I,isPositioned:!1})))},[c]);const Z=b.useRef(!1);Uu(()=>(Z.current=!0,()=>{Z.current=!1}),[]),Uu(()=>{if(w&&(C.current=w),j&&(E.current=j),w&&j){if(N.current)return N.current(w,j,V);V()}},[w,j,V,N,_]);const Y=b.useMemo(()=>({reference:C,floating:E,setReference:v,setFloating:k}),[v,k]),O=b.useMemo(()=>({reference:w,floating:j}),[w,j]),R=b.useMemo(()=>{const I={position:n,left:0,top:0};if(!O.floating)return I;const L=pb(O.floating,u.x),K=pb(O.floating,u.y);return a?{...I,transform:"translate("+L+"px, "+K+"px)",...kM(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:K}},[n,a,O.floating,u.x,u.y]);return b.useMemo(()=>({...u,update:V,refs:Y,elements:O,floatingStyles:R}),[u,V,Y,O,R])}const sF=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?hb({element:r.current,padding:s}).fn(n):{}:r?hb({element:r,padding:s}).fn(n):{}}}},iF=(t,e)=>{const n=K8(t);return{name:n.name,fn:n.fn,options:[t,e]}},oF=(t,e)=>{const n=J8(t);return{name:n.name,fn:n.fn,options:[t,e]}},aF=(t,e)=>({fn:X8(t).fn,options:[t,e]}),lF=(t,e)=>{const n=G8(t);return{name:n.name,fn:n.fn,options:[t,e]}},cF=(t,e)=>{const n=Y8(t);return{name:n.name,fn:n.fn,options:[t,e]}},dF=(t,e)=>{const n=Q8(t);return{name:n.name,fn:n.fn,options:[t,e]}},uF=(t,e)=>{const n=sF(t);return{name:n.name,fn:n.fn,options:[t,e]}};var fF=Object.defineProperty,hF=(t,e)=>fF(t,"name",{value:e,configurable:!0});function wM(t){const[e,n]=b.useState(void 0);return Rn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});let r=0;const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];window.cancelAnimationFrame(r),r=window.requestAnimationFrame(()=>{let a,l;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=t.offsetWidth,l=t.offsetHeight;n({width:a,height:l})})});return s.observe(t,{box:"border-box"}),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}else n(void 0)},[t]),e}hF(wM,"useSize");var pF=Object.defineProperty,gi=(t,e)=>pF(t,"name",{value:e,configurable:!0}),mb={Partial:"partial"},gb={Optimized:"optimized",Always:"always"},bM="Popper",[SM,jM]=Sp(bM),[mF,CM]=SM(bM),gF=gi(t=>{const{__scopePopper:e,children:n}=t,[r,s]=b.useState(null),[i,o]=b.useState(void 0);return d.jsx(mF,{scope:e,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})},"Popper"),yF="PopperAnchor",xF=b.forwardRef(gi(function(e,n){const{__scopePopper:r,virtualRef:s,...i}=e,o=CM(yF,r),a=b.useRef(null),l=o.onAnchorChange,c=b.useCallback(p=>{a.current=p,p&&l(p)},[l]),u=Tr(n,c),f=b.useRef(null);b.useEffect(()=>{if(!s)return;const p=f.current;f.current=s.current,p!==f.current&&l(f.current)});const h=o.placementState&&$p(o.placementState),m=h==null?void 0:h[0],g=h==null?void 0:h[1];return s?null:d.jsx(Ot.div,{"data-radix-popper-side":m,"data-radix-popper-align":g,...i,ref:u})},"PopperAnchor")),_M="PopperContent",[vF,fY]=SM(_M),kF=b.forwardRef(gi(function(e,n){var q,re,Pe,qe,Ke,gt,Xt;const{__scopePopper:r,side:s="bottom",sideOffset:i=0,align:o="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:h=mb.Partial,hideWhenDetached:m=!1,updatePositionStrategy:g=gb.Optimized,onPlaced:p,...x}=e,y=CM(_M,r),[v,k]=b.useState(null),w=Tr(n,k),[j,C]=b.useState(null),E=wM(j),S=(E==null?void 0:E.width)??0,_=(E==null?void 0:E.height)??0,N=s+(o!=="center"?"-"+o:""),M=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},P=Array.isArray(u)?u:[u],V=P.length>0,Z={padding:M,boundary:P.filter(NM),altBoundary:V},{refs:Y,floatingStyles:O,placement:R,isPositioned:I,middlewareData:L}=rF({strategy:"fixed",placement:N,whileElementsMounted:gi((...Wt)=>q8(...Wt,{animationFrame:g===gb.Always}),"whileElementsMounted"),elements:{reference:y.anchor},middleware:[iF({mainAxis:i+_,alignmentAxis:a}),c&&oF({mainAxis:!0,crossAxis:!1,...h===mb.Partial?{limiter:aF()}:{},...Z}),c&&lF({...Z}),cF({...Z,apply:gi(({elements:Wt,rects:At,availableWidth:Qe,availableHeight:Dn})=>{const{width:Ut,height:le}=At.reference,it=Wt.floating.style;it.setProperty("--radix-popper-available-width",`${Qe}px`),it.setProperty("--radix-popper-available-height",`${Dn}px`),it.setProperty("--radix-popper-anchor-width",`${Ut}px`),it.setProperty("--radix-popper-anchor-height",`${le}px`)},"apply")}),j&&uF({element:j,padding:l}),wF({arrowWidth:S,arrowHeight:_}),m&&dF(V?{strategy:"referenceHidden",...Z}:{strategy:"referenceHidden",padding:Z.padding,altBoundary:Z.altBoundary})]}),K=y.setPlacementState;Rn(()=>(K(R),()=>{K(void 0)}),[R,K]);const[ne,D]=$p(R),z=No(p);Rn(()=>{I&&(z==null||z())},[I,z]);const B=(q=L.arrow)==null?void 0:q.x,H=(re=L.arrow)==null?void 0:re.y,$=((Pe=L.arrow)==null?void 0:Pe.centerOffset)!==0,[A,F]=b.useState();return Rn(()=>{v&&F(window.getComputedStyle(v).zIndex)},[v]),d.jsx("div",{ref:Y.setFloating,"data-radix-popper-content-wrapper":"",style:{...O,transform:I?O.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:A,"--radix-popper-transform-origin":[(qe=L.transformOrigin)==null?void 0:qe.x,(Ke=L.transformOrigin)==null?void 0:Ke.y].join(" "),...((gt=L.hide)==null?void 0:gt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(vF,{scope:r,placedSide:ne,placedAlign:D,onArrowChange:C,arrowX:B,arrowY:H,shouldHideArrow:$,children:d.jsx(Ot.div,{"data-side":ne,"data-align":D,...x,ref:w,style:{...x.style,animation:I?(Xt=x.style)==null?void 0:Xt.animation:"none"}})})})},"PopperContent"));function NM(t){return t!==null}gi(NM,"isNotNull");var wF=gi(t=>({name:"transformOrigin",options:t,fn(e){var x,y,v;const{placement:n,rects:r,middlewareData:s}=e,o=((x=s.arrow)==null?void 0:x.centerOffset)!==0,a=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[c,u]=$p(n),f={start:"0%",center:"50%",end:"100%"}[u],h=(((y=s.arrow)==null?void 0:y.x)??0)+a/2,m=(((v=s.arrow)==null?void 0:v.y)??0)+l/2;let g="",p="";return c==="bottom"?(g=o?f:`${h}px`,p=`${-l}px`):c==="top"?(g=o?f:`${h}px`,p=`${r.floating.height+l}px`):c==="right"?(g=`${-l}px`,p=o?f:`${m}px`):c==="left"&&(g=`${r.floating.width+l}px`,p=o?f:`${m}px`),{data:{x:g,y:p}}}}),"transformOrigin");function $p(t){const[e,n="center"]=t.split("-");return[e,n]}gi($p,"getSideAndAlignFromPlacement");var bF=Object.defineProperty,SF=(t,e)=>bF(t,"name",{value:e,configurable:!0}),EM=b.forwardRef(SF(function(e,n){var l;const{container:r,...s}=e,[i,o]=b.useState(!1);Rn(()=>o(!0),[]);const a=r||i&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?kd.createPortal(d.jsx(Ot.div,{...s,ref:n}),a):null},"Portal")),jF=Object.defineProperty,Rs=(t,e)=>jF(t,"name",{value:e,configurable:!0});function $M(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}Rs($M,"useStateMachine");var Id=Rs(t=>{const{present:e,children:n}=t,r=MM(e),s=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),i=TM(r.ref,OM(s));return typeof n=="function"||r.isPresent?b.cloneElement(s,{ref:i}):null},"Presence");function MM(t){const[e,n]=b.useState(),r=b.useRef(null),s=b.useRef(t),i=b.useRef("none"),o=b.useRef(void 0),a=t?"mounted":"unmounted",[l,c]=$M(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{l==="mounted"?(i.current=o.current??ta(r.current),o.current=void 0):i.current="none"},[l]),Rn(()=>{const u=r.current,f=s.current;if(f!==t){const m=i.current,g=ta(u);t?(o.current=g,c("MOUNT")):g==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,c]),Rn(()=>{if(e){let u;const f=e.ownerDocument.defaultView??window,h=Rs(g=>{const x=ta(r.current).includes(CSS.escape(g.animationName));if(g.target===e&&x&&(c("ANIMATION_END"),!s.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",u=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},"handleAnimationEnd"),m=Rs(g=>{g.target===e&&(i.current=ta(r.current))},"handleAnimationStart");return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{f.clearTimeout(u),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:b.useCallback(u=>{if(u){const f=getComputedStyle(u);r.current=f,o.current=ta(f)}else r.current=null;n(u)},[])}}Rs(MM,"usePresence");function lx(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Rs(lx,"setRef");function TM(...t){const e=b.useRef(t);return e.current=t,b.useCallback(n=>{const r=e.current;let s=!1;const i=r.map(o=>{const a=lx(o,n);return!s&&typeof a=="function"&&(s=!0),a});if(s)return()=>{for(let o=0;o<i.length;o++){const a=i[o];typeof a=="function"?a():lx(r[o],null)}}},[])}Rs(TM,"useStableComposedRefs");function ta(t){return(t==null?void 0:t.animationName)||"none"}Rs(ta,"getAnimationName");function OM(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}Rs(OM,"getElementRef");var CF=Object.defineProperty,_F=(t,e)=>CF(t,"name",{value:e,configurable:!0}),yb=pl[" useEffectEvent ".trim().toString()],xb=pl[" useInsertionEffect ".trim().toString()];function AM(t){if(typeof yb=="function")return yb(t);const e=b.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof xb=="function"?xb(()=>{e.current=t}):Rn(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}_F(AM,"useEffectEvent");var NF=Object.defineProperty,Pd=(t,e)=>NF(t,"name",{value:e,configurable:!0}),EF=pl[" useInsertionEffect ".trim().toString()]||Rn;function _1({prop:t,defaultProp:e,onChange:n=Pd(()=>{},"onChange"),caller:r}){const[s,i,o]=RM({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:s,c=b.useCallback(u=>{var f;if(a){const h=IM(u)?u(t):u;h!==t&&((f=o.current)==null||f.call(o,h))}else i(u)},[a,t,i,o]);return[l,c]}Pd(_1,"useControllableState");function RM({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),s=b.useRef(n),i=b.useRef(e);return EF(()=>{i.current=e},[e]),b.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}Pd(RM,"useUncontrolledState");function IM(t){return typeof t=="function"}Pd(IM,"isFunction");var vb=Symbol("RADIX:SYNC_STATE");function $F(t,e,n,r){const{prop:s,defaultProp:i,onChange:o,caller:a}=e,l=s!==void 0,c=AM(o),u=[{...n,state:i}];r&&u.push(r);const[f,h]=b.useReducer((x,y)=>{if(y.type===vb)return{...x,state:y.state};const v=t(x,y);return l&&!Object.is(v.state,x.state)&&c(v.state),v},...u),m=f.state,g=b.useRef(m);b.useEffect(()=>{g.current!==m&&(g.current=m,l||c(m))},[m,g,l]);const p=b.useMemo(()=>s!==void 0?{...f,state:s}:f,[f,s]);return b.useEffect(()=>{l&&!Object.is(s,f.state)&&h({type:vb,state:s})},[s,f.state,l]),[p,h]}Pd($F,"useControllableStateReducer");var MF=Object.defineProperty,TF=(t,e)=>MF(t,"name",{value:e,configurable:!0}),OF=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),AF=b.forwardRef(TF(function(e,n){return d.jsx(Ot.span,{...e,ref:n,style:{...OF,...e.style}})},"VisuallyHidden")),RF=Object.defineProperty,$t=(t,e)=>RF(t,"name",{value:e,configurable:!0}),[N1,hY]=Sp("Tooltip",[jM]),E1=jM(),IF="TooltipProvider",PF=700,cx="tooltip.open",[DF,$1]=N1(IF),PM=$t(t=>{const{__scopeTooltip:e,delayDuration:n=PF,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,o=b.useRef(!0),a=b.useRef(!1),l=b.useRef(0);return b.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),d.jsx(DF,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:b.useCallback(()=>{r<=0||(window.clearTimeout(l.current),o.current=!1)},[r]),onClose:b.useCallback(()=>{r<=0||(window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:a,onPointerInTransitChange:b.useCallback(c=>{a.current=c},[]),disableHoverableContent:s,children:i})},"TooltipProvider"),dx="Tooltip",[zF,Dd]=N1(dx),LF=$t(t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=t,l=$1(dx,t.__scopeTooltip),c=E1(e),[u,f]=b.useState(null),[h,m]=b.useState(void 0),g=Cr(),p=b.useRef(0),x=o??l.disableHoverableContent,y=a??l.delayDuration,v=b.useRef(!1),[k,w]=_1({prop:r,defaultProp:s??!1,onChange:$t(N=>{N?(l.onOpen(),document.dispatchEvent(new CustomEvent(cx))):l.onClose(),i==null||i(N)},"onChange"),caller:dx}),j=b.useMemo(()=>k?v.current?"delayed-open":"instant-open":"closed",[k]),C=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v.current=!1,w(!0)},[w]),E=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w(!1)},[w]),S=b.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{v.current=!0,w(!0),p.current=0},y)},[y,w]);b.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]);const _=h??g;return d.jsx(gF,{...c,children:d.jsx(zF,{scope:e,contentId:_,setContentId:m,open:k,stateAttribute:j,trigger:u,onTriggerChange:f,onTriggerEnter:b.useCallback(()=>{l.isOpenDelayedRef.current?S():C()},[l.isOpenDelayedRef,S,C]),onTriggerLeave:b.useCallback(()=>{x?E():(window.clearTimeout(p.current),p.current=0)},[E,x]),onOpen:C,onClose:E,disableHoverableContent:x,children:n})})},"Tooltip"),kb="TooltipTrigger",FF=b.forwardRef($t(function(e,n){const{__scopeTooltip:r,"aria-describedby":s,...i}=e,o=Dd(kb,r),a=$1(kb,r),l=E1(r),c=b.useRef(null),u=Tr(n,c,o.onTriggerChange),f=b.useRef(!1),h=b.useRef(!1),m=b.useCallback(()=>f.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),d.jsx(xF,{asChild:!0,...l,children:d.jsx(Ot.button,{"aria-describedby":o.open?ZM(s,o.contentId):s,"data-state":o.stateAttribute,...i,ref:u,onPointerMove:_n(e.onPointerMove,g=>{g.pointerType!=="touch"&&!h.current&&!a.isPointerInTransitRef.current&&(o.onTriggerEnter(),h.current=!0)}),onPointerLeave:_n(e.onPointerLeave,()=>{o.onTriggerLeave(),h.current=!1}),onPointerDown:_n(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:_n(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:_n(e.onBlur,o.onClose),onClick:_n(e.onClick,o.onClose)})})},"TooltipTrigger")),DM="TooltipPortal",[BF,VF]=N1(DM,{forceMount:void 0}),WF=$t(t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=Dd(DM,e);return d.jsx(BF,{scope:e,forceMount:n,children:d.jsx(Id,{present:n||i.open,children:d.jsx(EM,{asChild:!0,container:s,children:r})})})},"TooltipPortal"),Xc="TooltipContent",UF=b.forwardRef($t(function(e,n){const r=VF(Xc,e.__scopeTooltip),{forceMount:s=r.forceMount,side:i="top",...o}=e,a=Dd(Xc,e.__scopeTooltip);return d.jsx(Id,{present:s||a.open,children:a.disableHoverableContent?d.jsx(zM,{side:i,...o,ref:n}):d.jsx(ZF,{side:i,...o,ref:n})})},"TooltipContent")),ZF=b.forwardRef($t(function(e,n){const r=Dd(Xc,e.__scopeTooltip),s=$1(Xc,e.__scopeTooltip),i=b.useRef(null),o=Tr(n,i),[a,l]=b.useState(null),{trigger:c,onClose:u}=r,f=i.current,{onPointerInTransitChange:h}=s,m=b.useCallback(()=>{l(null),h(!1)},[h]),g=b.useCallback((p,x)=>{const y=p.currentTarget,v={x:p.clientX,y:p.clientY},k=LM(v,y.getBoundingClientRect()),w=FM(v,k),j=BM(x.getBoundingClientRect()),C=WM([...w,...j]);l(C),h(!0)},[h]);return b.useEffect(()=>()=>m(),[m]),b.useEffect(()=>{if(c&&f){const p=$t(y=>g(y,f),"handleTriggerLeave"),x=$t(y=>g(y,c),"handleContentLeave");return c.addEventListener("pointerleave",p),f.addEventListener("pointerleave",x),()=>{c.removeEventListener("pointerleave",p),f.removeEventListener("pointerleave",x)}}},[c,f,g,m]),b.useEffect(()=>{if(a){const p=$t(x=>{const y=x.target,v={x:x.clientX,y:x.clientY},k=(c==null?void 0:c.contains(y))||(f==null?void 0:f.contains(y)),w=!VM(v,a);k?m():w&&(m(),u())},"handleTrackPointerGrace");return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[c,f,a,u,m]),d.jsx(zM,{...e,ref:o})},"TooltipContentHoverable")),HF=B$("TooltipContent"),zM=b.forwardRef($t(function(e,n){const{__scopeTooltip:r,children:s,"aria-label":i,id:o,onEscapeKeyDown:a,onPointerDownOutside:l,...c}=e,u=Dd(Xc,r),f=E1(r),{onClose:h}=u,[m,g]=b.useState(null),p=Tr(n,g);rM(m),b.useEffect(()=>(document.addEventListener(cx,h),()=>document.removeEventListener(cx,h)),[h]),b.useEffect(()=>{if(u.trigger){const y=$t(v=>{v.target instanceof Node&&v.target.contains(u.trigger)&&h()},"handleScroll");return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[u.trigger,h]);const{setContentId:x}=u;return Rn(()=>(x(o),()=>{x(void 0)}),[o,x]),d.jsx(G$,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:y=>y.preventDefault(),onDismiss:h,children:d.jsxs(kF,{"data-state":u.stateAttribute,role:i?void 0:"tooltip",id:i?void 0:u.contentId,...f,...c,ref:p,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(HF,{children:s}),i?d.jsx(AF,{id:u.contentId,role:"tooltip",children:i}):null]})})},"TooltipContentImpl"));function LM(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}$t(LM,"getExitSideFromRect");function FM(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}$t(FM,"getPaddedExitPoints");function BM(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}$t(BM,"getPointsFromRect");function VM(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const a=e[i],l=e[o],c=a.x,u=a.y,f=l.x,h=l.y;u>r!=h>r&&n<(f-c)*(r-u)/(h-u)+c&&(s=!s)}return s}$t(VM,"isPointInPolygon");function WM(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),UM(e)}$t(WM,"getHull");function UM(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const s=t[r];for(;e.length>=2;){const i=e[e.length-1],o=e[e.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}$t(UM,"getHullPresorted");function ZM(...t){const e=new Set;for(const n of t)if(typeof n=="string")for(const r of String(n).trim().split(/\s+/))r&&e.add(r);return e.size>0?Array.from(e).join(" "):void 0}$t(ZM,"concatAriaDescribedby");function Mp(t){const e=t.trim();if(!e)return{kind:"unknown",label:"Paste Poney JSON or a Mermaid diagram"};if(eP(e))return{kind:"poney",label:"Poney document"};const n=__(e);return n?{kind:"mermaid",label:{sequence:"Mermaid sequence diagram",flowchart:"Mermaid flowchart",state:"Mermaid state diagram",er:"Mermaid ER diagram"}[n]}:e.startsWith("{")?{kind:"json",label:'JSON, but not a Poney document (no "poneyVersion")'}:{kind:"unknown",label:"Not recognized"}}function M1(t){const e=Mp(t);if(e.kind==="poney"||e.kind==="json"){const n=XI(t,{extensions:Td()});return n.ok?{ok:!0,doc:n.document,warnings:n.issues}:{ok:!1,issues:n.issues.filter(r=>r.severity==="error")}}if(e.kind==="mermaid")try{return{ok:!0,doc:tP(t).document,warnings:[]}}catch(n){return{ok:!1,issues:[{path:"",message:n instanceof on?n.message:String(n)}]}}return{ok:!1,issues:[{path:"",message:'Paste a Poney document (JSON with "poneyVersion") or a Mermaid diagram.'}]}}function HM(t,e){const n=T.getState(),r=M1(t);return r.ok?(n.loadDocument(r.doc,e),n.setImportOpen(!1),n.notify(`Opened “${r.doc.project.name}”.${r.warnings.length?` ${r.warnings.length} note${r.warnings.length>1?"s":""} in the inspector.`:""}`),!0):(n.setImportOpen(!0,t),!1)}async function T1(){const t=T.getState(),e=qv(t.history.present);try{await navigator.clipboard.writeText(e),t.notify("Copied the model to the clipboard as Poney JSON.")}catch{t.notify("The browser blocked clipboard access. Use “Download JSON” instead.")}}function qF(){const t=T.getState().history.present,e=new Blob([qv(t)],{type:"application/json"}),n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=`${t.project.id}.poney`,r.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}const O1=t=>t instanceof HTMLElement&&(t.isContentEditable||t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT");function KF(){const t=e=>{var s;if(O1(e.target)||T.getState().importOpen)return;const n=((s=e.clipboardData)==null?void 0:s.getData("text/plain"))??"";if(!n.trim())return;if(Mp(n).kind==="unknown"){T.getState().notify("The clipboard has no Poney JSON or Mermaid diagram.");return}e.preventDefault(),HM(n,"pasted")};return window.addEventListener("paste",t),()=>window.removeEventListener("paste",t)}const JF=new Set(["entity","relationship","message","state","transition","activityNode"]),qM=t=>JF.has(t.kind);function GF(t,e){var n,r,s,i,o,a,l,c;switch(e.kind){case"entity":return(n=t.entities.get(e.id))==null?void 0:n.name;case"relationship":return(r=t.relationships.get(e.id))==null?void 0:r.label;case"message":return(s=t.messages(e.behavior).find(u=>u.message.id===e.id))==null?void 0:s.message.label;case"state":return(o=(i=t.stateMachine(e.behavior))==null?void 0:i.states.find(u=>u.id===e.id))==null?void 0:o.name;case"transition":return(l=(a=t.stateMachine(e.behavior))==null?void 0:a.transitions.find(u=>u.id===e.id))==null?void 0:l.event;case"activityNode":{const u=t.behaviors.get(e.behavior);return(u==null?void 0:u.kind)==="process"?(c=u.nodes.find(f=>f.id===e.id))==null?void 0:c.label:void 0}default:return}}function YF(t,e){switch(t.kind){case"entity":return{type:"entity.update",id:t.id,changes:{name:e}};case"relationship":return{type:"relationship.update",id:t.id,changes:{label:e}};case"message":case"state":case"transition":case"activityNode":return{type:"behavior.rename",behaviorId:t.behavior,element:t.kind,id:t.id,value:e};default:return}}function A1(t,e){var o;const n=T.getState();if(!n.history||!qM(t))return!1;const r=GF(ft(n.history.present),t);if(r===void 0)return!1;const s=e.getBoundingClientRect(),i=[...e.querySelectorAll("text")].find(a=>{const l=(a.textContent??"").replace(/…$/,"");return l.length>0&&r.startsWith(l)});if(i){const a=i.getBoundingClientRect(),l=((o=i.getScreenCTM())==null?void 0:o.a)??1,c=parseFloat(i.getAttribute("font-size")??getComputedStyle(i).fontSize)*l,u=i.getAttribute("text-anchor")==="middle",f=u?Math.max(a.width,s.width-16*l,280):Math.max(s.right-a.left-12*l,320);n.setRenaming({ref:t,value:r,text:i,rect:{x:a.x,y:a.y,w:a.width,h:a.height},room:f,font:{size:c,weight:i.getAttribute("font-weight")??"600"},align:u?"center":"left"})}else n.setRenaming({ref:t,value:r,rect:{x:s.x,y:s.y,w:s.width,h:s.height},room:Math.max(s.width,160),font:{size:14,weight:"600"},align:"center"});return!0}function uu(t){const e=T.getState(),n=e.renaming;if(e.setRenaming(null),!n||t===null)return;const r=t.trim();if(!r||r===n.value)return;const s=YF(n.ref,r);s&&e.dispatch(s)}function KM(){const t=/^#\/([^?]*)(?:\?select=(.+))?$/.exec(window.location.hash);if(!t)return;const e=T.getState(),n=ft(e.history.present),r=decodeURIComponent(t[1])||xt,s=r.startsWith("walk:")&&n.doc.walkthroughs.some(o=>`walk:${o.id}`===r);if(r!==xt&&!s&&!n.views.has(r))return;const i=t[2]?an(decodeURIComponent(t[2])):null;e.navigate(r,{select:i})}function QF(t,e,n){const r=`#/${t===xt?"":encodeURIComponent(t)}${e&&n?`?select=${encodeURIComponent(n)}`:""}`;window.location.hash!==r&&window.history.replaceState(null,"",r)}function XF({label:t,shortcut:e,children:n,side:r="top"}){return d.jsxs(LF,{delayDuration:350,children:[d.jsx(FF,{asChild:!0,children:n}),d.jsx(WF,{children:d.jsxs(UF,{side:r,sideOffset:6,className:"fade-in z-50 flex items-center gap-2 rounded-md bg-ink px-2 py-1 text-[11.5px] text-paper shadow-float",children:[t,e&&d.jsx("kbd",{className:"rounded bg-paper/15 px-1 font-sans text-[10.5px] text-paper/80",children:e})]})})]})}function rt({label:t,shortcut:e,onClick:n,active:r,disabled:s,children:i,side:o="top"}){return d.jsx(XF,{label:t,shortcut:e,side:o,children:d.jsx("button",{type:"button","aria-label":t,"aria-pressed":r,disabled:s,onClick:n,className:`grid h-8 min-w-8 place-items-center rounded-md px-1.5 text-ink-2 transition-colors hover:bg-sunken hover:text-ink disabled:pointer-events-none disabled:opacity-35 ${r?"bg-poney-wash !text-poney":""}`,children:i})})}const wb=()=>d.jsx("span",{className:"mx-1 h-5 w-px bg-rule","aria-hidden":!0}),e9={overview:"Overview",behavior:"Behavior",data:"Data",structure:"Structure",capabilities:"Capabilities"};function zd(t){return e9[t]??t.charAt(0).toUpperCase()+t.slice(1).replace(/-/g," ")}function JM(t){const e=ew.filter(r=>t.includes(r)),n=t.filter(r=>!ew.includes(r)).sort();return[...e,...n]}function t9(){const t=T.getState().live;return t.state==="on"&&t.url?Promise.resolve(t.url):t.state==="off"?Promise.resolve(void 0):new Promise(e=>{const n=window.setTimeout(()=>(r(),e(void 0)),15e3),r=T.subscribe(s=>{s.live.state==="on"&&s.live.url&&(window.clearTimeout(n),r(),e(s.live.url))})})}async function Qt(t,e){const n=await t9();if(!n)throw new Error('The Studio cannot reach Poney on this computer. Run "npm run studio" in the Poney folder.');const r=await fetch(`${n}${t}`,e===void 0?void 0:{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),s=await r.json().catch(()=>({}));if(!r.ok)throw new Error(s.error??`Poney answered ${r.status}`);return s}function Tp(t,e=[]){var o;const n=T.getState(),r=bp(n.viewId),s=(o=n.history)==null?void 0:o.present,i=s&&n.selection&&ft(s).exists(n.selection)?ft(s).describe(n.selection):void 0;return Qt("/api/live/ask",{text:t,walkthrough:n.startOpen?void 0:r,scene:!n.startOpen&&r?n.activeScene??void 0:void 0,selection:!n.startOpen&&n.selection?{ref:de(n.selection),title:(i==null?void 0:i.title)??"",kind:(i==null?void 0:i.kind)??n.selection.kind}:void 0,...e.length?{context:e}:{}})}const R1=()=>Qt("/api/agent"),bb=(t,e)=>Qt("/api/agent/connect",{cwd:t,...e}),n9=(t,e=!1)=>Qt("/api/agent/check",{...t,fresh:e}),r9=()=>Qt("/api/agent/disconnect",{}),s9=()=>Qt("/api/agent/cancel",{}),i9=(t,e)=>Qt("/api/agent/permission",{messageId:t,optionId:e}),o9=t=>Qt(`/api/workspace/folders${t?`?path=${encodeURIComponent(t)}`:""}`),ux=(t,e)=>Qt("/api/agent/setting",{id:t,value:e}),a9=t=>Qt("/api/project/open",{path:t}),GM=(t,e)=>Qt("/api/agent/connect-here",{...t,...e?{folder:e}:{}}),YM="poney:agent-for:",ih=t=>{if(t)try{return JSON.parse(localStorage.getItem(YM+t)??"null")??void 0}catch{return}},l9=(t,e)=>{try{localStorage.setItem(YM+t,JSON.stringify(e))}catch{}},QM=t=>Qt("/api/files/open",{path:t}),c9=t=>Qt("/api/workspace/clone",{url:t}),XM=()=>Qt("/api/plugins"),d9=t=>Qt("/api/import",{importer:t}),u9=t=>Qt("/api/overlays/run",{id:t}),f9=t=>Qt("/api/overlays/clear",{id:t}),eT=[{label:"Give me a tour of this codebase",prompt:"Give me a Poney tour of this codebase: what it is for, its main parts, one main flow end to end, and where to start a change. Open it in the Studio."},{label:"Walk me through the last commit",prompt:"Write a Poney walkthrough of the last commit in this repository, check it against the code, and open it in the Studio."},{label:"How is this code organised?",prompt:"Show me how this codebase is organised: its parts and how they connect, as a Poney map with groups. Open it in the Studio."}],h9=[{label:"What should I read first?",prompt:"Using the open Poney document and the code, tell me in a few sentences what to read first and why. Do not change the document."},{label:"Explain this scene",prompt:"Explain the scene I am on in plain words: what it shows and why it matters. Do not change the document."},{label:"Add the last commit",prompt:"Add a walkthrough of the last commit in this repository to the open Poney document. Get the document with poney_read first and keep everything in it. Check it against the code, and open it again."}],p9=t=>t&&(t.walkthroughs.length||t.views.length)?h9:eT,tT="poney:agents";function fx(){try{return JSON.parse(localStorage.getItem(tT)??"[]")}catch{return[]}}function Sb(t){try{localStorage.setItem(tT,JSON.stringify(t))}catch{}}const nT="poney:workspace",oh=()=>{try{return localStorage.getItem(nT)??void 0}catch{return}},rT=t=>{try{localStorage.setItem(nT,t)}catch{}};function m9(){const t=T(e=>{var n,r,s,i,o;return((n=e.project)==null?void 0:n.root)??((r=e.agent.session)==null?void 0:r.cwd)??(e.liveFile?(s=/^(.*)\/docs\/poney\/[^/]+\.poney$/.exec(e.liveFile))==null?void 0:s[1]:void 0)??((o=ih((i=e.history)==null?void 0:i.present.project.id))==null?void 0:o.folder)??null});return t?{root:t,name:t.split("/").pop()??t}:null}function g9(){const t=T(g=>g.live.state==="on"),e=T(g=>g.project),n=T(g=>g.overlays),[r,s]=b.useState(!1),[i,o]=b.useState([]),[a,l]=b.useState(null),[c,u]=b.useState(null),f=b.useRef(null);if(b.useEffect(()=>{if(!r)return;XM().then(x=>o(x.overlays),x=>u(x instanceof Error?x.message:String(x)));const g=x=>{var y;return!((y=f.current)!=null&&y.contains(x.target))&&s(!1)},p=x=>x.key==="Escape"&&s(!1);return window.addEventListener("pointerdown",g,!0),window.addEventListener("keydown",p),()=>{window.removeEventListener("pointerdown",g,!0),window.removeEventListener("keydown",p)}},[r]),!t||!e)return null;const h=Object.keys(n).length,m=async g=>{l(g),u(null);try{await(n[g]?f9(g):u9(g))}catch(p){u(p instanceof Error?p.message:String(p))}finally{l(null)}};return d.jsxs("div",{ref:f,className:"relative mr-1",children:[d.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":r,onClick:()=>s(!r),title:"Live facts on the parts: test coverage, recent changes",className:`inline-flex h-8 items-center gap-1.5 rounded-lg px-2 text-[12.5px] font-medium ${h?"bg-poney-wash text-poney":"text-ink-2 hover:bg-sunken"}`,children:[d.jsx(sD,{size:15}),d.jsxs("span",{className:"hidden lg:inline",children:["Facts",h?` (${h})`:""]})]}),r&&d.jsxs("div",{role:"menu","aria-label":"Facts",className:"fade-in absolute right-0 top-10 z-50 w-80 rounded-xl border border-rule bg-raised p-1 shadow-float",children:[i.map(g=>{const p=!!n[g.id],x=g.files.length>0;return d.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":p,disabled:!x&&!p,onClick:()=>void m(g.id),className:"flex w-full items-start gap-2.5 rounded-lg px-2.5 py-2 text-left hover:bg-sunken disabled:cursor-default disabled:opacity-50 disabled:hover:bg-transparent",children:[d.jsx("span",{className:`mt-0.5 grid h-4 w-4 shrink-0 place-items-center rounded border ${p?"border-poney bg-poney text-paper":"border-rule-strong"}`,children:a===g.id?d.jsx(So,{size:11,className:"animate-spin text-ink-3"}):p&&d.jsx(bs,{size:11})}),d.jsxs("span",{className:"min-w-0",children:[d.jsx("span",{className:"block text-[13px] font-medium",children:g.name}),d.jsx("span",{className:"block text-[12px] text-ink-3",children:p?n[g.id].notes[0]:x?g.description:"Nothing to read in this folder."})]})]},g.id)}),c&&d.jsx("p",{className:"px-2.5 py-1.5 text-[12px] text-removed",children:c})]})]})}function y9(){const t=ze(),e=T(),n=e.viewId===xt?void 0:t.views.get(e.viewId),r=t.doc.walkthroughs.find(a=>a.id===bp(e.viewId)),s=n?Yr(n):void 0,i=e.selection?t.describe(e.selection):void 0,o=n?e.pinned.includes(n.id):!1;return d.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-1 border-b border-rule bg-paper px-2",children:[d.jsx(rt,{label:e.sidebarOpen?"Hide sidebar":"Show sidebar",shortcut:"[",onClick:()=>e.toggleSidebar(),side:"bottom",active:!1,children:d.jsx(gE,{size:16})}),d.jsx(rt,{label:"Back",shortcut:"⌥←",onClick:e.goBack,disabled:e.back.length===0,side:"bottom",children:d.jsx(L_,{size:16})}),d.jsx("span",{className:"hidden sm:contents",children:d.jsx(rt,{label:"Forward",shortcut:"⌥→",onClick:e.goForward,disabled:e.forward.length===0,side:"bottom",children:d.jsx(Gr,{size:16})})}),d.jsxs("nav",{"aria-label":"Breadcrumb",className:"ml-2 flex min-w-0 items-center gap-1.5 text-[13px]",children:[d.jsx("button",{type:"button",className:`truncate rounded px-1 text-ink-2 hover:text-ink ${n||r?"hidden sm:inline":""}`,onClick:()=>e.navigate(xt),children:t.doc.project.name}),r&&d.jsxs(d.Fragment,{children:[d.jsx(zl,{className:"hidden sm:inline"}),d.jsx("span",{className:"hidden text-ink-3 sm:inline",children:"Walkthrough"}),d.jsx(zl,{className:"hidden sm:inline"}),d.jsx("span",{className:"truncate font-semibold text-ink",children:Nr(r.title)})]}),n&&d.jsxs(d.Fragment,{children:[d.jsx(zl,{className:"hidden sm:inline"}),d.jsx("span",{className:"hidden truncate text-ink-3 sm:inline",children:zd(n.category)}),d.jsx(zl,{className:"hidden sm:inline"}),d.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 font-semibold text-ink",children:[s&&d.jsx(s.icon,{size:14,className:"shrink-0 text-ink-3","aria-hidden":!0}),d.jsx("span",{className:"truncate",children:n.title})]})]}),i&&!r&&d.jsxs(d.Fragment,{children:[d.jsx(zl,{className:"hidden md:inline"}),d.jsx("button",{type:"button",className:"hidden max-w-[220px] truncate rounded px-1 text-poney hover:underline md:inline",onClick:()=>e.selection&&e.requestFocus("zoom",e.selection),title:"Zoom to the selection",children:i.title})]}),n&&d.jsx("span",{className:"hidden sm:contents",children:d.jsx(rt,{label:o?"Unpin this diagram":"Pin this diagram",onClick:()=>e.togglePin(n.id),active:o,side:"bottom",children:d.jsx(WE,{size:14,fill:o?"currentColor":"none"})})})]}),d.jsx("div",{className:"flex-1"}),d.jsx(v9,{}),d.jsx(rt,{label:"Undo",shortcut:"⌘Z",onClick:e.undo,disabled:!e.history.past.length,side:"bottom",children:d.jsx(tz,{size:16})}),d.jsx(rt,{label:"Redo",shortcut:"⇧⌘Z",onClick:e.redo,disabled:!e.history.future.length,side:"bottom",children:d.jsx(VD,{size:16})}),d.jsx("span",{className:"mx-1 h-5 w-px bg-rule","aria-hidden":!0}),d.jsx(k9,{}),d.jsx(g9,{}),d.jsxs("button",{type:"button",onClick:()=>e.setPaletteOpen(!0),className:"mr-1 hidden h-8 w-64 items-center gap-2 rounded-lg border border-rule bg-plaster px-2.5 text-left text-ink-3 transition-colors hover:border-rule-strong hover:text-ink-2 md:flex",children:[d.jsx(Oy,{size:14}),d.jsx("span",{className:"flex-1",children:"Search this document"}),d.jsx("kbd",{className:"rounded border border-rule bg-raised px-1 text-[11px]",children:"⌘K"})]}),d.jsx("span",{className:"md:hidden",children:d.jsx(rt,{label:"Search",shortcut:"⌘K",onClick:()=>e.setPaletteOpen(!0),side:"bottom",children:d.jsx(Oy,{size:16})})}),d.jsxs("span",{className:"hidden sm:contents",children:[d.jsx(rt,{label:"Open or paste a model",onClick:()=>e.setImportOpen(!0),side:"bottom",children:d.jsx(r1,{size:16})}),d.jsx(x9,{}),d.jsx(rt,{label:e.theme==="light"?"Dark theme":"Light theme",onClick:e.toggleTheme,side:"bottom",children:e.theme==="light"?d.jsx(o1,{size:16}):d.jsx(HE,{size:16})}),d.jsx(rt,{label:"Keyboard shortcuts",shortcut:"?",onClick:()=>e.setShortcutsOpen(!0),side:"bottom",children:d.jsx(UN,{size:16})})]}),d.jsx(rt,{label:e.inspectorOpen?"Hide inspector":"Show inspector",shortcut:"]",onClick:()=>e.toggleInspector(),side:"bottom",children:d.jsx(ID,{size:16})})]})}function zl({className:t=""}){return d.jsx("span",{className:`text-ink-4 ${t}`,"aria-hidden":!0,children:"/"})}function x9(){const[t,e]=b.useState(!1),n=b.useRef(null);b.useEffect(()=>{if(!t)return;const s=o=>{var a;return!((a=n.current)!=null&&a.contains(o.target))&&e(!1)},i=o=>o.key==="Escape"&&e(!1);return window.addEventListener("mousedown",s),window.addEventListener("keydown",i),()=>{window.removeEventListener("mousedown",s),window.removeEventListener("keydown",i)}},[t]);const r="flex w-full items-center gap-2.5 rounded-md px-2.5 py-2 text-left text-[13px] hover:bg-sunken";return d.jsxs("div",{className:"relative",ref:n,children:[d.jsx(rt,{label:"Export the model",onClick:()=>e(!t),active:t,side:"bottom",children:d.jsx(JD,{size:16})}),t&&d.jsxs("div",{role:"menu",className:"fade-in absolute right-0 top-10 z-40 w-64 rounded-xl border border-rule bg-raised p-1 shadow-float",children:[d.jsxs("button",{role:"menuitem",type:"button",className:r,onClick:()=>{e(!1),T1()},children:[d.jsx(fN,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"flex-1",children:"Copy JSON"}),d.jsx("kbd",{className:"text-[11px] text-ink-3",children:"⇧⌘C"})]}),d.jsxs("button",{role:"menuitem",type:"button",className:r,onClick:()=>{e(!1),qF()},children:[d.jsx(mD,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"flex-1",children:"Download .poney"})]}),d.jsx("p",{className:"px-2.5 pb-1.5 pt-1 text-[11.5px] leading-snug text-ink-3",children:"Paste Poney JSON or Mermaid anywhere in the studio to open it."})]})]})}function v9(){const t=T(n=>n.live.state==="on"?n.liveFile:null);return T(n=>n.history.past.length>0||n.history.future.length>0)?d.jsx("span",{className:"mr-1 hidden text-[12px] text-ink-3 lg:inline",title:t?`Every change is saved to ${t}. Undo goes back one change at a time.`:"Changes are kept in this browser. Use Download to keep a file.",children:t?`Saved to ${t.split("/").pop()}`:"Kept in this browser"}):null}function k9(){const t=T(r=>r.live);if(t.state==="off")return null;const e=t.state==="on",n=e?"Live":t.state==="connecting"?"Connecting":"Offline";return d.jsxs("span",{title:e?"Linked to Poney on this computer: agents can open documents here, you can talk to them, and documents are saved to their files.":"Poney on this computer does not answer. Agents and saving to files are off until it is back.",className:`mr-2 hidden items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-[12px] font-semibold sm:inline-flex ${e?"border-new/40 bg-new-wash text-new":"border-rule text-ink-3"}`,children:[d.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${e?"bg-new":"bg-ink-4"}`}),n]})}function w9(){const t=T(n=>n.sidebarOpen),e=T(n=>n.toggleSidebar);return d.jsxs(d.Fragment,{children:[t&&d.jsx("div",{className:"fixed inset-0 z-20 bg-ink/20 lg:hidden",onClick:()=>e(!1),"aria-hidden":!0}),d.jsxs("aside",{"aria-label":"Project navigation",className:`scrollbar-quiet z-30 flex w-[264px] shrink-0 flex-col overflow-y-auto border-r border-rule bg-paper transition-[margin] duration-200 max-lg:fixed max-lg:bottom-0 max-lg:top-12 max-lg:shadow-float ${t?"ml-0":"-ml-[264px] max-lg:invisible"}`,children:[d.jsx(b9,{}),d.jsx("div",{className:"px-2 pb-1",children:d.jsxs("button",{type:"button",onClick:()=>T.getState().setPaletteOpen(!0),className:"flex h-8 w-full items-center gap-2 rounded-md px-2 text-ink-3 hover:bg-sunken hover:text-ink-2",children:[d.jsx(Oy,{size:14}),d.jsx("span",{className:"flex-1 text-left",children:"Search"}),d.jsx("kbd",{className:"text-[11px]",children:"/"})]})}),d.jsx(j9,{}),d.jsx(C9,{})]})]})}function b9(){const t=T(o=>o.projects),e=T(o=>o.projectId),n=ze(),[r,s]=b.useState(!1),i=b.useRef(null);return b.useEffect(()=>{if(!r)return;const o=l=>{var c;return!((c=i.current)!=null&&c.contains(l.target))&&s(!1)},a=l=>l.key==="Escape"&&s(!1);return window.addEventListener("mousedown",o),window.addEventListener("keydown",a),()=>{window.removeEventListener("mousedown",o),window.removeEventListener("keydown",a)}},[r]),d.jsxs("div",{className:"relative p-2",ref:i,children:[d.jsxs("button",{type:"button","aria-haspopup":"listbox","aria-expanded":r,onClick:()=>s(!r),className:"flex w-full items-center gap-2.5 rounded-lg p-1.5 text-left hover:bg-sunken",children:[d.jsx(sT,{}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block truncate text-[13.5px] font-semibold",children:n.doc.project.name}),d.jsx(S9,{fallback:`Poney ${n.doc.poneyVersion}`})]}),d.jsx(eN,{size:14,className:"text-ink-3"})]}),r&&d.jsxs("div",{role:"listbox","aria-label":"Projects",className:"fade-in absolute left-2 right-2 top-14 z-40 rounded-xl border border-rule bg-raised p-1 shadow-float",children:[t.map(o=>d.jsxs("button",{role:"option","aria-selected":o.id===e,type:"button",className:"flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left hover:bg-sunken",onClick:()=>{s(!1),T.getState().switchProject(o.id)},children:[d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block truncate",children:o.doc.project.name}),d.jsx("span",{className:"block text-[11.5px] text-ink-3",children:o.origin==="example"?"Example":o.origin==="pasted"?"Pasted":"Imported"})]}),o.id===e&&d.jsx(bs,{size:14,className:"text-poney"})]},o.id)),d.jsx("div",{className:"my-1 h-px bg-rule"}),d.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-ink-2 hover:bg-sunken",onClick:()=>{s(!1),T.getState().setImportOpen(!0)},children:[d.jsx(r1,{size:14}),"Open or paste a model…"]}),T.getState().live.state==="on"&&d.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-ink-2 hover:bg-sunken",onClick:()=>{s(!1),T.getState().setProjectOpen(!0)},children:[d.jsx(s1,{size:14}),"Open a project…"]}),T.getState().live.state==="on"&&T.getState().project&&d.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-ink-2 hover:bg-sunken",onClick:()=>{s(!1),T.getState().setImportCodeOpen(!0)},children:[d.jsx(pD,{size:14}),"Import from the code…"]}),d.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-ink-2 hover:bg-sunken",onClick:()=>{s(!1),T.getState().showStart(!0)},children:[d.jsx(vD,{size:14}),"Start page"]})]})]})}function S9({fallback:t}){const e=T(r=>r.live.state==="on"?r.liveFile:null);if(!e)return d.jsx("span",{className:"block truncate text-[11.5px] text-ink-3",children:t});const n=e.split("/").slice(-3).join("/");return d.jsxs("span",{className:"block truncate text-[11.5px] text-ink-3",title:`Saved to ${e}`,children:["Saved to ",n]})}function sT(){return d.jsxs("svg",{width:"30",height:"30",viewBox:"-22 -18 156 152","aria-hidden":!0,className:"shrink-0",children:[d.jsx("rect",{x:"-22",y:"-18",width:"156",height:"152",rx:"36",fill:"var(--ink)"}),d.jsx("path",{d:"M40 26V86M40 26H62A17 17 0 0 1 62 60H40",fill:"none",stroke:"var(--paper)",strokeWidth:"6",strokeLinejoin:"round"}),d.jsx("rect",{x:"28",y:"16",width:"24",height:"20",rx:"5",fill:"var(--paper)"}),d.jsx("rect",{x:"28",y:"50",width:"24",height:"20",rx:"5",fill:"var(--paper)"}),d.jsx("rect",{x:"28",y:"76",width:"24",height:"20",rx:"5",fill:"var(--accent)"})]})}function jb({view:t,active:e}){const n=Yr(t),r=(n==null?void 0:n.icon)??bo;return d.jsxs("button",{type:"button","aria-current":e?"page":void 0,onClick:()=>T.getState().navigate(t.id),className:`group flex h-8 w-full items-center gap-2.5 rounded-md px-2 text-left transition-colors ${e?"bg-sunken font-semibold text-ink":"text-ink-2 hover:bg-sunken/70 hover:text-ink"}`,title:t.description,children:[d.jsx(r,{size:15,className:e?"text-poney":"text-ink-3 group-hover:text-ink-2","aria-hidden":!0}),d.jsx("span",{className:"truncate",children:t.title})]})}function j9(){const t=ze(),e=T(i=>i.viewId),n=T(i=>i.pinned),r=JM([...new Set(t.doc.views.map(i=>i.category))]).filter(i=>i!=="walkthrough"),s=n.map(i=>t.views.get(i)).filter(i=>!!i);return d.jsxs("nav",{"aria-label":"Diagrams",className:"px-2",children:[d.jsxs("button",{type:"button","aria-current":e===xt?"page":void 0,onClick:()=>T.getState().navigate(xt),className:`flex h-8 w-full items-center gap-2.5 rounded-md px-2 text-left ${e===xt?"bg-sunken font-semibold":"text-ink-2 hover:bg-sunken/70 hover:text-ink"}`,children:[d.jsx(bo,{size:15,className:e===xt?"text-poney":"text-ink-3"}),"Project overview"]}),t.doc.walkthroughs.length>0&&d.jsx(Zu,{title:"Walkthroughs",children:t.doc.walkthroughs.map(i=>{const o=e===`walk:${i.id}`;return d.jsxs("button",{type:"button","aria-current":o?"page":void 0,onClick:()=>T.getState().navigate(`walk:${i.id}`),className:`group flex w-full items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors ${o?"bg-sunken font-semibold text-ink":"text-ink-2 hover:bg-sunken/70 hover:text-ink"}`,children:[d.jsx(gp,{size:15,className:`mt-[2px] shrink-0 ${o?"text-poney":"text-ink-3"}`,"aria-hidden":!0}),d.jsx("span",{className:"leading-snug",children:Nr(i.title)})]},i.id)})}),s.length>0&&d.jsx(Zu,{title:"Pinned",icon:d.jsx(WE,{size:11,className:"text-ink-3"}),children:s.map(i=>d.jsx(jb,{view:i,active:!1},`pin-${i.id}`))}),r.map(i=>d.jsx(Zu,{title:zd(i),children:t.doc.views.filter(o=>o.category===i).map(o=>d.jsx(jb,{view:o,active:o.id===e},o.id))},i))]})}function Zu({title:t,icon:e,children:n}){return d.jsxs("div",{className:"mt-4",children:[d.jsxs("h2",{className:"mb-1 flex items-center gap-1.5 px-2 text-[11.5px] font-semibold text-ink-3",children:[e,t]}),d.jsx("div",{className:"space-y-px",children:n})]})}function C9(){const t=ze(),e=b.useMemo(()=>t.doc.model.entities.filter(r=>!r.parent&&!r.kind.includes("/")),[t]),n=[{title:"System",items:e.filter(r=>r.kind!=="person"&&r.kind!=="external")},{title:"People",items:e.filter(r=>r.kind==="person")},{title:"Outside services",items:e.filter(r=>r.kind==="external")}].filter(r=>r.items.length);return d.jsx("div",{className:"mt-2 px-2 pb-6",children:n.map(r=>d.jsx(Zu,{title:r.title,children:d.jsx("ul",{role:"tree","aria-label":r.title,children:r.items.map(s=>d.jsx(iT,{entity:s,depth:0},s.id))})},r.title))})}function iT({entity:t,depth:e}){const n=ze(),r=T(u=>u.selection),s=n.children(t.id),[i,o]=b.useState(e===0),a=n.style(t),l=Md(a.icon),c=(r==null?void 0:r.kind)==="entity"&&r.id===t.id;return d.jsxs("li",{role:"treeitem","aria-expanded":s.length?i:void 0,"aria-selected":c,children:[d.jsxs("div",{className:`flex h-7 items-center rounded-md ${c?"bg-poney-wash":"hover:bg-sunken/70"}`,style:{paddingLeft:e*14},children:[s.length?d.jsx("button",{type:"button","aria-label":i?`Close ${t.name}`:`Open ${t.name}`,className:"grid h-6 w-5 place-items-center text-ink-3 hover:text-ink",onClick:()=>o(!i),children:d.jsx(_d,{size:13,className:`transition-transform ${i?"rotate-90":""}`})}):d.jsx("span",{className:"w-5"}),d.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 pr-2 text-left",onClick:()=>Ad({kind:"entity",id:t.id}),title:t.summary,children:[d.jsx(l,{size:13,style:{color:dt(a.tone)},className:"shrink-0","aria-hidden":!0}),d.jsx("span",{className:`truncate text-[12.5px] ${c?"font-semibold text-poney":"text-ink-2"}`,children:t.name})]})]}),i&&s.length>0&&d.jsx("ul",{role:"group",children:s.map(u=>d.jsx(iT,{entity:u,depth:e+1},u.id))})]})}const _9=t=>t==="table"?d.jsx(Ed,{size:14}):t==="event"?d.jsx(c$,{size:14}):d.jsx(jN,{size:14});function yi({id:t,secondary:e}){const r=ze().dataTypes.get(t);return r?d.jsx(vt,{to:{kind:"dataType",id:t},label:d.jsx("span",{className:r.kind==="table"?"font-mono text-[12px]":"",children:r.name}),secondary:e??r.summary,icon:_9(r.kind),tone:"var(--malachite)"}):null}function Op({refValue:t,title:e="Seen in diagrams",exclude:n=[]}){const r=ze(),s=T(o=>o.viewId),i=r.viewsShowing(t).filter(o=>o.id!==s&&!n.includes(o.id));return i.length?d.jsx(ve,{title:e,count:i.length,children:i.map(o=>d.jsx(Rd,{view:o,select:t},o.id))}):null}function N9({refValue:t}){const e=ze();return d.jsx(d.Fragment,{children:lL().map(n=>{const r=n.render({ref:t,doc:e.doc,idx:e});return r?d.jsx(ve,{title:n.title,children:r},n.id):null})})}function E9({id:t}){const e=ze(),n=e.entities.get(t);if(!n)return null;const r=e.outgoing(t).filter(h=>h.kind!=="depends-on"&&h.kind!=="implements"),s=e.incoming(t).filter(h=>h.kind!=="depends-on"&&h.kind!=="implements"),i=e.outgoing(t).filter(h=>h.kind==="depends-on"||h.kind==="implements"),o=e.incoming(t).filter(h=>h.kind==="depends-on"||h.kind==="implements"),a=e.behaviorsInvolving(t),l=e.dataOf(t),c=e.capabilitiesOf(t),u=e.children(t),f=n.parent?e.entities.get(n.parent):void 0;return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"About",children:[d.jsx(Bt,{children:n.description??n.summary}),d.jsx("div",{className:"mt-3",children:d.jsx(An,{items:[["Kind",e.style(n).label],["Technology",n.technology],["Part of",f?d.jsx("button",{className:"text-left hover:text-poney hover:underline",onClick:()=>T.getState().select({kind:"entity",id:f.id}),children:f.name}):void 0]]})}),n.tags.length>0&&d.jsx("div",{className:"mt-3",children:d.jsx(GL,{items:n.tags})})]}),d.jsx(N9,{refValue:{kind:"entity",id:t}}),(r.length>0||s.length>0)&&d.jsxs(ve,{title:"Connections",count:r.length+s.length,children:[r.map(h=>{var m;return d.jsx(vt,{to:{kind:"relationship",id:h.id},label:d.jsxs(d.Fragment,{children:[h.label," ",d.jsxs("span",{className:"text-ink-3",children:["→ ",(m=e.entities.get(h.target))==null?void 0:m.name]})]}),secondary:h.protocol,icon:d.jsx(Gr,{size:14}),tone:"var(--ink-3)"},h.id)}),s.map(h=>{var m;return d.jsx(vt,{to:{kind:"relationship",id:h.id},label:d.jsxs(d.Fragment,{children:[d.jsxs("span",{className:"text-ink-3",children:[(m=e.entities.get(h.source))==null?void 0:m.name," →"]})," ",h.label.charAt(0).toLowerCase()+h.label.slice(1)]}),secondary:h.protocol,icon:d.jsx(Gr,{size:14,className:"rotate-180"}),tone:"var(--ink-3)"},h.id)})]}),(i.length>0||o.length>0)&&d.jsxs(ve,{title:"Code dependencies",count:i.length+o.length,children:[i.map(h=>d.jsx(Mt,{id:h.target,secondary:h.kind==="implements"?"Implements this interface":`Uses it: ${h.label.toLowerCase()}`},h.id)),o.map(h=>d.jsx(Mt,{id:h.source,secondary:h.kind==="implements"?"Implements this":`Depends on this: ${h.label.toLowerCase()}`},h.id))]}),a.length>0&&d.jsx(ve,{title:"Takes part in",count:a.length,children:a.map(h=>e.viewsForBehavior(h.id).map(m=>d.jsx(Rd,{view:m,select:{kind:"entity",id:t},verb:"Open"},`${h.id}-${m.id}`)))}),(l.consumed.size>0||l.produced.size>0||l.owned.length>0)&&d.jsxs(ve,{title:"Data",children:[l.owned.length>0&&d.jsx("p",{className:"mb-1 text-[11.5px] text-ink-3",children:"Owns or stores"}),l.owned.map(h=>d.jsx(yi,{id:h.id},`o-${h.id}`)),l.consumed.size>0&&d.jsx("p",{className:"mb-1 mt-2 text-[11.5px] text-ink-3",children:"Receives"}),[...l.consumed.entries()].map(([h,m])=>d.jsx(yi,{id:h,secondary:`From ${m.map(g=>{var p;return(p=e.entities.get(g.source))==null?void 0:p.name}).join(", ")}`},`c-${h}`)),l.produced.size>0&&d.jsx("p",{className:"mb-1 mt-2 text-[11.5px] text-ink-3",children:"Sends"}),[...l.produced.entries()].map(([h,m])=>d.jsx(yi,{id:h,secondary:`To ${m.map(g=>{var p;return(p=e.entities.get(g.target))==null?void 0:p.name}).join(", ")}`},`p-${h}`))]}),u.length>0&&d.jsx(ve,{title:"Contains",count:u.length,children:u.map(h=>d.jsx(Mt,{id:h.id},h.id))}),c.length>0&&d.jsx(ve,{title:n.kind==="person"?"Can":"Makes possible",count:c.length,children:c.map(h=>d.jsx(vt,{to:{kind:"capability",id:h.id},label:h.name,secondary:h.summary,icon:d.jsx($d,{size:14}),tone:"var(--tyrian)"},h.id))}),d.jsx(Op,{refValue:{kind:"entity",id:t},title:"Also seen in",exclude:a.flatMap(h=>e.viewsForBehavior(h.id).map(m=>m.id))}),d.jsx($$,{refs:n.sourceRefs})]})}function $9({id:t}){var s,i;const e=ze(),n=e.relationships.get(t);if(!n)return null;const r=e.messagesAlong(t);return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"About",children:[d.jsx(Bt,{children:n.description??`${(s=e.entities.get(n.source))==null?void 0:s.name} ${n.label.charAt(0).toLowerCase()+n.label.slice(1)} ${(i=e.entities.get(n.target))==null?void 0:i.name}.`}),d.jsx("div",{className:"mt-3",children:d.jsx(An,{items:[["Kind",M9(n.kind)],["Protocol",n.protocol]]})})]}),d.jsxs(ve,{title:"Between",children:[d.jsx(Mt,{id:n.source,secondary:"From"}),d.jsx(Mt,{id:n.target,secondary:"To"})]}),n.data.length>0&&d.jsx(ve,{title:"Carries",count:n.data.length,children:n.data.map(o=>d.jsx(yi,{id:o},o))}),r.length>0&&d.jsx(ve,{title:"Used in these steps",count:r.length,children:r.map(({interaction:o,item:a})=>d.jsx(vt,{to:{kind:"message",behavior:o.id,id:a.message.id},label:a.message.label,secondary:`${o.name}, step ${a.number}`,icon:d.jsx($d,{size:14}),tone:"var(--lapis)"},`${o.id}-${a.message.id}`))}),d.jsx(Op,{refValue:{kind:"relationship",id:t}})]})}const M9=t=>({uses:"Used by a person",calls:"Request, waits for an answer",reads:"Reads",writes:"Writes","reads-writes":"Reads and writes",publishes:"Publishes events",subscribes:"Subscribes to events","depends-on":"Code dependency",implements:"Implements an interface"})[t]??t;function T9({id:t,field:e}){var a,l,c;const n=ze(),r=n.dataTypes.get(t);if(!r)return null;const s=n.usagesOfData(t),i=e?r.fields.find(u=>u.name===e):void 0,o=e?s.relations.filter(u=>u.via===e):[];return d.jsxs(d.Fragment,{children:[i&&d.jsxs(ve,{title:`Field ${i.name}`,children:[i.description&&d.jsx(Bt,{children:i.description}),d.jsx("div",{className:"mt-2",children:d.jsx(An,{items:[["Type",d.jsx("code",{className:"font-mono text-[12px]",children:i.type})],["Key",i.primaryKey?"Primary key":i.references?"Foreign key":void 0],["Unique",i.unique?"Yes":void 0],["Can be empty",i.nullable?"Yes":"No"]]})}),i.references&&d.jsx("div",{className:"mt-2",children:d.jsx(vt,{to:{kind:"dataType",id:i.references.dataType,field:i.references.field},label:d.jsxs("span",{className:"font-mono text-[12px]",children:[(a=n.dataTypes.get(i.references.dataType))==null?void 0:a.name,".",i.references.field]}),secondary:"References",icon:d.jsx(oo,{size:14}),tone:"var(--lapis)"})}),o.map(u=>{var h;const f=u.from===t?u.to:u.from;return d.jsx(vt,{to:{kind:"dataType",id:f},label:d.jsx("span",{className:"font-mono text-[12px]",children:(h=n.dataTypes.get(f))==null?void 0:h.name}),secondary:u.logical?"Logical reference across services; no database constraint":"Linked by this field",icon:d.jsx(oo,{size:14}),tone:"var(--lapis)"},u.id)})]}),d.jsxs(ve,{title:i?`About ${r.name}`:"About",children:[d.jsx(Bt,{children:r.description??r.summary}),d.jsx("div",{className:"mt-3",children:d.jsx(An,{items:[["Kind",r.kind==="table"?"Table":r.kind==="event"?"Event":r.kind==="document"?"Document":"Record"],["Owned by",r.ownedBy?d.jsx("button",{className:"text-left hover:text-poney hover:underline",onClick:()=>T.getState().select({kind:"entity",id:r.ownedBy}),children:(l=n.entities.get(r.ownedBy))==null?void 0:l.name}):void 0],["Stored in",r.storedIn?(c=n.entities.get(r.storedIn))==null?void 0:c.name:void 0]]})})]}),!i&&r.fields.length>0&&d.jsx(ve,{title:"Fields",count:r.fields.length,children:d.jsx("ul",{className:"space-y-0.5",children:r.fields.map(u=>d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>T.getState().select({kind:"dataType",id:t,field:u.name}),className:"-mx-2 flex w-[calc(100%+16px)] items-center gap-2 rounded-md px-2 py-1 text-left hover:bg-sunken",children:[d.jsx("span",{className:"w-3.5 shrink-0",children:u.primaryKey?d.jsx(bD,{size:12,className:"text-[color:var(--ochre)]"}):u.references?d.jsx(oo,{size:12,className:"text-[color:var(--lapis)]"}):null}),d.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-ink",children:u.name}),d.jsxs("code",{className:"shrink-0 font-mono text-[11px] text-ink-3",children:[u.type,u.nullable?"?":""]})]})},u.name))})}),s.lifecycles.length>0&&d.jsx(ve,{title:"Lifecycle",children:s.lifecycles.flatMap(u=>n.viewsForBehavior(u.id)).map(u=>d.jsx(Rd,{view:u,select:{kind:"dataType",id:t}},u.id))}),s.flows.length>0&&d.jsx(ve,{title:"Moves between",count:s.flows.length,children:s.flows.map(u=>{var f,h;return d.jsx(vt,{to:{kind:"dataFlow",id:u.id},label:`${(f=n.entities.get(u.source))==null?void 0:f.name} → ${(h=n.entities.get(u.target))==null?void 0:h.name}`,secondary:u.label,icon:d.jsx(Gr,{size:14}),tone:"var(--malachite)"},u.id)})}),s.messages.length>0&&d.jsx(ve,{title:"Sent in these steps",count:s.messages.length,children:s.messages.map(({interaction:u,item:f})=>d.jsx(vt,{to:{kind:"message",behavior:u.id,id:f.message.id},label:f.message.label,secondary:`${u.name}, step ${f.number}`,icon:d.jsx($d,{size:14}),tone:"var(--lapis)"},`${u.id}-${f.message.id}`))}),d.jsx(Op,{refValue:{kind:"dataType",id:t}}),d.jsx($$,{refs:r.sourceRefs})]})}function O9({id:t}){const e=ze(),n=e.dataRelations.get(t);if(!n)return null;const r=e.dataTypes.get(n.from),s=e.dataTypes.get(n.to),i=o=>({one:"exactly one","zero-or-one":"at most one",many:"any number of","one-or-many":"at least one"})[o];return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"Reads as",children:[d.jsxs(Bt,{children:["Each ",d.jsx("code",{className:"font-mono",children:r==null?void 0:r.name})," row ",n.label," ",i(n.toCardinality)," ",d.jsx("code",{className:"font-mono",children:s==null?void 0:s.name})," row",n.toCardinality==="one"||n.toCardinality==="zero-or-one"?"":"s",". Each ",d.jsx("code",{className:"font-mono",children:s==null?void 0:s.name})," row belongs to ",i(n.fromCardinality)," ",d.jsx("code",{className:"font-mono",children:r==null?void 0:r.name})," row",n.fromCardinality==="one"||n.fromCardinality==="zero-or-one"?"":"s","."]}),d.jsx("div",{className:"mt-3",children:d.jsx(An,{items:[["Through",n.via?d.jsx("code",{className:"font-mono text-[12px]",children:n.via}):void 0],["Enforced",n.logical?"No. The tables live in different databases; the services keep it consistent.":"Yes, by a foreign key"]]})})]}),d.jsxs(ve,{title:"Tables",children:[d.jsx(yi,{id:n.from}),d.jsx(yi,{id:n.to})]})]})}function A9({id:t}){var r,s,i;const e=ze(),n=e.dataFlows.get(t);return n?d.jsxs(d.Fragment,{children:[d.jsx(ve,{title:"About",children:d.jsx(Bt,{children:n.description??`${(r=e.entities.get(n.source))==null?void 0:r.name} sends ${n.label.charAt(0).toLowerCase()+n.label.slice(1)} to ${(s=e.entities.get(n.target))==null?void 0:s.name}.`})}),d.jsx(ve,{title:"Data",count:n.data.length,children:n.data.map(o=>{const a=e.dataTypes.get(o);return d.jsxs("div",{className:"mb-2",children:[d.jsx(yi,{id:o}),a&&a.fields.length>0&&d.jsx("p",{className:"ml-6 font-mono text-[11px] leading-relaxed text-ink-3",children:a.fields.map(l=>l.name).join(", ")})]},o)})}),d.jsxs(ve,{title:"Between",children:[d.jsx(Mt,{id:n.source,secondary:"From"}),d.jsx(Mt,{id:n.target,secondary:"To"}),n.via&&d.jsx(vt,{to:{kind:"relationship",id:n.via},label:(i=e.relationships.get(n.via))==null?void 0:i.label,secondary:"Carried by this connection",icon:d.jsx(oo,{size:14}),tone:"var(--ink-3)"})]}),d.jsx(Op,{refValue:{kind:"dataFlow",id:t}})]}):null}function R9({behavior:t,id:e}){var c,u;const n=ze(),r=n.messages(t).find(f=>f.message.id===e);if(!r)return null;const s=r.message,i=n.messages(t),o=i[r.number-2],a=i[r.number],l={call:"Request, waits for an answer",return:"Answer to an earlier request",async:"Sent without waiting",self:"Work done inside one participant"}[s.kind];return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"About",children:[s.description&&d.jsx(Bt,{children:s.description}),d.jsx("div",{className:s.description?"mt-3":"",children:d.jsx(An,{items:[["Step",`${r.number} of ${i.length}`],["Kind",l],["When",r.context.length?r.context.map(f=>`${jd(f.fragment.kind).toLowerCase()}: ${f.guard}`).join(", then "):void 0]]})})]}),d.jsxs(ve,{title:"Between",children:[d.jsx(Mt,{id:s.from,secondary:"From"}),s.to!==s.from&&d.jsx(Mt,{id:s.to,secondary:"To"})]}),s.data.length>0&&d.jsx(ve,{title:"Carries",children:s.data.map(f=>d.jsx(yi,{id:f},f))}),s.relationship&&d.jsx(ve,{title:"Connection",children:d.jsx(vt,{to:{kind:"relationship",id:s.relationship},label:(c=n.relationships.get(s.relationship))==null?void 0:c.label,secondary:(u=n.relationships.get(s.relationship))==null?void 0:u.protocol,icon:d.jsx(oo,{size:14}),tone:"var(--ink-3)"})}),d.jsx(ve,{title:"Step through",children:d.jsxs("div",{className:"flex gap-2",children:[d.jsxs("button",{type:"button",disabled:!o,onClick:()=>o&&T.getState().select({kind:"message",behavior:t,id:o.message.id},{focus:"center"}),className:"flex-1 rounded-md border border-rule px-2 py-1.5 text-[12px] hover:bg-sunken disabled:opacity-35",children:["← Step ",r.number-1||""]}),d.jsxs("button",{type:"button",disabled:!a,onClick:()=>a&&T.getState().select({kind:"message",behavior:t,id:a.message.id},{focus:"center"}),className:"flex-1 rounded-md border border-rule px-2 py-1.5 text-[12px] hover:bg-sunken disabled:opacity-35",children:["Step ",a?r.number+1:""," →"]})]})})]})}function I9({behavior:t,id:e}){const r=ze().findFragment(t,e);if(!r)return null;const s={alt:"Exactly one of these paths happens, depending on the condition.",opt:"This happens only when the condition is true.",loop:"These steps repeat.",par:"These paths happen at the same time."}[r.kind];return d.jsxs(ve,{title:jd(r.kind),children:[d.jsx(Bt,{children:s}),d.jsx("ol",{className:"mt-2 space-y-1.5",children:r.branches.map((i,o)=>d.jsxs("li",{className:"rounded-md bg-sunken px-2.5 py-1.5 text-[12.5px]",children:[d.jsx("span",{className:"text-ink-3",children:r.kind==="loop"?"Repeat":r.kind==="par"?"Path":"If"})," ",i.guard,d.jsxs("span",{className:"text-ink-3",children:[" — ",i.steps.length," step",i.steps.length===1?"":"s"]})]},o))})]})}function P9({behavior:t,id:e}){const n=ze(),r=n.process(t),s=r==null?void 0:r.nodes.find(l=>l.id===e);if(!r||!s)return null;const i=r.flows.filter(l=>l.from===e),o=r.flows.filter(l=>l.to===e),a=l=>{var c;return(c=r.nodes.find(u=>u.id===l))==null?void 0:c.label};return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"About",children:[s.description&&d.jsx(Bt,{children:s.description}),d.jsx("div",{className:s.description?"mt-3":"",children:d.jsx(An,{items:[["Step",n.describe({kind:"activityNode",behavior:t,id:e}).kind],["Outcome",s.outcome==="failure"?"Ends in failure":s.outcome==="success"?"Ends in success":void 0]]})})]}),s.performedBy&&d.jsx(ve,{title:"Done by",children:d.jsx(Mt,{id:s.performedBy})}),o.length>0&&d.jsx(ve,{title:"Comes after",children:o.map(l=>d.jsx(vt,{to:{kind:"activityNode",behavior:t,id:l.from},label:a(l.from),secondary:l.guard?`When “${l.guard}”`:void 0,icon:d.jsx(Gr,{size:14,className:"rotate-180"}),tone:"var(--ink-3)"},l.id))}),i.length>0&&d.jsx(ve,{title:s.kind==="decision"?"Branches":"Leads to",children:i.map(l=>d.jsx(vt,{to:{kind:"activityNode",behavior:t,id:l.to},label:a(l.to),secondary:l.guard?`When “${l.guard}”`:void 0,icon:d.jsx(Gr,{size:14}),tone:"var(--ink-3)"},l.id))})]})}function D9({behavior:t,id:e}){var i,o;const r=ze().process(t),s=r==null?void 0:r.flows.find(a=>a.id===e);return!r||!s?null:d.jsxs(ve,{title:"Flow",children:[s.guard&&d.jsxs(Bt,{children:["Taken when the answer is “",s.guard,"”."]}),d.jsxs("div",{className:"mt-2",children:[d.jsx(vt,{to:{kind:"activityNode",behavior:t,id:s.from},label:(i=r.nodes.find(a=>a.id===s.from))==null?void 0:i.label,secondary:"From"}),d.jsx(vt,{to:{kind:"activityNode",behavior:t,id:s.to},label:(o=r.nodes.find(a=>a.id===s.to))==null?void 0:o.label,secondary:"To"})]})]})}function z9({behavior:t,id:e}){var l;const n=ze(),r=n.stateMachine(t),s=r==null?void 0:r.states.find(c=>c.id===e);if(!r||!s)return null;const i=c=>{var u;return(u=r.states.find(f=>f.id===c))==null?void 0:u.name},o=r.transitions.filter(c=>c.from===e),a=r.transitions.filter(c=>c.to===e);return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"About",children:[s.description&&d.jsx(Bt,{children:s.description}),d.jsx("div",{className:s.description?"mt-3":"",children:d.jsx(An,{items:[["Kind",s.kind==="initial"?"Where every lifecycle starts":s.kind==="final"?"Final. Nothing happens after this.":"State"],["Stored as",r.subject?d.jsxs("code",{className:"font-mono text-[12px]",children:[(l=n.dataTypes.get(r.subject))==null?void 0:l.name,".status"]}):void 0]]})})]}),s.entryActions.length>0&&d.jsx(ve,{title:"On entry",children:d.jsx("ul",{className:"list-disc space-y-0.5 pl-4 text-[12.5px] text-ink-2",children:s.entryActions.map(c=>d.jsx("li",{children:c},c))})}),o.length>0&&d.jsx(ve,{title:"Can move to",count:o.length,children:o.map(c=>d.jsx(vt,{to:{kind:"transition",behavior:t,id:c.id},label:i(c.to),secondary:`${c.event}${c.guard?`, only when ${c.guard}`:""}`,icon:d.jsx(Gr,{size:14}),tone:"var(--ink-3)"},c.id))}),a.length>0&&d.jsx(ve,{title:"Reached from",count:a.length,children:a.map(c=>d.jsx(vt,{to:{kind:"transition",behavior:t,id:c.id},label:i(c.from),secondary:c.event,icon:d.jsx(Gr,{size:14,className:"rotate-180"}),tone:"var(--ink-3)"},c.id))})]})}function L9({behavior:t,id:e}){var o;const n=ze(),r=n.stateMachine(t),s=r==null?void 0:r.transitions.find(a=>a.id===e);if(!r||!s)return null;const i=a=>{var l;return(l=r.states.find(c=>c.id===a))==null?void 0:l.name};return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"What causes it",children:[d.jsxs(Bt,{children:["When ",d.jsx("strong",{className:"text-ink",children:s.event.charAt(0).toLowerCase()+s.event.slice(1)}),s.guard?d.jsxs(d.Fragment,{children:[", and only if ",s.guard,","]}):""," the ",r.subject?(o=n.dataTypes.get(r.subject))==null?void 0:o.name.replace(/s$/,""):"item"," moves from ",d.jsx("strong",{className:"text-ink",children:i(s.from)})," to ",d.jsx("strong",{className:"text-ink",children:i(s.to)}),"."]}),s.description&&d.jsx("p",{className:"mt-2 text-[12.5px] text-ink-2",children:s.description})]}),s.actions.length>0&&d.jsx(ve,{title:"What happens then",children:d.jsx("ol",{className:"list-decimal space-y-0.5 pl-4 text-[12.5px] text-ink-2",children:s.actions.map(a=>d.jsx("li",{children:a},a))})}),s.triggeredBy&&d.jsx(ve,{title:"Raised by",children:d.jsx(Mt,{id:s.triggeredBy})}),d.jsxs(ve,{title:"States",children:[d.jsx(vt,{to:{kind:"state",behavior:t,id:s.from},label:i(s.from),secondary:"From"}),d.jsx(vt,{to:{kind:"state",behavior:t,id:s.to},label:i(s.to),secondary:"To"})]})]})}function F9({id:t}){const e=ze(),n=e.capabilities.get(t);if(!n)return null;const r=n.behaviors.flatMap(s=>e.viewsForBehavior(s));return d.jsxs(d.Fragment,{children:[d.jsxs(ve,{title:"About",children:[d.jsx(Bt,{children:n.summary}),d.jsx("div",{className:"mt-3",children:d.jsx(An,{items:[["Area",n.area]]})})]}),d.jsxs(ve,{title:"Who",children:[n.actors.map(s=>d.jsx(Mt,{id:s,secondary:"Does it"},s)),n.supporting.map(s=>d.jsx(Mt,{id:s,secondary:"Helps"},s))]}),n.realizedBy.length>0&&d.jsx(ve,{title:"Built by",count:n.realizedBy.length,children:n.realizedBy.map(s=>d.jsx(Mt,{id:s},s))}),r.length>0&&d.jsx(ve,{title:"See how it works",children:r.map(s=>d.jsx(Rd,{view:s},s.id))}),n.includes.length>0&&d.jsx(ve,{title:"Includes",children:n.includes.map(s=>{var i,o;return d.jsx(vt,{to:{kind:"capability",id:s},label:(i=e.capabilities.get(s))==null?void 0:i.name,secondary:(o=e.capabilities.get(s))==null?void 0:o.summary,icon:d.jsx($d,{size:14}),tone:"var(--tyrian)"},s)})})]})}function B9({view:t,id:e}){const r=ze().views.get(t),i=((r==null?void 0:r.type)==="architecture"?r.groups:(r==null?void 0:r.type)==="dependency"?r.layers:[]).find(o=>o.id===e);return i?d.jsxs(d.Fragment,{children:[i.description&&d.jsx(ve,{title:"About",children:d.jsx(Bt,{children:i.description})}),d.jsx(ve,{title:"Members",count:i.members.length,children:i.members.map(o=>d.jsx(Mt,{id:o},o))})]}):null}function V9({id:t}){const e=ze(),n=e.behaviors.get(t);return n?d.jsxs(d.Fragment,{children:[d.jsx(ve,{title:"About",children:d.jsx(Bt,{children:n.description??n.summary})}),d.jsx(ve,{title:"Diagrams",children:e.viewsForBehavior(t).map(r=>d.jsx(Rd,{view:r},r.id))})]}):null}function W9(t){switch(t.kind){case"entity":return d.jsx(E9,{id:t.id});case"relationship":return d.jsx($9,{id:t.id});case"dataType":return d.jsx(T9,{id:t.id,field:t.field});case"dataRelation":return d.jsx(O9,{id:t.id});case"dataFlow":return d.jsx(A9,{id:t.id});case"message":return d.jsx(R9,{behavior:t.behavior,id:t.id});case"fragment":return d.jsx(I9,{behavior:t.behavior,id:t.id});case"activityNode":return d.jsx(P9,{behavior:t.behavior,id:t.id});case"activityFlow":return d.jsx(D9,{behavior:t.behavior,id:t.id});case"state":return d.jsx(z9,{behavior:t.behavior,id:t.id});case"transition":return d.jsx(L9,{behavior:t.behavior,id:t.id});case"capability":return d.jsx(F9,{id:t.id});case"group":return d.jsx(B9,{view:t.view,id:t.id});case"behavior":return d.jsx(V9,{id:t.id})}}function U9(){const t=T(o=>o.inspectorOpen),e=T(o=>o.selection),n=T(o=>o.viewId),r=T(o=>o.toggleInspector),s=ze(),i=n===xt?void 0:s.views.get(n);return t?d.jsx("aside",{"aria-label":"Inspector",className:"scrollbar-quiet z-20 flex w-[340px] shrink-0 flex-col overflow-y-auto border-l border-rule bg-paper max-xl:fixed max-xl:bottom-0 max-xl:right-0 max-xl:top-12 max-xl:shadow-float max-sm:w-full",children:e?d.jsx(Z9,{selection:e,onClose:()=>r(!1)},de(e)):i?d.jsx(H9,{view:i,onClose:()=>r(!1)}):d.jsx(q9,{onClose:()=>r(!1)})}):null}function I1({kind:t,title:e,icon:n,tone:r,onClose:s,actions:i}){return d.jsxs("div",{className:"sticky top-0 z-10 border-b border-rule bg-paper/95 px-4 pb-3 pt-3.5 backdrop-blur",children:[d.jsxs("div",{className:"flex items-center gap-2 text-[11.5px] text-ink-3",children:[d.jsx("span",{className:"flex-1 truncate",children:t}),i,d.jsx("button",{type:"button","aria-label":"Hide inspector",onClick:s,className:"rounded p-1 hover:bg-sunken hover:text-ink",children:d.jsx(zo,{size:14})})]}),d.jsxs("h2",{className:"mt-1 flex items-start gap-2 text-[17px] font-semibold leading-snug tracking-[-0.01em]",children:[n&&d.jsx("span",{className:"mt-[3px] shrink-0",style:{color:r},children:n}),d.jsx("span",{className:"min-w-0 break-words",children:e})]})]})}function Z9({selection:t,onClose:e}){const n=ze(),r=n.describe(t),s=t.kind==="entity"?n.entities.get(t.id):void 0,i=s?n.style(s):void 0,o=i?Md(i.icon):void 0;return d.jsxs("div",{className:"fade-in",children:[d.jsx(I1,{kind:r.kind,title:r.title,icon:o?d.jsx(o,{size:17}):void 0,tone:i?dt(i.tone):void 0,onClose:e,actions:d.jsx("button",{type:"button","aria-label":"Zoom to this element",title:"Zoom to this element (F)",onClick:()=>T.getState().requestFocus("zoom",t),className:"rounded p-1 hover:bg-sunken hover:text-ink",children:d.jsx(OE,{size:14})})}),W9(t)]})}function H9({view:t,onClose:e}){const n=Yr(t),r=ze(),s=n==null?void 0:n.Legend;return d.jsxs("div",{className:"fade-in",children:[d.jsx(I1,{kind:`${zd(t.category)} · ${(n==null?void 0:n.label)??"Extension view"}`,title:t.title,onClose:e}),d.jsx(ve,{title:"What this shows",children:d.jsx(Bt,{children:t.description})}),n&&d.jsx(ve,{title:"How to read it",children:d.jsx(Bt,{children:n.howToRead})}),s&&d.jsx(ve,{title:"Key",children:d.jsx(s,{view:t})}),t.type==="extension"&&d.jsx(ve,{title:"Extension",children:d.jsxs("p",{className:"flex items-center gap-2 text-[12.5px] text-ink-2",children:[d.jsx(CE,{size:14,className:"text-ink-3"}),"Drawn by the ",d.jsx("code",{className:"font-mono text-[12px]",children:t.extension.split("/")[0]})," extension."]})}),d.jsx(ve,{title:"Try this",children:d.jsxs("ul",{className:"list-disc space-y-1 pl-4 text-[12.5px] text-ink-2",children:[d.jsx("li",{children:"Select anything to see what it connects to and where else it appears."}),d.jsx("li",{children:"Double-click a name to change it; it changes in every diagram. Press F to zoom in, Esc to clear."}),d.jsx("li",{children:r.doc.views.length>1?"Use the links in this panel to follow an element into other diagrams.":"Paste another model to open it."})]})})]})}function q9({onClose:t}){const n=ze().doc;return d.jsxs("div",{className:"fade-in",children:[d.jsx(I1,{kind:"Project",title:n.project.name,onClose:t}),d.jsx(ve,{title:"About",children:d.jsx(Bt,{children:n.project.description})}),d.jsx(ve,{title:"Document",children:d.jsxs("dl",{className:"grid grid-cols-[110px_1fr] gap-y-1 text-[12.5px]",children:[d.jsx("dt",{className:"text-ink-3",children:"Format"}),d.jsxs("dd",{children:["Poney ",n.poneyVersion]}),d.jsx("dt",{className:"text-ink-3",children:"Extensions"}),d.jsx("dd",{children:n.extensions.length?n.extensions.map(r=>`${r.name} ${r.version}`).join(", "):"None"}),n.project.repository&&d.jsxs(d.Fragment,{children:[d.jsx("dt",{className:"text-ink-3",children:"Repository"}),d.jsx("dd",{className:"break-all font-mono text-[11.5px]",children:n.project.repository})]})]})})]})}function oT(t){var s;const e=(s=T.getState().history)==null?void 0:s.present;if(!e)return;const n=ft(e);if(!n.exists(t))return;const r=n.describe(t);return{ref:de(t),title:Nr(r.title),kind:r.kind.toLowerCase()}}function K9(t){var n;const e=(n=T.getState().history)==null?void 0:n.present.views.find(r=>r.id===t);return e?{ref:`view:${e.id}`,title:e.title,kind:"diagram"}:void 0}const aT=t=>({title:t.length>60?`${t.slice(0,57)}…`:t,kind:"text",quote:t.slice(0,2e3)}),lT=(t,e,n)=>({title:`${t.split("/").slice(-2).join("/")}:${e}`,kind:"code",quote:`${t}:${e}
650
- ${n}`});function Cb(t,e,n,r){return s=>{var i;(i=window.getSelection())!=null&&i.toString().trim()||(s.preventDefault(),T.getState().openContextMenu({on:"code",path:t,line:e,text:n,note:r,x:s.clientX,y:s.clientY}))}}function Qi(t){if(!t)return;const e=T.getState();e.addChip(t),e.setAgentPanelOpen(!0),requestAnimationFrame(()=>{var n;return(n=document.querySelector('[aria-label="Your question"]'))==null?void 0:n.focus()})}function cT(t){return e=>{e.target.closest("[data-ref]")||(e.preventDefault(),T.getState().openContextMenu({on:"diagram",viewId:t,x:e.clientX,y:e.clientY}))}}function J9(){window.addEventListener("contextmenu",t=>{var r;if(t.defaultPrevented)return;const e=t.target;if(e.closest('input, textarea, [contenteditable="true"]')||!e.closest("main"))return;const n=(r=window.getSelection())==null?void 0:r.toString().trim();n&&(t.preventDefault(),T.getState().openContextMenu({on:"text",text:n,x:t.clientX,y:t.clientY}))})}function dT(){const t=T(e=>e.overlays);return b.useMemo(()=>{const e=Object.values(t).flatMap(n=>n.marks);return{effects:e.flatMap(n=>n.effect?[{target:n.target,as:n.effect}]:[]),badges:e.flatMap(n=>n.badge?[{target:n.target,text:n.badge.text,tone:n.badge.tone}]:[])}},[t])}function _b(t){const e=new Map;for(const n of t)e.set(n.target,[...e.get(n.target)??[],n]);return e}function G9({view:t}){const e=ze(),n=T(i=>{var o;return(o=i.viewUi[t.id])==null?void 0:o.collapsed})??t.collapsed,r=T(i=>i.updateViewUi),s=t.entities.filter(i=>e.children(i).some(o=>t.entities.includes(o.id)));return d.jsxs(d.Fragment,{children:[d.jsx(rt,{label:"Open everything",onClick:()=>r(t.id,{collapsed:[]}),disabled:n.length===0,children:d.jsx(t1,{size:15})}),d.jsx(rt,{label:"Show as one system",onClick:()=>r(t.id,{collapsed:[...s]}),disabled:s.every(i=>n.includes(i)),children:d.jsx(e1,{size:15})})]})}function Y9({view:t}){const e=T(s=>s.viewUi[t.id]),n=T(s=>s.updateViewUi),r=(e==null?void 0:e.controlFlow)??t.showControlFlow;return d.jsx(rt,{label:r?"Hide calls that carry no data":"Show calls that carry no data",onClick:()=>n(t.id,{controlFlow:!r}),active:r,children:d.jsx(oD,{size:15})})}function Q9({view:t}){const e=T(r=>{var s;return((s=r.viewUi[t.id])==null?void 0:s.transitive)??!1}),n=T(r=>r.updateViewUi);return d.jsx(rt,{label:e?"Show direct dependencies only":"Follow dependencies all the way",onClick:()=>n(t.id,{transitive:!e}),active:e,children:d.jsx(KD,{size:15})})}function X9({view:t}){var s;const e=T(i=>i.viewUi[t.id]),n=T(i=>i.updateViewUi),r=((s=e==null?void 0:e.expandedTables)==null?void 0:s.length)===t.dataTypes.length;return d.jsx(rt,{label:r?"Show key fields only":"Show every field",onClick:()=>n(t.id,{expandedTables:r?[]:[...t.dataTypes]}),active:r,children:r?d.jsx(e1,{size:15}):d.jsx(t1,{size:15})})}function eB({view:t}){const e=ze(),n=T(a=>a.selection),r=T(a=>a.select),s=e.messages(t.interaction),i=(n==null?void 0:n.kind)==="message"&&n.behavior===t.interaction?s.findIndex(a=>a.message.id===n.id):-1,o=a=>s[a]&&r({kind:"message",behavior:t.interaction,id:s[a].message.id},{focus:"center"});return d.jsxs(d.Fragment,{children:[d.jsx(rt,{label:"Previous step",onClick:()=>o(i<=0?0:i-1),disabled:i===0,children:d.jsx(nN,{size:15})}),d.jsx("span",{className:"font-tabular min-w-[54px] text-center text-[12px] text-ink-2","aria-live":"polite",children:i>=0?`${i+1} / ${s.length}`:`${s.length} steps`}),d.jsx(rt,{label:i<0?"Start stepping through":"Next step",onClick:()=>o(i+1),disabled:i===s.length-1,children:d.jsx(_d,{size:15})})]})}const tB={architecture:G9,dataflow:Y9,dependency:Q9,erd:X9,sequence:eB},Nb=new WeakMap,nB=document.fonts?Promise.all([document.fonts.load('400 13px "Hanken Grotesk Variable"'),document.fonts.load('600 13px "Hanken Grotesk Variable"'),document.fonts.load('400 12px "JetBrains Mono Variable"')]).catch(()=>{}):Promise.resolve();function rB(t,e,n){let r=Nb.get(t);r||Nb.set(t,r=new Map);const s=`${e.id}|${JSON.stringify(n)}`;let i=r.get(s);return i||(i=nB.then(()=>O_(t,e,n)),r.set(s,i)),i}function sB(t){const e=f1(),n=T(i=>i.viewUi[t.id]),[r,s]=b.useState({viewId:t.id});return b.useEffect(()=>{let i=!0;const o={collapsed:n==null?void 0:n.collapsed,expanded:n==null?void 0:n.expandedTables,controlFlow:n==null?void 0:n.controlFlow};return rB(e,t,o).then(a=>i&&s({viewId:t.id,scene:a}),a=>i&&s({viewId:t.id,error:a instanceof Error?a.message:String(a)})),()=>{i=!1}},[e,t,n==null?void 0:n.collapsed,n==null?void 0:n.expandedTables,n==null?void 0:n.controlFlow]),r.viewId===t.id?r:{}}function iB(){const t=T(s=>s.select),e=T(s=>s.setHover),n=T(s=>s.selection),r=n?de(n):null;return b.useCallback((s,i)=>{const o=de(s);return{"data-ref":o,className:"poney-el",tabIndex:0,role:"button","aria-label":i,"aria-pressed":r===o,onClick:a=>{if(a.stopPropagation(),T.getState().pointing){const l=oT(s);T.getState().setPointing(!1),l&&Qi(l);return}a.currentTarget.focus({preventScroll:!0}),t(s)},onDoubleClick:a=>{a.stopPropagation(),t(s),A1(s,a.currentTarget)||t(s,{focus:"zoom"})},onContextMenu:a=>{a.preventDefault(),a.stopPropagation(),t(s),T.getState().openContextMenu({on:"element",ref:s,x:a.clientX,y:a.clientY})},onMouseEnter:()=>e(s),onMouseLeave:()=>e(null),onFocus:()=>e(s),onBlur:()=>e(null),onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t(s,{focus:"center"}))}}},[t,e,r])}function uT(t,e,n){var c;const r=new Set,s=[...t.querySelectorAll("[data-ref][tabindex]")].filter(u=>{const f=u.getAttribute("data-ref"),h=u.getBoundingClientRect();return r.has(f)||h.width===0||getComputedStyle(u).visibility==="hidden"?!1:(r.add(f),!0)}).map(u=>({el:u,r:u.getBoundingClientRect()})).sort((u,f)=>Math.round((u.r.top+u.r.height/2)/28)-Math.round((f.r.top+f.r.height/2)/28)||u.r.left-f.r.left);if(!s.length)return;const i=(c=e==null?void 0:e.closest("[data-ref]"))==null?void 0:c.getAttribute("data-ref"),o=i?s.findIndex(u=>u.el.getAttribute("data-ref")===i):-1,a=o<0?n?s.length-1:0:o+(n?-1:1);if(a<0||a>=s.length)return;const l=s[a].el;return l.focus({preventScroll:!0}),l}function oB({pointer:t}){const e=T(l=>l.hover),n=T(l=>l.selection),r=ze(),[s,i]=b.useState(null),o=b.useRef(null);if(b.useEffect(()=>{if(i(null),!e)return;const l=setTimeout(()=>i(e),420);return()=>clearTimeout(l)},[e]),b.useEffect(()=>{if(!s)return;let l=0;const c=()=>{const u=o.current;if(u){const f=u.parentElement.getBoundingClientRect(),h=Math.min(t.current.x+14,f.width-u.offsetWidth-8),m=t.current.y+18+u.offsetHeight>f.height?t.current.y-u.offsetHeight-10:t.current.y+18;u.style.transform=`translate(${h}px, ${m}px)`}l=requestAnimationFrame(c)};return l=requestAnimationFrame(c),()=>cancelAnimationFrame(l)},[s,t]),!s||n&&de(n)===de(s))return null;const a=r.describe(s);return d.jsxs("div",{ref:o,role:"tooltip",className:"fade-in pointer-events-none absolute left-0 top-0 z-20 max-w-[280px] rounded-lg border border-rule bg-raised px-3 py-2 shadow-float",children:[d.jsx("div",{className:"text-[11px] text-ink-3",children:a.kind}),d.jsx("div",{className:"text-[13px] font-semibold leading-snug text-ink",children:a.title}),a.summary&&d.jsx("div",{className:"mt-0.5 text-[12px] leading-snug text-ink-2",children:a.summary})]})}function fT({size:t=14,className:e=""}){const n=T(Od),r=T(s=>s.pointing);return n?d.jsx("button",{type:"button","aria-label":"Point at something for the agent","aria-pressed":r,title:"Point at a part, a line, a message or a state, to put it in your question",onClick:()=>T.getState().setPointing(!r),className:`grid place-items-center rounded-md ${r?"bg-poney-wash text-poney":"text-ink-2 hover:bg-sunken"} ${e}`,children:d.jsx(wN,{size:t})}):null}const Eb=.15,$b=3,Wi=56,zm=new Map,Mb=(t,e,n)=>Math.min(n,Math.max(e,t)),aB=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function lB({viewId:t,scene:e,label:n,children:r,tools:s,overlay:i,initial:o="fit"}){var O;const a=b.useRef(null),[l,c]=b.useState({w:0,h:0}),[u,f]=b.useState(()=>zm.get(t)??{x:0,y:0,k:1}),h=b.useRef(u),m=b.useRef(0),g=b.useRef(null),p=b.useRef({x:0,y:0}),x=T(R=>R.select),y=T(R=>R.selection),v=T(R=>R.focus),k=b.useRef(0),w=b.useRef(null),j=b.useCallback(R=>{h.current=R,zm.set(t,R),f(R)},[t]),C=b.useCallback(R=>{if(cancelAnimationFrame(m.current),aB())return j(R);const I=h.current,L=performance.now(),K=380,ne=D=>{const z=Math.min(1,(D-L)/K),B=1-Math.pow(1-z,3);j({x:I.x+(R.x-I.x)*B,y:I.y+(R.y-I.y)*B,k:I.k+(R.k-I.k)*B}),z<1&&(m.current=requestAnimationFrame(ne))};m.current=requestAnimationFrame(ne)},[j]),E=b.useCallback((R,I=1.1)=>{const{w:L,h:K}=l,ne=Mb(Math.min((L-Wi*2)/Math.max(R.w,1),(K-Wi*2)/Math.max(R.h,1),I),Eb,$b);return{k:ne,x:L/2-(R.x+R.w/2)*ne,y:K/2-(R.y+R.h/2)*ne}},[l]),S=b.useCallback(()=>E({x:0,y:0,w:e.width,h:e.height},1),[E,e.width,e.height]),_=b.useCallback((R,I=l.w/2,L=l.h/2,K=!1)=>{const ne=h.current,D=Mb(ne.k*R,Eb,$b),z={k:D,x:I-(I-ne.x)/ne.k*D,y:L-(L-ne.y)/ne.k*D};K?C(z):j(z)},[l,j,C]),N=b.useCallback(R=>{const I=e.anchors[de(R)];if(I)return I;if(R.kind==="dataType"&&R.field)return e.anchors[de({kind:"dataType",id:R.id})]},[e.anchors]);b.useLayoutEffect(()=>{const R=a.current;if(!R)return;const I=new ResizeObserver(([L])=>c({w:L.contentRect.width,h:L.contentRect.height}));return I.observe(R),()=>I.disconnect()},[]),b.useLayoutEffect(()=>{if(!l.w||!l.h||w.current===t)return;w.current=t;const R=zm.get(t),I=S();j(R??(o==="start"&&I.k<.7?{k:.85,x:Wi/2,y:Wi/2}:I))},[l,t,S,j,o]),b.useEffect(()=>{if(!v||!l.w||v.nonce===k.current)return;if(k.current=v.nonce,v.mode==="fit")return C(S());if(v.mode==="reset"){const B=S();return C({k:1,x:l.w/2-e.width/2,y:B.k<1?Wi:B.y})}if(!v.ref)return;const R=N(v.ref);if(!R)return;const I=h.current,L=B=>({...B,x:Math.min(B.x,Wi),y:Math.min(B.y,Wi)});if(v.mode==="zoom")return C(L(E({x:R.x-80,y:R.y-80,w:R.w+160,h:R.h+160},1.6)));const K=R.x*I.k+I.x,ne=R.y*I.k+I.y;if(K>40&&ne>40&&K+R.w*I.k<l.w-40&&ne+R.h*I.k<l.h-40&&I.k>=.6)return;const z=Math.max(I.k,.8);C(L({k:z,x:l.w/2-(R.x+R.w/2)*z,y:l.h/2-(R.y+R.h/2)*z}))},[v,l,N,C,S,E,e.width]),b.useEffect(()=>{const R=a.current;if(!R)return;const I=L=>{L.preventDefault(),cancelAnimationFrame(m.current);const K=R.getBoundingClientRect();if(L.ctrlKey||L.metaKey)_(Math.exp(-L.deltaY*.0045),L.clientX-K.left,L.clientY-K.top);else{const ne=h.current;j({...ne,x:ne.x-L.deltaX,y:ne.y-L.deltaY})}};return R.addEventListener("wheel",I,{passive:!1}),()=>R.removeEventListener("wheel",I)},[_,j]);const M=R=>{if(R.key==="Tab"&&!R.altKey&&!R.metaKey&&!R.ctrlKey){const ne=(R.target===R.currentTarget?null:R.target)??(y?R.currentTarget.querySelector(`[data-ref="${CSS.escape(de(y))}"]`):null),D=uT(R.currentTarget,ne,R.shiftKey);if(D){R.preventDefault();const z=an(D.getAttribute("data-ref"));z&&T.getState().requestFocus("center",z)}return}if(R.target!==R.currentTarget&&!(R.target instanceof SVGElement))return;const I=R.shiftKey?160:60,L=h.current;switch(R.key){case"+":case"=":_(1.25,void 0,void 0,!0);break;case"-":case"_":_(.8,void 0,void 0,!0);break;case"ArrowLeft":if(R.target!==R.currentTarget)return;j({...L,x:L.x+I});break;case"ArrowRight":if(R.target!==R.currentTarget)return;j({...L,x:L.x-I});break;case"ArrowUp":if(R.target!==R.currentTarget)return;j({...L,y:L.y+I});break;case"ArrowDown":if(R.target!==R.currentTarget)return;j({...L,y:L.y-I});break;default:return}R.preventDefault()},P=R=>{R.button!==0&&R.button!==1||R.target.closest("[data-ref]")&&R.button===0||(cancelAnimationFrame(m.current),g.current={x:R.clientX,y:R.clientY,moved:!1,id:R.pointerId})},V=R=>{const I=a.current.getBoundingClientRect();p.current={x:R.clientX-I.left,y:R.clientY-I.top};const L=g.current;if(!L)return;const K=R.clientX-L.x,ne=R.clientY-L.y;if(!L.moved&&Math.hypot(K,ne)<3)return;L.moved||a.current.setPointerCapture(L.id),L.moved=!0,L.x=R.clientX,L.y=R.clientY;const D=h.current;j({...D,x:D.x+K,y:D.y+ne})},Z=()=>{const R=g.current;g.current=null,R&&!R.moved&&x(null)},Y=22*u.k;return d.jsx(BP,{value:u.k,children:d.jsxs("div",{ref:a,className:"relative h-full w-full touch-none select-none overflow-hidden outline-none",style:{backgroundColor:"var(--plaster)",backgroundImage:Y>7?"radial-gradient(var(--plaster-dot) 1px, transparent 1.2px)":void 0,backgroundSize:`${Y}px ${Y}px`,backgroundPosition:`${u.x}px ${u.y}px`,cursor:(O=g.current)!=null&&O.moved?"grabbing":"default"},tabIndex:0,role:"application","aria-roledescription":"diagram canvas","aria-label":`${n}. Use Tab to move between elements, Enter to select, plus and minus to zoom, arrow keys to pan.`,onKeyDown:M,onPointerDown:P,onPointerMove:V,onPointerUp:Z,onPointerCancel:()=>g.current=null,onDoubleClick:R=>{R.target.closest("[data-ref]")||C(S())},children:[d.jsx("svg",{className:"absolute inset-0 h-full w-full",role:"group","aria-label":n,children:d.jsx("g",{transform:`translate(${u.x} ${u.y}) scale(${u.k})`,children:r})}),i&&d.jsx("div",{className:"pointer-events-none absolute left-4 top-4",children:i}),d.jsx(oB,{pointer:p}),d.jsxs("div",{className:"absolute bottom-4 left-1/2 flex -translate-x-1/2 items-center gap-0.5 rounded-xl border border-rule bg-raised/95 p-1 shadow-float backdrop-blur",children:[d.jsx(rt,{label:"Zoom out",shortcut:"−",onClick:()=>_(.8,void 0,void 0,!0),children:d.jsx(uE,{size:15})}),d.jsxs("button",{type:"button",className:"font-tabular h-8 w-12 rounded-md text-[12px] text-ink-2 hover:bg-sunken",onClick:()=>T.getState().requestFocus("reset"),title:"Reset to 100%","aria-label":`Zoom ${Math.round(u.k*100)} percent. Reset to 100 percent`,children:[Math.round(u.k*100),"%"]}),d.jsx(rt,{label:"Zoom in",shortcut:"+",onClick:()=>_(1.25,void 0,void 0,!0),children:d.jsx(a1,{size:15})}),d.jsx(wb,{}),d.jsx(rt,{label:"Fit to view",shortcut:"⇧1",onClick:()=>C(S()),children:d.jsx(sE,{size:15})}),d.jsx(rt,{label:"Zoom to selection",shortcut:"F",onClick:()=>{const R=T.getState().selection;R&&T.getState().requestFocus("zoom",R)},children:d.jsx(OE,{size:15})}),d.jsx(fT,{size:15,className:"h-8 w-8"}),s&&d.jsxs(d.Fragment,{children:[d.jsx(wb,{}),s]})]})]})})}function cB({view:t}){return Yr(t)?d.jsx(dB,{view:t}):d.jsx(uB,{view:t})}function dB({view:t}){const e=Yr(t),{scene:n,error:r}=sB(t),s=dT(),i=b.useMemo(()=>({marks:new Map,mode:"after",focus:null,callouts:new Map,hot:null,setHot:()=>{},effects:_b(s.effects),badges:_b(s.badges)}),[s]);if(r)return d.jsx("div",{className:"grid h-full place-items-center p-8",children:d.jsxs("div",{className:"max-w-md rounded-xl border border-rule bg-raised p-5",children:[d.jsx("h2",{className:"text-[15px] font-semibold",children:"This diagram could not be laid out"}),d.jsx("p",{className:"mt-1 text-ink-2",children:r})]})});if(!n)return d.jsxs("div",{className:"grid h-full place-items-center text-ink-3",role:"status",children:["Arranging ",t.title.toLowerCase(),"…"]});const{Renderer:o,initialView:a}=e,l=tB[g$(t)];return d.jsx("div",{className:"fade-in h-full",onContextMenu:cT(t.id),children:d.jsxs(lB,{viewId:t.id,scene:n,label:`${t.title}, ${e.label.toLowerCase()} diagram`,tools:l?d.jsx(l,{view:t}):void 0,initial:a,children:[d.jsx(o,{scene:n,view:t}),(s.effects.length>0||s.badges.length>0)&&d.jsx(Jv,{value:i,children:d.jsx(m$,{scene:n,view:t})})]})})}function uB({view:t}){const e=t.type==="extension"?t.extension.split("/")[0]:t.type;return d.jsx("div",{className:"grid h-full place-items-center p-8",children:d.jsxs("div",{className:"max-w-md text-center",children:[d.jsx(CE,{className:"mx-auto text-ink-3",size:28}),d.jsxs("h2",{className:"mt-3 text-[16px] font-semibold",children:["This studio cannot draw “",t.title,"”"]}),d.jsxs("p",{className:"mt-1.5 text-ink-2",children:["The view uses the ",d.jsx("strong",{children:e})," extension, which is not installed here. Its data stays in the document and is kept when you export it."]})]})})}function el({text:t,multiline:e=!1}){const n=e?Kv(t):[t];return n.length<=1?d.jsx(Tb,{text:n[0]??""}):d.jsx(d.Fragment,{children:n.map((r,s)=>d.jsx("span",{className:`block ${s>0?"mt-[0.8em]":""}`,children:d.jsx(Tb,{text:r})},s))})}function Tb({text:t}){return d.jsx(d.Fragment,{children:$a(t).map((e,n)=>d.jsx(b.Fragment,{children:fB(e)},n))})}function fB(t){let e=t.text;return t.marks.includes("code")&&(e=d.jsx("code",{className:"rounded-[4px] bg-sunken px-1 py-px font-mono text-[0.88em] [font-variant-ligatures:none]",children:e})),t.marks.includes("italic")&&(e=d.jsx("em",{children:e})),t.marks.includes("bold")&&(e=d.jsx("strong",{className:"font-semibold text-ink",children:e})),t.href&&(e=d.jsx("a",{href:t.href,target:"_blank",rel:"noreferrer",className:"text-poney underline decoration-poney/40 underline-offset-2 hover:decoration-poney",children:e})),e}function hB(){const e=ze().doc,n=T(l=>l.navigate),r=b.useMemo(()=>yl(e,{extensions:Td()}),[e]),s=pB(e.views),o=[...JM([...new Set(e.views.map(l=>l.category))]).filter(l=>l!=="walkthrough").map(l=>({key:l,label:zd(l),views:e.views.filter(c=>c.category===l)})),...e.walkthroughs.map(l=>{const c=new Set([l.overview,...l.scenes.map(u=>u.view)].filter(Boolean));return{key:`walk:${l.id}`,label:`In “${Nr(l.title)}”`,views:e.views.filter(u=>u.category==="walkthrough"&&c.has(u.id))}})].filter(l=>l.views.length>0),a=[[e.model.entities.length,"parts"],[e.model.relationships.length,"connections"],[e.model.dataTypes.length,"data types"],[e.model.behaviors.length,"behaviors"],[e.model.capabilities.length,"use cases"]].filter(([l])=>l>0);return e.views.length===0&&e.walkthroughs.length===0?d.jsx(mB,{name:e.project.name,description:e.project.description}):d.jsx("div",{className:"scrollbar-quiet h-full overflow-y-auto",children:d.jsxs("div",{className:"mx-auto max-w-[920px] px-6 pb-20 pt-12 sm:px-10",children:[d.jsx("p",{className:"text-[13px] text-ink-3",children:"Project"}),d.jsx("h1",{className:"mt-1 text-[34px] font-semibold leading-tight tracking-[-0.02em]",children:e.project.name}),d.jsx("p",{className:"mt-3 max-w-[64ch] text-[16px] leading-relaxed text-ink-2",children:e.project.description}),d.jsxs("p",{className:"font-tabular mt-4 text-[13px] text-ink-3",children:[a.map(([l,c])=>`${l} ${c}`).join(", "),", shown in ",e.views.length," diagram",e.views.length===1?"":"s","."]}),e.walkthroughs.length>0&&d.jsxs("section",{className:"mt-10","aria-labelledby":"walkthroughs",children:[d.jsx("h2",{id:"walkthroughs",className:"text-[15px] font-semibold",children:"Walkthroughs and tours"}),d.jsx("ul",{className:"mt-3 space-y-3",children:e.walkthroughs.map(l=>{var c;return d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>n(`walk:${l.id}`),className:"group flex w-full items-start gap-4 rounded-xl border border-rule bg-raised p-5 text-left transition-colors hover:border-rule-strong",children:[d.jsx(gp,{size:20,className:"mt-0.5 shrink-0 text-poney"}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block text-[16px] font-semibold",children:d.jsx(el,{text:l.title})}),d.jsx("span",{className:"mt-1 block max-w-[70ch] text-[13.5px] leading-snug text-ink-2",children:d.jsx(el,{text:l.summary})}),d.jsxs("span",{className:"mt-2 block text-[12.5px] text-ink-3",children:[l.scenes.length," scenes",(c=l.source)!=null&&c.ref?`, ${l.source.kind.toLowerCase()} ${l.source.ref}`:""]})]}),d.jsx(Ff,{size:16,className:"mt-1 shrink-0 text-ink-4 group-hover:text-poney"})]})},l.id)})})]}),s.length>0&&d.jsxs("section",{className:"mt-10","aria-labelledby":"start-here",children:[d.jsx("h2",{id:"start-here",className:"text-[15px] font-semibold",children:"Start here"}),d.jsx("ol",{className:"mt-3 grid gap-3 md:grid-cols-3",children:s.map(({view:l,why:c},u)=>{const f=Yr(l),h=(f==null?void 0:f.icon)??bo;return d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>n(l.id),className:"group flex h-full w-full flex-col rounded-xl border border-rule bg-raised p-4 text-left transition-colors hover:border-rule-strong",children:[d.jsxs("span",{className:"flex items-center gap-2 text-[12px] text-ink-3",children:[d.jsx("span",{className:"font-tabular grid h-5 w-5 place-items-center rounded-full bg-sunken text-[11px] font-semibold text-ink-2",children:u+1}),f==null?void 0:f.label]}),d.jsxs("span",{className:"mt-3 flex items-center gap-2 text-[15px] font-semibold",children:[d.jsx(h,{size:16,className:"text-poney"}),l.title]}),d.jsx("span",{className:"mt-1 text-[13px] leading-snug text-ink-2",children:c})]})},l.id)})})]}),o.length>0&&d.jsxs("section",{className:"mt-12","aria-labelledby":"all-diagrams",children:[d.jsx("h2",{id:"all-diagrams",className:"text-[15px] font-semibold",children:"Every diagram"}),d.jsx("p",{className:"mt-1 text-[13px] text-ink-2",children:"All of them read from one model. Select something in one diagram, and follow it into the others."}),d.jsx("div",{className:"mt-4 grid gap-x-10 gap-y-6 md:grid-cols-2",children:o.map(l=>d.jsxs("div",{children:[d.jsx("h3",{className:"mb-1.5 text-[12px] font-semibold text-ink-3",children:l.label}),d.jsx("ul",{children:l.views.map(c=>{const u=Yr(c),f=(u==null?void 0:u.icon)??bo;return d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>n(c.id),className:"group -mx-2 flex w-[calc(100%+16px)] items-start gap-3 rounded-lg px-2 py-2 text-left hover:bg-sunken",children:[d.jsx(f,{size:16,className:"mt-0.5 shrink-0 text-ink-3 group-hover:text-poney"}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block text-[13.5px] font-semibold",children:c.title}),d.jsx("span",{className:"block text-[12.5px] leading-snug text-ink-2",children:c.description})]}),d.jsx(Ff,{size:14,className:"mt-0.5 shrink-0 text-ink-4 opacity-0 group-hover:opacity-100"})]})},c.id)})})]},l.key))})]}),d.jsxs("section",{className:"mt-12 grid gap-6 border-t border-rule pt-8 md:grid-cols-2","aria-label":"About this document",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-[15px] font-semibold",children:"The model"}),r.ok?d.jsxs("p",{className:"mt-2 flex items-start gap-2 text-[13px] text-ink-2",children:[d.jsx(aN,{size:15,className:"mt-0.5 shrink-0 text-[color:var(--success)]"}),"A valid Poney ",e.poneyVersion," document",e.extensions.length?`, using the ${e.extensions.map(l=>l.name).join(", ")} extension`:"",". Every reference resolves."]}):d.jsxs("p",{className:"mt-2 flex items-start gap-2 text-[13px] text-ink-2",children:[d.jsx(ez,{size:15,className:"mt-0.5 shrink-0 text-[color:var(--failure)]"}),r.issues.length," problem",r.issues.length===1?"":"s"," in the model."]}),r.issues.length>0&&d.jsx("ul",{className:"mt-2 space-y-1 text-[12px] text-ink-2",children:r.issues.slice(0,6).map((l,c)=>d.jsxs("li",{children:[d.jsx("code",{className:"font-mono text-[11px] text-ink-3",children:l.path})," ",l.message]},c))})]}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-[15px] font-semibold",children:"Bring your own"}),d.jsxs("p",{className:"mt-2 flex items-start gap-2 text-[13px] text-ink-2",children:[d.jsx(mN,{size:15,className:"mt-0.5 shrink-0 text-ink-3"}),d.jsxs("span",{children:["Paste a Poney document or a Mermaid diagram anywhere in the studio to open it."," ",d.jsx("button",{type:"button",className:"font-semibold text-poney hover:underline",onClick:()=>T.getState().setImportOpen(!0),children:"Open or paste a model"})]})]})]})]})]})})}function pB(t){const e=[],n=t.find(i=>i.type==="architecture"&&i.collapsed.length>0),r=t.find(i=>i.type==="architecture"&&i.collapsed.length===0),s=t.find(i=>i.type==="sequence"&&/checkout|order/i.test(i.id))??t.find(i=>i.type==="sequence");return n&&e.push({view:n,why:"The whole system as one box: who uses it and what it depends on."}),r&&e.push({view:r,why:"Open the box: every app, service and store, and how they connect."}),s&&e.push({view:s,why:"Follow one request, step by step, through the services."}),e.length===0&&e.push(...t.slice(0,3).map(i=>({view:i,why:i.description}))),e}function mB({name:t,description:e}){const{session:n,listening:r}=T(o=>o.agent),s=n==null?void 0:n.busy,i=o=>{T.getState().setAgentPanelOpen(!0),Tp(o)};return d.jsx("div",{className:"scrollbar-quiet h-full overflow-y-auto",children:d.jsxs("div",{className:"mx-auto max-w-[760px] px-6 pb-20 pt-14 sm:px-10",children:[d.jsx("p",{className:"text-[13px] text-ink-3",children:"Project"}),d.jsx("h1",{className:"mt-1 text-[34px] font-semibold leading-tight tracking-[-0.02em]",children:t}),e&&d.jsx("p",{className:"mt-3 max-w-[64ch] text-[16px] leading-relaxed text-ink-2",children:e}),d.jsx("p",{className:"mt-8 text-[15px] text-ink-2",children:s?"The agent is working on it. What it opens shows here.":"Nothing is drawn yet."}),s?d.jsxs("p",{className:"mt-4 inline-flex items-center gap-2 text-[14px] text-ink-3",children:[d.jsx(So,{size:15,className:"animate-spin"})," ",n==null?void 0:n.name," is reading the code…"]}):n||r?d.jsxs("ul",{className:"mt-5 space-y-2",children:[eT.map(o=>d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>i(o.prompt),className:"group flex w-full items-center gap-3 rounded-xl border border-rule bg-raised px-5 py-4 text-left transition-colors hover:border-rule-strong",children:[d.jsx(gp,{size:18,className:"shrink-0 text-poney"}),d.jsx("span",{className:"flex-1 text-[15px] font-semibold",children:o.label}),d.jsx(Ff,{size:16,className:"shrink-0 text-ink-4 group-hover:text-poney"})]})},o.label)),d.jsx("li",{className:"pt-2 text-[13.5px] text-ink-3",children:"Or ask anything in the agent panel."})]}):d.jsx("div",{className:"mt-5",children:d.jsxs("button",{type:"button",onClick:()=>T.getState().setConnectOpen(!0),className:"inline-flex h-9 items-center gap-2 rounded-lg bg-ink px-3.5 text-[13.5px] font-semibold text-paper hover:opacity-90",children:[d.jsx(xp,{size:15})," Connect an agent"]})})]})})}var Ob=1,gB=.9,yB=.8,xB=.17,Lm=.1,Fm=.999,vB=.9999,kB=.99,wB=/[\\\/_+.#"@\[\(\{&]/,bB=/[\\\/_+.#"@\[\(\{&]/g,SB=/[\s-]/,hT=/[\s-]/g;function hx(t,e,n,r,s,i,o){if(i===e.length)return s===t.length?Ob:kB;var a=`${s},${i}`;if(o[a]!==void 0)return o[a];for(var l=r.charAt(i),c=n.indexOf(l,s),u=0,f,h,m,g;c>=0;)f=hx(t,e,n,r,c+1,i+1,o),f>u&&(c===s?f*=Ob:wB.test(t.charAt(c-1))?(f*=yB,m=t.slice(s,c-1).match(bB),m&&s>0&&(f*=Math.pow(Fm,m.length))):SB.test(t.charAt(c-1))?(f*=gB,g=t.slice(s,c-1).match(hT),g&&s>0&&(f*=Math.pow(Fm,g.length))):(f*=xB,s>0&&(f*=Math.pow(Fm,c-s))),t.charAt(c)!==e.charAt(i)&&(f*=vB)),(f<Lm&&n.charAt(c-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(c-1)!==r.charAt(i))&&(h=hx(t,e,n,r,c+1,i+2,o),h*Lm>f&&(f=h*Lm)),f>u&&(u=f),c=n.indexOf(l,c+1);return o[a]=u,u}function Ab(t){return t.toLowerCase().replace(hT," ")}function jB(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,hx(t,e,Ab(t),Ab(e),0,0,{})}var CB=Object.defineProperty,P1=(t,e)=>CB(t,"name",{value:e,configurable:!0}),fu=0,Rr=null;function _B(t){return D1(),t.children}P1(_B,"FocusGuards");function D1(){b.useEffect(()=>{Rr||(Rr={start:px(),end:px()});const{start:t,end:e}=Rr;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),fu++,()=>{fu===1&&(Rr==null||Rr.start.remove(),Rr==null||Rr.end.remove(),Rr=null),fu=Math.max(0,fu-1)}},[])}P1(D1,"useFocusGuards");function px(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}P1(px,"createFocusGuard");var Vr=function(){return Vr=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Vr.apply(this,arguments)};function pT(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function NB(t,e,n){if(n||arguments.length===2)for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var Hu="right-scroll-bar-position",qu="width-before-scroll-bar",EB="with-scroll-bars-hidden",$B="--removed-body-scroll-bar-size";function Bm(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function MB(t,e){var n=b.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=e,n.facade}var TB=typeof window<"u"?b.useLayoutEffect:b.useEffect,Rb=new WeakMap;function OB(t,e){var n=MB(null,function(r){return t.forEach(function(s){return Bm(s,r)})});return TB(function(){var r=Rb.get(n);if(r){var s=new Set(r),i=new Set(t),o=n.current;s.forEach(function(a){i.has(a)||Bm(a,null)}),i.forEach(function(a){s.has(a)||Bm(a,o)})}Rb.set(n,t)},[t]),n}function AB(t){return t}function RB(t,e){e===void 0&&(e=AB);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(i){var o=e(i,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(i),o=n}var l=function(){var u=o;o=[],u.forEach(i)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){o.push(u),c()},filter:function(u){return o=o.filter(u),n}}}};return s}function IB(t){t===void 0&&(t={});var e=RB(null);return e.options=Vr({async:!0,ssr:!1},t),e}var mT=function(t){var e=t.sideCar,n=pT(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return b.createElement(r,Vr({},n))};mT.isSideCarExport=!0;function PB(t,e){return t.useMedium(e),mT}var gT=IB(),Vm=function(){},Ap=b.forwardRef(function(t,e){var n=b.useRef(null),r=b.useState({onScrollCapture:Vm,onWheelCapture:Vm,onTouchMoveCapture:Vm}),s=r[0],i=r[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,u=t.enabled,f=t.shards,h=t.sideCar,m=t.noRelative,g=t.noIsolation,p=t.inert,x=t.allowPinchZoom,y=t.as,v=y===void 0?"div":y,k=t.gapMode,w=pT(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=h,C=OB([n,e]),E=Vr(Vr({},w),s);return b.createElement(b.Fragment,null,u&&b.createElement(j,{sideCar:gT,removeScrollBar:c,shards:f,noRelative:m,noIsolation:g,inert:p,setCallbacks:i,allowPinchZoom:!!x,lockRef:n,gapMode:k}),o?b.cloneElement(b.Children.only(a),Vr(Vr({},E),{ref:C})):b.createElement(v,Vr({},E,{className:l,ref:C}),a))});Ap.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ap.classNames={fullWidth:qu,zeroRight:Hu};var DB=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function zB(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=DB();return e&&t.setAttribute("nonce",e),t}function LB(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function FB(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var BB=function(){var t=0,e=null;return{add:function(n){t==0&&(e=zB())&&(LB(e,n),FB(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},VB=function(){var t=BB();return function(e,n){b.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},yT=function(){var t=VB(),e=function(n){var r=n.styles,s=n.dynamic;return t(r,s),null};return e},WB={left:0,top:0,right:0,gap:0},Wm=function(t){return parseInt(t||"",10)||0},UB=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],s=e[t==="padding"?"paddingRight":"marginRight"];return[Wm(n),Wm(r),Wm(s)]},ZB=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return WB;var e=UB(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},HB=yT(),Ta="data-scroll-locked",qB=function(t,e,n,r){var s=t.left,i=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),`
651
- .`.concat(EB,` {
652
- overflow: hidden `).concat(r,`;
653
- padding-right: `).concat(a,"px ").concat(r,`;
654
- }
655
- body[`).concat(Ta,`] {
656
- overflow: hidden `).concat(r,`;
657
- overscroll-behavior: contain;
658
- `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
659
- padding-left: `.concat(s,`px;
660
- padding-top: `).concat(i,`px;
661
- padding-right: `).concat(o,`px;
662
- margin-left:0;
663
- margin-top:0;
664
- margin-right: `).concat(a,"px ").concat(r,`;
665
- `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
666
- }
667
-
668
- .`).concat(Hu,` {
669
- right: `).concat(a,"px ").concat(r,`;
670
- }
671
-
672
- .`).concat(qu,` {
673
- margin-right: `).concat(a,"px ").concat(r,`;
674
- }
675
-
676
- .`).concat(Hu," .").concat(Hu,` {
677
- right: 0 `).concat(r,`;
678
- }
679
-
680
- .`).concat(qu," .").concat(qu,` {
681
- margin-right: 0 `).concat(r,`;
682
- }
683
-
684
- body[`).concat(Ta,`] {
685
- `).concat($B,": ").concat(a,`px;
686
- }
687
- `)},Ib=function(){var t=parseInt(document.body.getAttribute(Ta)||"0",10);return isFinite(t)?t:0},KB=function(){b.useEffect(function(){return document.body.setAttribute(Ta,(Ib()+1).toString()),function(){var t=Ib()-1;t<=0?document.body.removeAttribute(Ta):document.body.setAttribute(Ta,t.toString())}},[])},JB=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;KB();var i=b.useMemo(function(){return ZB(s)},[s]);return b.createElement(HB,{styles:qB(i,!e,s,n?"":"!important")})},mx=!1;if(typeof window<"u")try{var hu=Object.defineProperty({},"passive",{get:function(){return mx=!0,!0}});window.addEventListener("test",hu,hu),window.removeEventListener("test",hu,hu)}catch{mx=!1}var Ho=mx?{passive:!1}:!1,GB=function(t){return t.tagName==="TEXTAREA"},xT=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!GB(t)&&n[e]==="visible")},YB=function(t){return xT(t,"overflowY")},QB=function(t){return xT(t,"overflowX")},Pb=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=vT(t,r);if(s){var i=kT(t,r),o=i[1],a=i[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},XB=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},eV=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},vT=function(t,e){return t==="v"?YB(e):QB(e)},kT=function(t,e){return t==="v"?XB(e):eV(e)},tV=function(t,e){return t==="h"&&e==="rtl"?-1:1},nV=function(t,e,n,r,s){var i=tV(t,window.getComputedStyle(e).direction),o=i*r,a=n.target,l=e.contains(a),c=!1,u=o>0,f=0,h=0;do{if(!a)break;var m=kT(t,a),g=m[0],p=m[1],x=m[2],y=p-x-i*g;(g||y)&&vT(t,a)&&(f+=y,h+=g);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(u&&Math.abs(f)<1||!u&&Math.abs(h)<1)&&(c=!0),c},pu=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Db=function(t){return[t.deltaX,t.deltaY]},zb=function(t){return t&&"current"in t?t.current:t},rV=function(t,e){return t[0]===e[0]&&t[1]===e[1]},sV=function(t){return`
688
- .block-interactivity-`.concat(t,` {pointer-events: none;}
689
- .allow-interactivity-`).concat(t,` {pointer-events: all;}
690
- `)},iV=0,qo=[];function oV(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),s=b.useState(iV++)[0],i=b.useState(yT)[0],o=b.useRef(t);b.useEffect(function(){o.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var p=NB([t.lockRef.current],(t.shards||[]).map(zb),!0).filter(Boolean);return p.forEach(function(x){return x.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var a=b.useCallback(function(p,x){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var y=pu(p),v=n.current,k="deltaX"in p?p.deltaX:v[0]-y[0],w="deltaY"in p?p.deltaY:v[1]-y[1],j,C=p.target,E=Math.abs(k)>Math.abs(w)?"h":"v";if("touches"in p&&E==="h"&&C.type==="range")return!1;var S=window.getSelection(),_=S&&S.anchorNode,N=_?_===C||_.contains(C):!1;if(N)return!1;var M=Pb(E,C);if(!M)return!0;if(M?j=E:(j=E==="v"?"h":"v",M=Pb(E,C)),!M)return!1;if(!r.current&&"changedTouches"in p&&(k||w)&&(r.current=j),!j)return!0;var P=r.current||j;return nV(P,x,p,P==="h"?k:w)},[]),l=b.useCallback(function(p){var x=p;if(!(!qo.length||qo[qo.length-1]!==i)){var y="deltaY"in x?Db(x):pu(x),v=e.current.filter(function(j){return j.name===x.type&&(j.target===x.target||x.target===j.shadowParent)&&rV(j.delta,y)})[0];if(v&&v.should){x.cancelable&&x.preventDefault();return}if(!v){var k=(o.current.shards||[]).map(zb).filter(Boolean).filter(function(j){return j.contains(x.target)}),w=k.length>0?a(x,k[0]):!o.current.noIsolation;w&&x.cancelable&&x.preventDefault()}}},[]),c=b.useCallback(function(p,x,y,v){var k={name:p,delta:x,target:y,should:v,shadowParent:aV(y)};e.current.push(k),setTimeout(function(){e.current=e.current.filter(function(w){return w!==k})},1)},[]),u=b.useCallback(function(p){n.current=pu(p),r.current=void 0},[]),f=b.useCallback(function(p){c(p.type,Db(p),p.target,a(p,t.lockRef.current))},[]),h=b.useCallback(function(p){c(p.type,pu(p),p.target,a(p,t.lockRef.current))},[]);b.useEffect(function(){return qo.push(i),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Ho),document.addEventListener("touchmove",l,Ho),document.addEventListener("touchstart",u,Ho),function(){qo=qo.filter(function(p){return p!==i}),document.removeEventListener("wheel",l,Ho),document.removeEventListener("touchmove",l,Ho),document.removeEventListener("touchstart",u,Ho)}},[]);var m=t.removeScrollBar,g=t.inert;return b.createElement(b.Fragment,null,g?b.createElement(i,{styles:sV(s)}):null,m?b.createElement(JB,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function aV(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const lV=PB(gT,oV);var wT=b.forwardRef(function(t,e){return b.createElement(Ap,Vr({},t,{ref:e,sideCar:lV}))});wT.classNames=Ap.classNames;var cV=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Ko=new WeakMap,mu=new WeakMap,gu={},Um=0,bT=function(t){return t&&(t.host||bT(t.parentNode))},dV=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=bT(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},uV=function(t,e,n,r){var s=dV(e,Array.isArray(t)?t:[t]);gu[n]||(gu[n]=new WeakMap);var i=gu[n],o=[],a=new Set,l=new Set(s),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};s.forEach(c);var u=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))u(h);else try{var m=h.getAttribute(r),g=m!==null&&m!=="false",p=(Ko.get(h)||0)+1,x=(i.get(h)||0)+1;Ko.set(h,p),i.set(h,x),o.push(h),p===1&&g&&mu.set(h,!0),x===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",h,y)}})};return u(e),a.clear(),Um++,function(){o.forEach(function(f){var h=Ko.get(f)-1,m=i.get(f)-1;Ko.set(f,h),i.set(f,m),h||(mu.has(f)||f.removeAttribute(r),mu.delete(f)),m||f.removeAttribute(n)}),Um--,Um||(Ko=new WeakMap,Ko=new WeakMap,mu=new WeakMap,gu={})}},fV=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=cV(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),uV(r,s,n,"aria-hidden")):function(){return null}},hV=Object.defineProperty,Yn=(t,e)=>hV(t,"name",{value:e,configurable:!0}),z1="Dialog",[ST,pY]=Sp(z1),[pV,ns]=ST(z1),jT=Yn(t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=t,a=b.useRef(null),l=b.useRef(null),{nodes:c,registry:u}=nM(),[f,h]=_1({prop:r,defaultProp:s??!1,onChange:i,caller:z1}),[m,g]=b.useState(0),[p,x]=b.useState(0);return d.jsx(pV,{scope:e,triggerRef:a,contentRef:l,contentId:Cr(),titleId:Cr(),descriptionId:Cr(),titlePresent:m>0,descriptionPresent:p>0,setTitleCount:g,setDescriptionCount:x,open:f,onOpenChange:h,onOpenToggle:b.useCallback(()=>h(y=>!y),[h]),modal:o,branchNodes:c,branchRegistry:u,children:n})},"Dialog"),CT="DialogPortal",[mV,_T]=ST(CT,{forceMount:void 0}),NT=Yn(t=>{const{__scopeDialog:e,forceMount:n,children:r,container:s}=t,i=ns(CT,e);return d.jsx(mV,{scope:e,forceMount:n,children:b.Children.map(r,o=>d.jsx(Id,{present:n||i.open,children:d.jsx(EM,{asChild:!0,container:s,children:o})}))})},"DialogPortal"),gx="DialogOverlay",ET=b.forwardRef(Yn(function(e,n){const r=_T(gx,e.__scopeDialog),{forceMount:s=r.forceMount,...i}=e,o=ns(gx,e.__scopeDialog);return o.modal?d.jsx(Id,{present:s||o.open,children:d.jsx(yV,{...i,ref:n})}):null},"DialogOverlay")),gV=g1("DialogOverlay.RemoveScroll"),yV=b.forwardRef(Yn(function(e,n){const{__scopeDialog:r,...s}=e,i=ns(gx,r),o=Y$(),a=Tr(n,o);return d.jsx(wT,{as:gV,allowPinchZoom:!0,shards:b.useMemo(()=>[i.contentRef,...i.branchNodes.map(l=>({current:l}))],[i.contentRef,i.branchNodes]),children:d.jsx(Ot.div,{"data-state":L1(i.open),...s,ref:a,style:{pointerEvents:"auto",...s.style}})})},"DialogOverlayImpl")),ed="DialogContent",$T=b.forwardRef(Yn(function(e,n){const r=_T(ed,e.__scopeDialog),{forceMount:s=r.forceMount,...i}=e,o=ns(ed,e.__scopeDialog);return d.jsx(Id,{present:s||o.open,children:o.modal?d.jsx(xV,{...i,ref:n}):d.jsx(vV,{...i,ref:n})})},"DialogContent")),xV=b.forwardRef(Yn(function(e,n){const r=ns(ed,e.__scopeDialog),s=b.useRef(null),i=Tr(n,r.contentRef,s);return b.useEffect(()=>{const o=s.current;if(o)return fV(o)},[]),d.jsx(MT,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:_n(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),(a=r.triggerRef.current)==null||a.focus()}),onPointerDownOutside:_n(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&o.preventDefault()}),onFocusOutside:_n(e.onFocusOutside,o=>o.preventDefault())})},"DialogContentModal")),vV=b.forwardRef(Yn(function(e,n){const r=ns(ed,e.__scopeDialog),s=b.useRef(!1),i=b.useRef(!1);return d.jsx(MT,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,l;(a=e.onCloseAutoFocus)==null||a.call(e,o),o.defaultPrevented||(s.current||(l=r.triggerRef.current)==null||l.focus(),o.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:o=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=o.target;((u=r.triggerRef.current)==null?void 0:u.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})},"DialogContentNonModal")),MT=b.forwardRef(Yn(function(e,n){const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,"aria-describedby":a,children:l,...c}=e,u=ns(ed,r);return D1(),d.jsx(tM,{registry:u.branchRegistry,children:d.jsx(n8,{asChild:!0,loop:!0,trapped:s,branches:u.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:o,children:d.jsx(G$,{role:"dialog",id:u.contentId,"aria-labelledby":u.titlePresent?u.titleId:void 0,"aria-describedby":u.descriptionPresent?TT(a,u.descriptionId):a,"data-state":L1(u.open),...c,ref:n,deferPointerDownOutside:!0,onDismiss:()=>u.onOpenChange(!1),children:l})})})},"DialogContentImpl")),Lb=b.forwardRef(Yn(function(e,n){const{__scopeDialog:r,...s}=e,i=ns("DialogTitle",r),{setTitleCount:o}=i;return Rn(()=>(o(a=>a+1),()=>o(a=>a-1)),[o]),d.jsx(Ot.h2,{id:i.titleId,...s,ref:n})},"DialogTitle")),Zm=b.forwardRef(Yn(function(e,n){const{__scopeDialog:r,...s}=e,i=ns("DialogDescription",r),{setDescriptionCount:o}=i;return Rn(()=>(o(a=>a+1),()=>o(a=>a-1)),[o]),d.jsx(Ot.p,{id:i.descriptionId,...s,ref:n})},"DialogDescription")),kV="DialogClose",wV=b.forwardRef(Yn(function(e,n){const{__scopeDialog:r,...s}=e,i=ns(kV,r);return d.jsx(Ot.button,{type:"button",...s,ref:n,onClick:_n(e.onClick,()=>i.onOpenChange(!1))})},"DialogClose"));function TT(...t){const e=new Set;for(const n of t)if(typeof n=="string")for(const r of String(n).trim().split(/\s+/))r&&e.add(r);return e.size>0?Array.from(e).join(" "):void 0}Yn(TT,"concatAriaDescribedby");function L1(t){return t?"open":"closed"}Yn(L1,"getState");var Ll='[cmdk-group=""]',Hm='[cmdk-group-items=""]',bV='[cmdk-group-heading=""]',OT='[cmdk-item=""]',Fb=`${OT}:not([aria-disabled="true"])`,yx="cmdk-item-select",na="data-value",SV=(t,e,n)=>jB(t,e,n),AT=b.createContext(void 0),Ld=()=>b.useContext(AT),RT=b.createContext(void 0),F1=()=>b.useContext(RT),IT=b.createContext(void 0),PT=b.forwardRef((t,e)=>{let n=ra(()=>{var D,z;return{search:"",value:(z=(D=t.value)!=null?D:t.defaultValue)!=null?z:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=ra(()=>new Set),s=ra(()=>new Map),i=ra(()=>new Map),o=ra(()=>new Set),a=DT(t),{label:l,children:c,value:u,onValueChange:f,filter:h,shouldFilter:m,loop:g,disablePointerSelection:p=!1,vimBindings:x=!0,...y}=t,v=Cr(),k=Cr(),w=Cr(),j=b.useRef(null),C=RV();Mo(()=>{if(u!==void 0){let D=u.trim();n.current.value=D,E.emit()}},[u]),Mo(()=>{C(6,V)},[]);let E=b.useMemo(()=>({subscribe:D=>(o.current.add(D),()=>o.current.delete(D)),snapshot:()=>n.current,setState:(D,z,B)=>{var H,$,A,F;if(!Object.is(n.current[D],z)){if(n.current[D]=z,D==="search")P(),N(),C(1,M);else if(D==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let q=document.getElementById(w);q?q.focus():(H=document.getElementById(v))==null||H.focus()}if(C(7,()=>{var q;n.current.selectedItemId=(q=Z())==null?void 0:q.id,E.emit()}),B||C(5,V),(($=a.current)==null?void 0:$.value)!==void 0){let q=z??"";(F=(A=a.current).onValueChange)==null||F.call(A,q);return}}E.emit()}},emit:()=>{o.current.forEach(D=>D())}}),[]),S=b.useMemo(()=>({value:(D,z,B)=>{var H;z!==((H=i.current.get(D))==null?void 0:H.value)&&(i.current.set(D,{value:z,keywords:B}),n.current.filtered.items.set(D,_(z,B)),C(2,()=>{N(),E.emit()}))},item:(D,z)=>(r.current.add(D),z&&(s.current.has(z)?s.current.get(z).add(D):s.current.set(z,new Set([D]))),C(3,()=>{P(),N(),n.current.value||M(),E.emit()}),()=>{i.current.delete(D),r.current.delete(D),n.current.filtered.items.delete(D);let B=Z();C(4,()=>{P(),(B==null?void 0:B.getAttribute("id"))===D&&M(),E.emit()})}),group:D=>(s.current.has(D)||s.current.set(D,new Set),()=>{i.current.delete(D),s.current.delete(D)}),filter:()=>a.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:v,inputId:w,labelId:k,listInnerRef:j}),[]);function _(D,z){var B,H;let $=(H=(B=a.current)==null?void 0:B.filter)!=null?H:SV;return D?$(D,n.current.search,z):0}function N(){if(!n.current.search||a.current.shouldFilter===!1)return;let D=n.current.filtered.items,z=[];n.current.filtered.groups.forEach(H=>{let $=s.current.get(H),A=0;$.forEach(F=>{let q=D.get(F);A=Math.max(q,A)}),z.push([H,A])});let B=j.current;Y().sort((H,$)=>{var A,F;let q=H.getAttribute("id"),re=$.getAttribute("id");return((A=D.get(re))!=null?A:0)-((F=D.get(q))!=null?F:0)}).forEach(H=>{let $=H.closest(Hm);$?$.appendChild(H.parentElement===$?H:H.closest(`${Hm} > *`)):B.appendChild(H.parentElement===B?H:H.closest(`${Hm} > *`))}),z.sort((H,$)=>$[1]-H[1]).forEach(H=>{var $;let A=($=j.current)==null?void 0:$.querySelector(`${Ll}[${na}="${encodeURIComponent(H[0])}"]`);A==null||A.parentElement.appendChild(A)})}function M(){let D=Y().find(B=>B.getAttribute("aria-disabled")!=="true"),z=D==null?void 0:D.getAttribute(na);E.setState("value",z||void 0)}function P(){var D,z,B,H;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let $=0;for(let A of r.current){let F=(z=(D=i.current.get(A))==null?void 0:D.value)!=null?z:"",q=(H=(B=i.current.get(A))==null?void 0:B.keywords)!=null?H:[],re=_(F,q);n.current.filtered.items.set(A,re),re>0&&$++}for(let[A,F]of s.current)for(let q of F)if(n.current.filtered.items.get(q)>0){n.current.filtered.groups.add(A);break}n.current.filtered.count=$}function V(){var D,z,B;let H=Z();H&&(((D=H.parentElement)==null?void 0:D.firstChild)===H&&((B=(z=H.closest(Ll))==null?void 0:z.querySelector(bV))==null||B.scrollIntoView({block:"nearest"})),H.scrollIntoView({block:"nearest"}))}function Z(){var D;return(D=j.current)==null?void 0:D.querySelector(`${OT}[aria-selected="true"]`)}function Y(){var D;return Array.from(((D=j.current)==null?void 0:D.querySelectorAll(Fb))||[])}function O(D){let z=Y()[D];z&&E.setState("value",z.getAttribute(na))}function R(D){var z;let B=Z(),H=Y(),$=H.findIndex(F=>F===B),A=H[$+D];(z=a.current)!=null&&z.loop&&(A=$+D<0?H[H.length-1]:$+D===H.length?H[0]:H[$+D]),A&&E.setState("value",A.getAttribute(na))}function I(D){let z=Z(),B=z==null?void 0:z.closest(Ll),H;for(;B&&!H;)B=D>0?OV(B,Ll):AV(B,Ll),H=B==null?void 0:B.querySelector(Fb);H?E.setState("value",H.getAttribute(na)):R(D)}let L=()=>O(Y().length-1),K=D=>{D.preventDefault(),D.metaKey?L():D.altKey?I(1):R(1)},ne=D=>{D.preventDefault(),D.metaKey?O(0):D.altKey?I(-1):R(-1)};return b.createElement(Ot.div,{ref:e,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:D=>{var z;(z=y.onKeyDown)==null||z.call(y,D);let B=D.nativeEvent.isComposing||D.keyCode===229;if(!(D.defaultPrevented||B))switch(D.key){case"n":case"j":{x&&D.ctrlKey&&K(D);break}case"ArrowDown":{K(D);break}case"p":case"k":{x&&D.ctrlKey&&ne(D);break}case"ArrowUp":{ne(D);break}case"Home":{D.preventDefault(),O(0);break}case"End":{D.preventDefault(),L();break}case"Enter":{D.preventDefault();let H=Z();if(H){let $=new Event(yx);H.dispatchEvent($)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:S.inputId,id:S.labelId,style:PV},l),Rp(t,D=>b.createElement(RT.Provider,{value:E},b.createElement(AT.Provider,{value:S},D))))}),jV=b.forwardRef((t,e)=>{var n,r;let s=Cr(),i=b.useRef(null),o=b.useContext(IT),a=Ld(),l=DT(t),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Mo(()=>{if(!c)return a.item(s,o==null?void 0:o.id)},[c]);let u=zT(s,i,[t.value,t.children,i],t.keywords),f=F1(),h=Ai(C=>C.value&&C.value===u.current),m=Ai(C=>c||a.filter()===!1?!0:C.search?C.filtered.items.get(s)>0:!0);b.useEffect(()=>{let C=i.current;if(!(!C||t.disabled))return C.addEventListener(yx,g),()=>C.removeEventListener(yx,g)},[m,t.onSelect,t.disabled]);function g(){var C,E;p(),(E=(C=l.current).onSelect)==null||E.call(C,u.current)}function p(){f.setState("value",u.current,!0)}if(!m)return null;let{disabled:x,value:y,onSelect:v,forceMount:k,keywords:w,...j}=t;return b.createElement(Ot.div,{ref:_o(i,e),...j,id:s,"cmdk-item":"",role:"option","aria-disabled":!!x,"aria-selected":!!h,"data-disabled":!!x,"data-selected":!!h,onPointerMove:x||a.getDisablePointerSelection()?void 0:p,onClick:x?void 0:g},t.children)}),CV=b.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,o=Cr(),a=b.useRef(null),l=b.useRef(null),c=Cr(),u=Ld(),f=Ai(m=>s||u.filter()===!1?!0:m.search?m.filtered.groups.has(o):!0);Mo(()=>u.group(o),[]),zT(o,a,[t.value,t.heading,l]);let h=b.useMemo(()=>({id:o,forceMount:s}),[s]);return b.createElement(Ot.div,{ref:_o(a,e),...i,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&b.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),Rp(t,m=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},b.createElement(IT.Provider,{value:h},m))))}),_V=b.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=b.useRef(null),i=Ai(o=>!o.search);return!n&&!i?null:b.createElement(Ot.div,{ref:_o(s,e),...r,"cmdk-separator":"",role:"separator"})}),NV=b.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=F1(),o=Ai(c=>c.search),a=Ai(c=>c.selectedItemId),l=Ld();return b.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),b.createElement(Ot.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:s?t.value:o,onChange:c=>{s||i.setState("search",c.target.value),n==null||n(c.target.value)}})}),EV=b.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=b.useRef(null),o=b.useRef(null),a=Ai(c=>c.selectedItemId),l=Ld();return b.useEffect(()=>{if(o.current&&i.current){let c=o.current,u=i.current,f,h=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let m=c.offsetHeight;u.style.setProperty("--cmdk-list-height",m.toFixed(1)+"px")})});return h.observe(c),()=>{cancelAnimationFrame(f),h.unobserve(c)}}},[]),b.createElement(Ot.div,{ref:_o(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},Rp(t,c=>b.createElement("div",{ref:_o(o,l.listInnerRef),"cmdk-list-sizer":""},c)))}),$V=b.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:o,...a}=t;return b.createElement(jT,{open:n,onOpenChange:r},b.createElement(NT,{container:o},b.createElement(ET,{"cmdk-overlay":"",className:s}),b.createElement($T,{"aria-label":t.label,"cmdk-dialog":"",className:i},b.createElement(PT,{ref:e,...a}))))}),MV=b.forwardRef((t,e)=>Ai(n=>n.filtered.count===0)?b.createElement(Ot.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),TV=b.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return b.createElement(Ot.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Rp(t,o=>b.createElement("div",{"aria-hidden":!0},o)))}),Ye=Object.assign(PT,{List:EV,Item:jV,Input:NV,Group:CV,Separator:_V,Dialog:$V,Empty:MV,Loading:TV});function OV(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function AV(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function DT(t){let e=b.useRef(t);return Mo(()=>{e.current=t}),e}var Mo=typeof window>"u"?b.useEffect:b.useLayoutEffect;function ra(t){let e=b.useRef();return e.current===void 0&&(e.current=t()),e}function Ai(t){let e=F1(),n=()=>t(e.snapshot());return b.useSyncExternalStore(e.subscribe,n,n)}function zT(t,e,n,r=[]){let s=b.useRef(),i=Ld();return Mo(()=>{var o;let a=(()=>{var c;for(let u of n){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(c=u.current.textContent)==null?void 0:c.trim():s.current}})(),l=r.map(c=>c.trim());i.value(t,a,l),(o=e.current)==null||o.setAttribute(na,a),s.current=a}),s}var RV=()=>{let[t,e]=b.useState(),n=ra(()=>new Map);return Mo(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function IV(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Rp({asChild:t,children:e},n){return t&&b.isValidElement(e)?b.cloneElement(IV(e),{ref:e.ref},n(e.props.children)):n(e)}var PV={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Lo({open:t,onOpenChange:e,title:n,description:r,children:s,width:i=560,hideHeader:o}){return d.jsx(jT,{open:t,onOpenChange:e,children:d.jsxs(NT,{children:[d.jsx(ET,{className:"fade-in fixed inset-0 z-40 bg-ink/25 backdrop-blur-[1px]"}),d.jsxs($T,{className:"fade-in fixed left-1/2 top-[12vh] z-50 flex max-h-[76vh] w-[calc(100vw-32px)] -translate-x-1/2 flex-col overflow-hidden rounded-2xl border border-rule bg-raised shadow-float",style:{maxWidth:i},"aria-describedby":void 0,children:[o?d.jsx(Lb,{className:"sr-only",children:n}):d.jsxs("div",{className:"flex items-start gap-3 border-b border-rule px-5 py-4",children:[d.jsxs("div",{className:"flex-1",children:[d.jsx(Lb,{className:"text-[15px] font-semibold",children:n}),r&&d.jsx(Zm,{className:"mt-0.5 text-[12.5px] text-ink-2",children:r})]}),d.jsx(wV,{"aria-label":"Close",className:"rounded-md p-1 text-ink-3 hover:bg-sunken hover:text-ink",children:d.jsx(zo,{size:16})})]}),!r&&!o&&d.jsx(Zm,{className:"sr-only",children:n}),o&&d.jsx(Zm,{className:"sr-only",children:r??n}),s]})]})})}function DV(){const t=T(l=>l.paletteOpen),e=T(l=>l.setPaletteOpen),n=ze(),r=n.doc,s=l=>{e(!1),l()},i=l=>s(()=>Ad(l)),o="flex cursor-pointer items-center gap-3 rounded-lg px-3 py-2 text-[13px] aria-selected:bg-sunken";return d.jsx(Lo,{open:t,onOpenChange:e,title:"Search",description:"Find anything in the open document: parts, states, messages, data and diagrams",width:620,hideHeader:!0,children:d.jsxs(Ye,{label:"Search the model",loop:!0,filter:zV,className:"flex min-h-0 flex-col",children:[d.jsx(Ye.Input,{autoFocus:!0,placeholder:"Search parts, states, messages, data, diagrams…",className:"h-12 w-full border-b border-rule bg-transparent px-5 text-[15px] outline-none placeholder:text-ink-3 focus-visible:outline-none"}),d.jsxs(Ye.List,{className:"scrollbar-quiet max-h-[56vh] overflow-y-auto p-2 [&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:pt-3 [&_[cmdk-group-heading]]:text-[11.5px] [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:text-ink-3",children:[d.jsx(Ye.Empty,{className:"px-3 py-8 text-center text-ink-3",children:"Nothing in this document matches. Try a part, a state, a message or a diagram name."}),r.walkthroughs.length>0&&d.jsx(Ye.Group,{heading:"Walkthroughs",children:r.walkthroughs.map(l=>d.jsxs(Ye.Item,{className:o,value:`${Nr(l.title)} walkthrough change`,onSelect:()=>s(()=>T.getState().navigate(`walk:${l.id}`)),children:[d.jsx(gp,{size:15,className:"text-poney"}),d.jsx("span",{className:"flex-1",children:Nr(l.title)}),d.jsxs("span",{className:"text-[12px] text-ink-3",children:[l.scenes.length," scenes"]})]},l.id))}),d.jsxs(Ye.Group,{heading:"Diagrams",children:[d.jsxs(Ye.Item,{className:o,value:"Project overview",onSelect:()=>s(()=>T.getState().navigate(xt)),children:[d.jsx(bo,{size:15,className:"text-ink-3"}),"Project overview"]}),r.views.map(l=>{var u;const c=((u=Yr(l))==null?void 0:u.icon)??bo;return d.jsxs(Ye.Item,{className:o,value:`${l.title} ${l.type} diagram`,onSelect:()=>s(()=>T.getState().navigate(l.id)),children:[d.jsx(c,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"flex-1",children:l.title}),d.jsx("span",{className:"text-[12px] text-ink-3",children:zd(l.category)})]},l.id)})]}),d.jsx(Ye.Group,{heading:"Parts of the system",children:r.model.entities.map(l=>{const c=n.style(l),u=Md(c.icon);return d.jsxs(Ye.Item,{className:o,value:`${l.name} ${l.id} ${c.label} ${l.technology??""} ${l.summary}`,onSelect:()=>i({kind:"entity",id:l.id}),children:[d.jsx(u,{size:15,style:{color:dt(c.tone)}}),d.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[l.name," ",d.jsxs("span",{className:"text-ink-3",children:["— ",l.summary]})]}),d.jsx("span",{className:"shrink-0 text-[12px] text-ink-3",children:c.label})]},l.id)})}),d.jsx(Ye.Group,{heading:"Data",children:r.model.dataTypes.map(l=>d.jsxs(Ye.Item,{className:o,value:`${l.name} ${l.id} ${l.kind} ${l.summary} ${l.fields.map(c=>c.name).join(" ")}`,onSelect:()=>i({kind:"dataType",id:l.id}),children:[d.jsx(Ed,{size:15,className:"text-ink-3"}),d.jsx("span",{className:`flex-1 ${l.kind==="table"?"font-mono text-[12.5px]":""}`,children:l.name}),d.jsx("span",{className:"text-[12px] text-ink-3",children:l.kind==="table"?"Table":l.kind==="event"?"Event":"Record"})]},l.id))}),d.jsxs(Ye.Group,{heading:"Behaviors and use cases",children:[r.model.behaviors.map(l=>d.jsxs(Ye.Item,{className:o,value:`${l.name} ${l.summary}`,onSelect:()=>s(()=>{const c=n.viewsForBehavior(l.id)[0];c?T.getState().navigate(c.id):T.getState().select({kind:"behavior",id:l.id})}),children:[d.jsx($d,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"flex-1",children:l.name}),d.jsx("span",{className:"text-[12px] text-ink-3",children:n.describe({kind:"behavior",id:l.id}).kind})]},l.id)),r.model.capabilities.map(l=>d.jsxs(Ye.Item,{className:o,value:`${l.name} ${l.summary} ${l.area} use case`,onSelect:()=>i({kind:"capability",id:l.id}),children:[d.jsx(l1,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"flex-1",children:l.name}),d.jsx("span",{className:"text-[12px] text-ink-3",children:"Use case"})]},l.id))]}),d.jsx(Ye.Group,{heading:"States, steps and messages",children:r.model.behaviors.flatMap(l=>l.kind==="state-machine"?[...l.states.filter(c=>c.kind!=="initial").map(c=>d.jsxs(Ye.Item,{className:o,value:`${c.name} ${c.id} state ${c.description??""} ${l.name}`,onSelect:()=>i({kind:"state",behavior:l.id,id:c.id}),children:[d.jsx(dD,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"min-w-0 flex-1 truncate",children:c.name}),d.jsxs("span",{className:"shrink-0 text-[12px] text-ink-3",children:["State in ",l.name]})]},`s-${l.id}-${c.id}`)),...l.transitions.map(c=>d.jsxs(Ye.Item,{className:o,value:`${c.event} ${c.guard??""} transition ${l.name}`,onSelect:()=>i({kind:"transition",behavior:l.id,id:c.id}),children:[d.jsx(Gr,{size:15,className:"text-ink-3"}),d.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[c.event,c.guard&&d.jsxs("span",{className:"text-ink-3",children:[" [",c.guard,"]"]})]}),d.jsxs("span",{className:"shrink-0 text-[12px] text-ink-3",children:["Transition in ",l.name]})]},`t-${l.id}-${c.id}`))]:l.kind==="interaction"?n.messages(l.id).map(({message:c})=>d.jsxs(Ye.Item,{className:o,value:`${c.label} ${c.id} message ${l.name}`,onSelect:()=>i({kind:"message",behavior:l.id,id:c.id}),children:[d.jsx(Gr,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"min-w-0 flex-1 truncate",children:c.label}),d.jsxs("span",{className:"shrink-0 text-[12px] text-ink-3",children:["Message in ",l.name]})]},`m-${l.id}-${c.id}`)):l.kind==="process"?l.nodes.filter(c=>c.label).map(c=>d.jsxs(Ye.Item,{className:o,value:`${c.label} ${c.id} step ${l.name}`,onSelect:()=>i({kind:"activityNode",behavior:l.id,id:c.id}),children:[d.jsx(BE,{size:15,className:"text-ink-3"}),d.jsx("span",{className:"min-w-0 flex-1 truncate",children:c.label}),d.jsxs("span",{className:"shrink-0 text-[12px] text-ink-3",children:["Step in ",l.name]})]},`n-${l.id}-${c.id}`)):[])}),d.jsxs(Ye.Group,{heading:"Actions",children:[d.jsxs(Ye.Item,{className:o,value:"Fit diagram to view",onSelect:()=>s(()=>T.getState().requestFocus("fit")),children:[d.jsx(sE,{size:15,className:"text-ink-3"}),"Fit the diagram to the view"]}),d.jsxs(Ye.Item,{className:o,value:"Copy JSON export clipboard",onSelect:()=>s(()=>void T1()),children:[d.jsx(fN,{size:15,className:"text-ink-3"}),"Copy the model as JSON"]}),d.jsxs(Ye.Item,{className:o,value:"Open paste import Mermaid JSON",onSelect:()=>s(()=>T.getState().setImportOpen(!0)),children:[d.jsx(r1,{size:15,className:"text-ink-3"}),"Open or paste a model (Poney JSON or Mermaid)"]}),d.jsxs(Ye.Item,{className:o,value:"Toggle dark light theme",onSelect:()=>s(()=>T.getState().toggleTheme()),children:[d.jsx(o1,{size:15,className:"text-ink-3"}),"Switch theme"]}),d.jsxs(Ye.Item,{className:o,value:"Keyboard shortcuts help",onSelect:()=>s(()=>T.getState().setShortcutsOpen(!0)),children:[d.jsx(UN,{size:15,className:"text-ink-3"}),"Keyboard shortcuts"]})]})]})]})})}function zV(t,e){const n=e.toLowerCase().split(/\s+/).filter(Boolean);if(!n.length)return 1;const r=t.toLowerCase(),s=r.split(/[^\p{L}\p{N}]+/u).filter(Boolean);let i=0;for(const o of n){const a=s.findIndex(l=>l.startsWith(o));if(a>=0)i+=a===0?1:a<4?.8:.6;else if(r.includes(o))i+=.3;else return 0}return i/n.length}const LV=[{label:"Sequence",text:`sequenceDiagram
691
- title Password reset
692
- actor User
693
- participant Web as Web app
694
- participant Auth as Auth service
695
- participant Mail as Email provider
696
- User->>Web: Ask for a reset link
697
- Web->>Auth: RequestReset(email)
698
- alt account exists
699
- Auth->>Mail: Send reset email
700
- Mail-->>Auth: Accepted
701
- else no account
702
- Auth->>Auth: Wait, to hide the difference
703
- end
704
- Auth-->>Web: 202 Accepted
705
- Web-->>User: Check your inbox`},{label:"Flowchart",text:`flowchart TD
706
- title Deploy pipeline
707
- subgraph CI
708
- A([Push to main]) --> B[Run tests]
709
- B --> C{Tests pass?}
710
- end
711
- subgraph Release
712
- C -->|Yes| D[Build image]
713
- D --> E[Deploy to staging]
714
- E --> F{Smoke tests pass?}
715
- F -->|Yes| G[Promote to production]
716
- G --> H([Done])
717
- end
718
- C -->|No| I[Notify author]
719
- F -->|No| J[Roll back]
720
- J --> I`},{label:"State",text:`stateDiagram-v2
721
- title Support ticket
722
- [*] --> Open
723
- Open --> InProgress : Agent picks up
724
- InProgress --> Waiting : Needs customer [question asked] / pause SLA
725
- Waiting --> InProgress : Customer replies / resume SLA
726
- InProgress --> Resolved : Fix shipped
727
- Resolved --> Open : Customer reopens [within 7 days]
728
- Resolved --> [*]`},{label:"ER",text:`erDiagram
729
- CUSTOMER ||--o{ INVOICE : receives
730
- INVOICE ||--|{ LINE_ITEM : contains
731
- PRODUCT ||--o{ LINE_ITEM : "is billed as"
732
- CUSTOMER {
733
- uuid id PK
734
- string email UK
735
- string name
736
- }
737
- INVOICE {
738
- uuid id PK
739
- uuid customer_id FK
740
- date issued_on
741
- int total_cents
742
- }
743
- LINE_ITEM {
744
- uuid id PK
745
- uuid invoice_id FK
746
- uuid product_id FK
747
- int quantity
748
- }
749
- PRODUCT {
750
- uuid id PK
751
- string sku UK
752
- int price_cents
753
- }`}];function LT(){const t=T(c=>c.importOpen),e=T(c=>c.importText),n=T(c=>c.setImportOpen),[r,s]=b.useState(""),i=b.useRef(null);b.useEffect(()=>{t&&s(e)},[t,e]);const o=Mp(r),a=b.useMemo(()=>r.trim()?M1(r):null,[r]),l=async c=>s(await c.text());return d.jsx(Lo,{open:t,onOpenChange:c=>n(c),title:"Open a model",description:"Paste or drop a Poney document, or a Mermaid sequence, flowchart, state or ER diagram. Mermaid is converted to a Poney model.",width:720,children:d.jsxs("div",{className:"flex min-h-0 flex-col gap-3 p-5",onDragOver:c=>c.preventDefault(),onDrop:c=>{c.preventDefault();const u=c.dataTransfer.files[0];u&&l(u)},children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("span",{className:"text-[12px] text-ink-3",children:"Try a Mermaid example:"}),LV.map(c=>d.jsx("button",{type:"button",className:"rounded-md border border-rule px-2 py-1 text-[12px] text-ink-2 hover:border-rule-strong hover:text-ink",onClick:()=>s(c.text),children:c.label},c.label)),d.jsx("span",{className:"flex-1"}),d.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-md border border-rule px-2 py-1 text-[12px] text-ink-2 hover:border-rule-strong hover:text-ink",onClick:()=>{var c;return(c=i.current)==null?void 0:c.click()},children:[d.jsx(nz,{size:13})," Choose a file"]}),d.jsx("input",{ref:i,type:"file",accept:".poney,.json,.mmd,.mermaid,.txt,application/json",className:"hidden",onChange:c=>{var u;return((u=c.target.files)==null?void 0:u[0])&&void l(c.target.files[0])}})]}),d.jsx("label",{className:"sr-only",htmlFor:"import-text",children:"Model text"}),d.jsx("textarea",{id:"import-text",value:r,onChange:c=>s(c.target.value),spellCheck:!1,placeholder:`{ "poneyVersion": "0.1.0", … }
754
-
755
- or
756
-
757
- sequenceDiagram
758
- Alice->>Bob: Hello`,className:"scrollbar-quiet h-[300px] w-full resize-none rounded-xl border border-rule bg-plaster p-3 font-mono text-[12px] leading-relaxed outline-none focus:border-rule-strong"}),d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsxs("div",{className:"min-w-0 flex-1 text-[12.5px]","aria-live":"polite",children:[(a==null?void 0:a.ok)&&d.jsxs("p",{className:"flex items-center gap-1.5 text-[color:var(--success)]",children:[d.jsx(aN,{size:14})," ",o.label,": “",a.doc.project.name,"”, ",a.doc.views.length," view",a.doc.views.length>1?"s":"","."]}),a&&!a.ok&&d.jsxs("div",{className:"text-[color:var(--failure)]",children:[d.jsxs("p",{className:"flex items-center gap-1.5 font-semibold",children:[d.jsx(Nd,{size:14})," ",o.label,". It cannot be opened yet:"]}),d.jsx("ul",{className:"mt-1 max-h-24 list-disc overflow-y-auto pl-5 text-ink-2",children:a.issues.slice(0,8).map((c,u)=>d.jsxs("li",{children:[c.path&&d.jsx("code",{className:"font-mono text-[11.5px]",children:c.path})," ",c.message]},u))})]}),!a&&d.jsxs("p",{className:"text-ink-3",children:[o.label,"."]})]}),d.jsx("button",{type:"button",disabled:!(a!=null&&a.ok),onClick:()=>HM(r,"imported"),className:"h-9 shrink-0 rounded-lg bg-ink px-4 font-semibold text-paper transition-opacity hover:opacity-90 disabled:opacity-30",children:"Open model"})]})]})})}const FV=[{title:"Find and move",keys:[["⌘K or /","Search this document"],["⌘Z ⇧⌘Z","Undo and redo a change"],["⌥← ⌥→","Back and forward"],["O","Project overview"],["[ ]","Show or hide the sidebar and the inspector"]]},{title:"Canvas",keys:[["Tab","Move between elements"],["Enter","Select the focused element"],["Double-click","Rename a part, a line, a message, a state or a step"],["F","Zoom to the selection"],["Esc","Clear the selection"],["+ −","Zoom in and out"],["⇧1 ⇧0","Fit the diagram, or 100%"],["Arrows","Pan, when the canvas has focus"],["Scroll · ⌘ + scroll","Pan · zoom at the pointer"]]},{title:"Model",keys:[["⇧⌘C","Copy the model as Poney JSON"],["⌘V","Open pasted Poney JSON or Mermaid"]]}];function BV(){const t=T(n=>n.shortcutsOpen),e=T(n=>n.setShortcutsOpen);return d.jsx(Lo,{open:t,onOpenChange:e,title:"Keyboard shortcuts",width:520,children:d.jsx("div",{className:"scrollbar-quiet overflow-y-auto px-5 py-4",children:FV.map(n=>d.jsxs("section",{className:"mb-4 last:mb-0",children:[d.jsx("h3",{className:"mb-1.5 text-[12px] font-semibold text-ink-3",children:n.title}),d.jsx("dl",{className:"divide-y divide-rule",children:n.keys.map(([r,s])=>d.jsxs("div",{className:"flex items-center justify-between gap-4 py-1.5",children:[d.jsx("dt",{className:"text-ink-2",children:s}),d.jsx("dd",{className:"shrink-0 rounded-md bg-sunken px-1.5 py-0.5 text-[12px] text-ink",children:r})]},r))})]},n.title))})})}function VV(){const t=T(n=>n.notice),e=T(n=>n.notify);return b.useEffect(()=>{if(!t)return;const n=setTimeout(()=>e(null),4200);return()=>clearTimeout(n)},[t,e]),d.jsx("div",{role:"status","aria-live":"polite",className:"pointer-events-none fixed bottom-20 left-1/2 z-50 -translate-x-1/2",children:t&&d.jsxs("div",{className:"fade-in pointer-events-auto flex max-w-[520px] items-center gap-3 rounded-xl bg-ink px-4 py-2.5 text-[13px] text-paper shadow-float",children:[d.jsx("span",{children:t}),d.jsx("button",{type:"button","aria-label":"Dismiss",className:"text-paper/60 hover:text-paper",onClick:()=>e(null),children:d.jsx(zo,{size:14})})]})})}const FT=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches;function WV({frame:t,label:e,children:n,pad:r=56,maxScale:s=1.25}){var E;const i=b.useRef(null),[o,a]=b.useState({w:0,h:0}),[l,c]=b.useState(null),[u,f]=b.useState(!1),h=b.useRef(null),m=b.useRef(0),g=b.useRef(null);b.useLayoutEffect(()=>{const S=i.current;if(!S)return;const _=new ResizeObserver(([N])=>a({w:N.contentRect.width,h:N.contentRect.height}));return _.observe(S),()=>_.disconnect()},[]);const p=b.useMemo(()=>o.w&&o.h?HP(t,o.w,o.h,r,s):null,[t,o,r,s]),x=b.useCallback(S=>{h.current=S,c(S)},[]),y=b.useCallback(S=>{cancelAnimationFrame(m.current);const _=h.current;if(!_||FT())return x(S);const N=performance.now(),M=700,P=V=>{const Z=Math.min(1,(V-N)/M),Y=Z<.5?4*Z*Z*Z:1-Math.pow(-2*Z+2,3)/2;x({x:_.x+(S.x-_.x)*Y,y:_.y+(S.y-_.y)*Y,w:_.w+(S.w-_.w)*Y,h:_.h+(S.h-_.h)*Y}),Z<1&&(m.current=requestAnimationFrame(P))};m.current=requestAnimationFrame(P)},[x]);b.useEffect(()=>{if(p)return f(!1),y(p),()=>cancelAnimationFrame(m.current)},[p,y]);const v=b.useCallback((S,_=.5,N=.5)=>{const M=h.current;if(!M||!p)return;cancelAnimationFrame(m.current);const P=Math.min(p.w*4,Math.max(p.w/6,M.w/S)),V=P*(M.h/M.w),Z=M.x+_*M.w,Y=M.y+N*M.h;x({x:Z-_*P,y:Y-N*V,w:P,h:V}),f(!0)},[p,x]);b.useEffect(()=>{const S=i.current;if(!S)return;const _=M=>{if(!(M.ctrlKey||M.metaKey))return;M.preventDefault();const P=S.getBoundingClientRect();v(Math.exp(-Math.max(-24,Math.min(24,M.deltaY))*.012),(M.clientX-P.left)/P.width,(M.clientY-P.top)/P.height)},N=M=>M.preventDefault();return S.addEventListener("wheel",_,{passive:!1}),S.addEventListener("gesturestart",N),S.addEventListener("gesturechange",N),()=>{S.removeEventListener("wheel",_),S.removeEventListener("gesturestart",N),S.removeEventListener("gesturechange",N)}},[v]);const k=S=>{S.button===0&&(g.current={x:S.clientX,y:S.clientY,id:S.pointerId,moved:!1})},w=S=>{const _=g.current,N=h.current;if(!_||!N||!i.current)return;const M=S.clientX-_.x,P=S.clientY-_.y;if(!_.moved&&Math.hypot(M,P)<4)return;if(!_.moved)try{i.current.setPointerCapture(_.id)}catch{}_.moved=!0,_.x=S.clientX,_.y=S.clientY;const V=i.current.getBoundingClientRect();cancelAnimationFrame(m.current),x({...N,x:N.x-M*N.w/V.width,y:N.y-P*N.h/V.height}),f(!0)},j=()=>{var S;if((S=g.current)!=null&&S.moved){const _=N=>{N.stopPropagation(),N.preventDefault()};window.addEventListener("click",_,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",_,{capture:!0}),0)}g.current=null},C=l&&o.w?o.w/l.w:1;return d.jsxs("div",{ref:i,className:`relative h-full w-full touch-none select-none ${(E=g.current)!=null&&E.moved?"cursor-grabbing":"cursor-grab"}`,onPointerDown:k,onPointerMove:w,onPointerUp:j,onPointerCancel:()=>g.current=null,onKeyDown:S=>{S.key!=="Tab"||S.altKey||S.metaKey||S.ctrlKey||!S.target.closest("[data-ref]")||uT(S.currentTarget,S.target,S.shiftKey)&&S.preventDefault()},onDoubleClick:S=>{if(S.target.closest("[data-ref]"))return;const _=i.current.getBoundingClientRect();v(1.6,(S.clientX-_.left)/_.width,(S.clientY-_.top)/_.height)},children:[l&&d.jsx("svg",{className:"absolute inset-0 h-full w-full",viewBox:`${l.x} ${l.y} ${l.w} ${l.h}`,role:"img","aria-label":e,children:n}),d.jsxs("div",{className:"absolute bottom-3 right-3 flex items-center gap-0.5 rounded-lg border border-rule bg-raised/95 p-0.5 shadow-float backdrop-blur",onPointerDown:S=>S.stopPropagation(),children:[d.jsx("button",{type:"button","aria-label":"Zoom out",title:"Zoom out",onClick:()=>v(1/1.3),className:"grid h-7 w-7 place-items-center rounded-md text-ink-2 hover:bg-sunken",children:d.jsx(uE,{size:14})}),d.jsxs("span",{className:"font-tabular w-11 text-center text-[11.5px] text-ink-3",children:[Math.round(C*100),"%"]}),d.jsx("button",{type:"button","aria-label":"Zoom in",title:"Zoom in (or pinch)",onClick:()=>v(1.3),className:"grid h-7 w-7 place-items-center rounded-md text-ink-2 hover:bg-sunken",children:d.jsx(a1,{size:14})}),u&&d.jsx("button",{type:"button",onClick:()=>p?(f(!1),y(p)):void 0,className:"h-7 rounded-md px-2 text-[12px] font-medium text-ink-2 hover:bg-sunken",children:"Reset view"}),d.jsx(fT,{className:"h-7 w-7"})]})]})}const Bb=new WeakMap;function UV(t,e){const n=f1(),r=`${t.id}|${JSON.stringify(e)}`,[s,i]=b.useState(null);return b.useEffect(()=>{let o=!0,a=Bb.get(n);a||Bb.set(n,a=new Map);let l=a.get(r);return l||(l=document.fonts.ready.then(()=>O_(n,t,e)),a.set(r,l)),l.then(c=>o&&i({key:r,scene:c})),()=>{o=!1}},[n,r]),(s==null?void 0:s.key)===r?s.scene:s==null?void 0:s.scene}function yu({view:t,walkthrough:e,marks:n,mode:r,focus:s,callouts:i,hot:o,setHot:a,maxScale:l,sceneData:c,traceStep:u=null}){var C;const[f,h]=b.useState(void 0);b.useEffect(()=>h(void 0),[t]);const m=b.useCallback(E=>h(S=>{const _=S??(t.type==="map"?t.collapsed:[]);return _.includes(E)?_.filter(N=>N!==E):[..._,E]}),[t]),g=b.useMemo(()=>({...WP(t,e,s),...f?{collapsed:f}:{}}),[t,e,s,f]),p=UV(t,g),x=ze(),y=b.useMemo(()=>p?ZP(p,t,s,x,e):null,[p,t,s,x,e]),v=u!==null?(C=c==null?void 0:c.trace[u])==null?void 0:C.ref:void 0,k=b.useMemo(()=>{var Y;if(!p||!y||!v)return y;const E=an(v),S=Xv([v],x,e);if((E==null?void 0:E.kind)==="message"){const O=(Y=x.messages(E.behavior).find(R=>R.message.id===E.id))==null?void 0:Y.message;O&&S.push(`entity:${O.from}`,`entity:${O.to}`)}const _=S.map(O=>p.anchors[O]).filter(O=>!!O);if(!_.length)return y;const N=Ci(_),M=Math.min(y.w,Math.max(N.w,620)),P=Math.min(y.h,Math.max(N.h,340)),V=Math.max(y.x+M/2,Math.min(y.x+y.w-M/2,N.x+N.w/2)),Z=Math.max(y.y+P/2,Math.min(y.y+y.h-P/2,N.y+N.h/2));return{x:V-M/2,y:Z-P/2,w:M,h:P}},[p,y,v,x,e]),w=dT(),j=b.useMemo(()=>({...qP({marks:n,mode:r,view:t,focus:s,callouts:i,hot:o,setHot:a,idx:x,walkthrough:e,effects:[...(c==null?void 0:c.effects)??[],...w.effects],badges:[...(c==null?void 0:c.badges)??[],...w.badges],trace:c==null?void 0:c.trace,traceStep:u,animate:!FT()}),...t.type==="map"?{toggleGroup:m}:{}}),[n,r,t,s,i,o,a,x,e,m,c,u,w]);return!p||!k?d.jsx("div",{className:"grid h-full place-items-center text-ink-3",children:"Drawing…"}):d.jsx(Jv,{value:j,children:d.jsx("div",{className:"h-full",onContextMenu:cT(t.id),children:d.jsx(WV,{frame:k,label:t.title,maxScale:l,children:t.type==="map"||t.type==="sequence"||t.type==="state"?d.jsx(Mz,{view:t,scene:p,extra:e==null?void 0:e.removed.entities}):d.jsx(ZV,{view:t,scene:p})})})})}function ZV({view:t,scene:e}){const n=Yr(t);if(!n)return null;const r=n.Renderer;return d.jsx(r,{view:t,scene:e})}let Vb;const qm=new Map,HV={ex:"elixir",exs:"elixir",heex:"html",eex:"html",leex:"html",rb:"ruby",rake:"ruby",gemspec:"ruby",ru:"ruby",erb:"erb",js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",ts:"typescript",mts:"typescript",cts:"typescript",tsx:"tsx",py:"python",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",php:"php",cs:"csharp",c:"c",h:"c",cc:"cpp",cpp:"cpp",hpp:"cpp",scala:"scala",clj:"clojure",erl:"erlang",hs:"haskell",sql:"sql",graphql:"graphql",gql:"graphql",proto:"proto",json:"json",jsonc:"jsonc",yml:"yaml",yaml:"yaml",toml:"toml",xml:"xml",html:"html",css:"css",scss:"scss",md:"markdown",sh:"shellscript",bash:"shellscript",zsh:"shellscript",vue:"vue",svelte:"svelte",tf:"hcl"},qV={Gemfile:"ruby",Rakefile:"ruby",Dockerfile:"docker",Makefile:"make","mix.lock":"elixir"};function KV(t){const e=t.split("/").pop()??t;return qV[e]??HV[e.includes(".")?e.split(".").pop().toLowerCase():""]}async function JV(t){Vb??(Vb=Uv(()=>import("./dist-_ey1iXf6.js"),[]).then(n=>n.createHighlighter({themes:["github-light","github-dark"],langs:[]})));const e=await Vb;return qm.has(t)||qm.set(t,e.loadLanguage(t).then(()=>!0,()=>!1)),await qm.get(t)?e:void 0}function GV(t,e,n){return t.codeToTokens(n.join(`
759
- `),{lang:e,themes:{light:"github-light",dark:"github-dark"},defaultColor:!1}).tokens.map(r=>r.map(s=>({content:s.content,style:s.htmlStyle})))}function YV(t){const[e,n]=b.useState(),r=KV(t.path);return b.useEffect(()=>{if(n(void 0),!r)return;let s=!0;return JV(r).then(i=>{if(!i||!s)return;const o=new Map;t.hunks.forEach((a,l)=>{for(const c of["new","old"]){const u=a.lines.map((h,m)=>({l:h,li:m})).filter(({l:h})=>c==="new"?h.kind!=="del":h.kind!=="add"),f=GV(i,r,u.map(({l:h})=>h.text));u.forEach(({l:h,li:m},g)=>{(c==="new"||h.kind==="del")&&o.set(`${l}:${m}`,f[g]??[])})}}),n(o)}),()=>{s=!1}},[t,r]),e}var BT={exports:{}},VT={};/**
760
- * @license React
761
- * use-sync-external-store-shim.production.js
762
- *
763
- * Copyright (c) Meta Platforms, Inc. and affiliates.
764
- *
765
- * This source code is licensed under the MIT license found in the
766
- * LICENSE file in the root directory of this source tree.
767
- */var tl=b;function QV(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var XV=typeof Object.is=="function"?Object.is:QV,e7=tl.useState,t7=tl.useEffect,n7=tl.useLayoutEffect,r7=tl.useDebugValue;function s7(t,e){var n=e(),r=e7({inst:{value:n,getSnapshot:e}}),s=r[0].inst,i=r[1];return n7(function(){s.value=n,s.getSnapshot=e,Km(s)&&i({inst:s})},[t,n,e]),t7(function(){return Km(s)&&i({inst:s}),t(function(){Km(s)&&i({inst:s})})},[t]),r7(n),n}function Km(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!XV(t,n)}catch{return!0}}function i7(t,e){return e()}var o7=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?i7:s7;VT.useSyncExternalStore=tl.useSyncExternalStore!==void 0?tl.useSyncExternalStore:o7;BT.exports=VT;var B1=BT.exports;function qt(t){this.content=t}qt.prototype={constructor:qt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new qt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new qt(n)},addToStart:function(t,e){return new qt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new qt(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new qt(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=qt.from(t),t.size?new qt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=qt.from(t),t.size?new qt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=qt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};qt.from=function(t){if(t instanceof qt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new qt(e)};function WT(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){let o=s.text,a=i.text,l=0;for(;o[l]==a[l];l++)n++;return l&&l<o.length&&l<a.length&&HT(o.charCodeAt(l-1))&&ZT(o.charCodeAt(l))&&n--,n}if(s.content.size||i.content.size){let o=WT(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function UT(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),a=e.child(--i),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=o.text,u=a.text,f=c.length,h=u.length;for(;f>0&&h>0&&c[f-1]==u[h-1];)f--,h--,n--,r--;return f&&h&&f<c.length&&HT(c.charCodeAt(f-1))&&ZT(c.charCodeAt(f))&&(n++,r++),{a:n,b:r}}if(o.content.size||a.content.size){let c=UT(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}function ZT(t){return t>=56320&&t<57344}function HT(t){return t>=55296&&t<56320}class J{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,i){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,s+a,i||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,s+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new J(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let a=this.content[i],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),s+=a.nodeSize),o=l}return new J(r,s)}cutByIndex(e,n){return e==n?J.empty:e==0&&n==this.content.length?this:new J(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new J(s,i)}addToStart(e){return new J([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new J(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return WT(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return UT(this,e,n,r)}findIndex(e){if(e==0)return xu(0,e);if(e==this.size)return xu(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?xu(n+1,i):xu(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return J.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return J.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return J.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new J(n||e,r)}static from(e){if(!e)return J.empty;if(e instanceof J)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new J([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}J.empty=new J([],0);const Jm={index:0,offset:0};function xu(t,e){return Jm.index=t,Jm.offset=e,Jm}function ah(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!ah(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!ah(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ge=class xx{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ah(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return xx.none;if(e instanceof xx)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};Ge.none=[];class td extends Error{}class ce{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=KT(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new ce(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ce(qT(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return ce.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ce(J.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new ce(e,r,s)}}ce.empty=new ce(J.empty,0,0);function qT(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(s==e||i.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(qT(i.content,e-s-1,n-s-1)))}function KT(t,e,n,r,s,i){let{index:o,offset:a}=t.findIndex(e),l=t.maybeChild(o);if(a==e||l.isText)return i&&r<=0&&s<=0&&!i.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=KT(l.content,e-a-1,n,o==0?r-1:0,o==t.childCount-1?s-1:0,l);return c&&t.replaceChild(o,l.copy(c))}function a7(t,e,n){if(n.openStart>t.depth)throw new td("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new td("Inconsistent open depths");return JT(t,e,n,0)}function JT(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=JT(t,e,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return lo(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=l7(n,t);return lo(i,YT(t,o,a,e,r))}else return lo(i,lh(t,e,r))}function GT(t,e){if(!e.type.compatibleContent(t.type))throw new td("Cannot join "+e.type.name+" onto "+t.type.name)}function vx(t,e,n){let r=t.node(n);return GT(r,e.node(n)),r}function ao(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function mc(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(ao(t.nodeAfter,r),i++));for(let a=i;a<o;a++)ao(s.child(a),r);e&&e.depth==n&&e.textOffset&&ao(e.nodeBefore,r)}function lo(t,e){if(!t.type.validContent(e))throw new td("Invalid content for node "+t.type.name);return t.copy(e)}function YT(t,e,n,r,s){let i=t.depth>s&&vx(t,e,s+1),o=r.depth>s&&vx(n,r,s+1),a=[];return mc(null,t,s,a),i&&o&&e.index(s)==n.index(s)?(GT(i,o),ao(lo(i,YT(t,e,n,r,s+1)),a)):(i&&ao(lo(i,lh(t,e,s+1)),a),mc(e,n,s,a),o&&ao(lo(o,lh(n,r,s+1)),a)),mc(r,null,s,a),new J(a)}function lh(t,e,n){let r=[];if(mc(null,t,n,r),t.depth>n){let s=vx(t,e,n+1);ao(lo(s,lh(t,e,n+1)),r)}return mc(e,null,n,r),new J(r)}function l7(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(J.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class nd{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ge.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let a=r;r=s,s=a}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new ch(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,i=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(i),c=i-l;if(r.push(o,a,s+l),!c||(o=o.child(a),o.isText))break;i=c-1,s+=l+1}return new nd(n,r,i)}static resolveCached(e,n){let r=Wb.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else Wb.set(e,r=new c7);let s=r.elts[r.i]=nd.resolve(e,n);return r.i=(r.i+1)%d7,s}}class c7{constructor(){this.elts=[],this.i=0}}const d7=12,Wb=new WeakMap;class ch{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const u7=Object.create(null);let xi=class kx{constructor(e,n,r,s=Ge.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||J.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,s=0){this.content.nodesBetween(e,n,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,s){return this.content.textBetween(e,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&ah(this.attrs,n||e.defaultAttrs||u7)&&Ge.sameSet(this.marks,r||Ge.none)}copy(e=null){return e==this.content?this:new kx(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new kx(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ce.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),a=s.start(o),c=s.node(o).content.cut(s.pos-a,i.pos-a);return new ce(c,s.depth-o,i.depth-o)}replace(e,n,r){return a7(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return nd.resolveCached(this,e)}resolveNoCache(e){return nd.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),QT(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=J.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=s;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),Zb(this.type.attrs,this.attrs,"node",this.type.name);let e=Ge.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];Zb(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Ge.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=J.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,s,r)}};xi.prototype.text=void 0;const Ub=(()=>{let{stack:t}=new Error("/");if(!t||!/\n\s*at\s/.test(t))return n=>n;let e=Object.create(null);return n=>(e[n],n)})();class dh extends xi{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):QT(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return Ub(this.text.slice(e,n))}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new dh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new dh(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(Ub(this.text.slice(e,n)))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function QT(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}function Zb(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${r}`);for(let s in t)t[s].validate&&t[s].validate(e[s])}class To{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new f7(e,n);if(r.next==null)return To.empty;let s=XT(r);r.next&&r.err("Unexpected trailing text");let i=v7(x7(s));return k7(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function i(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return J.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:f}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(f)==-1){s.push(f);let h=i(f,a.concat(u));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let a=s;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:a,next:l}=i.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!s.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
768
- `)}}To.empty=new To(!0);class f7{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function XT(t){let e=[];do e.push(h7(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function h7(t){let e=[];do e.push(p7(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function p7(t){let e=y7(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=m7(t,e);else break;return e}function Hb(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function m7(t,e){let n=Hb(t),r=n;return t.eat(",")&&(t.next!="}"?r=Hb(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function g7(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function y7(t){if(t.eat("(")){let e=XT(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=g7(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function x7(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function s(o,a){o.forEach(l=>l.to=a)}function i(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=i(o.exprs[l],a);if(l==o.exprs.length-1)return c;s(c,a=n())}else if(o.type=="star"){let l=n();return r(a,l),s(i(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return s(i(o.expr,a),l),s(i(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(i(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=n();s(i(o.expr,l),u),l=u}if(o.max==-1)s(i(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=n();r(l,u),s(i(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function e4(t,e){return e-t}function qb(t,e){let n=[];return r(e),n.sort(e4);function r(s){let i=t[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:a,to:l}=i[o];!a&&n.indexOf(l)==-1&&r(l)}}}function v7(t){let e=Object.create(null);return n(qb(t,0));function n(r){let s=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<s.length;u++)s[u][0]==a&&(c=s[u][1]);qb(t,l).forEach(u=>{c||s.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new To(r.indexOf(t.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(e4);i.next.push({type:s[o][0],next:e[a.join(",")]||n(a)})}return i}}function k7(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let a=0;a<s.next.length;a++){let{type:l,next:c}=s.next[a];o.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function t4(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function n4(t,e){let n=Object.create(null);for(let r in t){let s=t[r],i=e&&e[r];if(i===void 0)if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r);else s.validate&&s.validate(i);n[r]=i}return n}function r4(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new b7(t,r,e[r]);return n}let wx=class s4{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=r4(e,r.attrs),this.defaultAttrs=t4(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==To.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:n4(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new xi(this,this.computeAttrs(e),J.from(n),Ge.setFrom(r))}createChecked(e=null,n,r){return n=J.from(n),this.checkContent(n),new xi(this,this.computeAttrs(e),n,Ge.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=J.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(J.empty,!0);return i?new xi(this,e,n.append(i),Ge.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Ge.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,o)=>r[i]=new s4(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function w7(t,e,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class b7{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?w7(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ip{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=r4(e,s.attrs),this.excluded=null;let i=t4(this.attrs);this.instance=i?new Ge(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ge(this,n4(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Ip(i,s++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}excludes(e){return this.excluded.indexOf(e)>-1}}class i4{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=qt.from(e.nodes),n.marks=qt.from(e.marks||{}),this.nodes=wx.compile(this.spec.nodes,this),this.marks=Ip.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=To.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?Kb(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:Kb(this,o.split(" "))}this.nodeFromJSON=s=>xi.fromJSON(this,s),this.markFromJSON=s=>Ge.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof wx){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new dh(r,r.defaultAttrs,e,Ge.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Kb(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.marks[s],o=i;if(i)n.push(i);else for(let a in t.marks){let l=t.marks[a];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function S7(t){return t.tag!=null}function j7(t){return t.style!=null}class vi{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(S7(s))this.tags.push(s);else if(j7(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new Gb(this,n,!1);return r.addAll(e,Ge.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Gb(this,n,!0);return r.addAll(e,Ge.none,n.from,n.to),ce.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(N7(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Yb(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Yb(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new vi(e,vi.schemaRules(e)))}}const o4={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},C7={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},a4={ol:!0,ul:!0},rd=1,bx=2,gc=4;function Jb(t,e,n){return e!=null?(e?rd:0)|(e==="full"?bx:0):t&&t.whitespace=="pre"?rd|bx:n&~gc}class vu{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=Ge.none,this.match=i||(o&gc?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(J.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&rd)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=J.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(J.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!o4.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Gb{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=Jb(null,n.preserveWhitespace,0)|(r?gc:0);s?i=new vu(s.type,s.attrs,Ge.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new vu(null,null,Ge.none,!0,null,o):i=new vu(e.schema.topNodeType,null,Ge.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,i=s.options&bx?"full":this.localPreserveWS||(s.options&rd)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
769
- `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(o.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=s.content[s.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;a4.hasOwnProperty(o)&&this.parser.normalizeLists&&_7(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:C7.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(o4.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let f=l&&l.skip?n:this.readStyles(e,n);f&&this.addAll(e,f),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
770
- `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(i,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,s){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(a)&&this.open--}addAll(e,n,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=s==null?null:e.childNodes[s];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!s||s.length>c.length+a)&&(s=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=Ge.none;for(let a of s.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):Qb(a.type,e.type))&&(o=a.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,s){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,s)),i}enterInner(e,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=Jb(e,i,o.options);o.options&gc&&o.content.length==0&&(a|=gc);let l=Ge.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Qb(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new vu(e,n,l,s,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=rd)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&s?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function _7(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&a4.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function N7(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Yb(t){let e={};for(let n in t)e[n]=t[n];return e}function Qb(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class Fo{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=ku(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let a=0,l=0;for(;a<i.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)s=i.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,n);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return ku(n).createTextNode(e.text);let{dom:r,contentDOM:s}=Ku(ku(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&Ku(ku(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return typeof n=="string"?{dom:e.createTextNode(n)}:Ku(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Fo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Xb(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Xb(e.marks)}}function Xb(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ku(t){return t.document||window.document}const e2=new WeakMap;function E7(t){let e=e2.get(t);return e===void 0&&e2.set(t,e=$7(t)),e}function $7(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function Ku(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=E7(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let a,l=n?t.createElementNS(n,s):t.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let f in c)if(c[f]!=null){let h=f.indexOf(" ");h>0?l.setAttributeNS(f.slice(0,h),f.slice(h+1),c[f]):f=="style"&&l.style?l.style.cssText=c[f]:l.setAttribute(f,c[f])}}for(let f=u;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof h=="string")l.appendChild(t.createTextNode(h));else{let{dom:m,contentDOM:g}=Ku(t,h,n,r);if(l.appendChild(m),g){if(a)throw new RangeError("Multiple content holes");a=g}}}return{dom:l,contentDOM:a}}const l4=65535,c4=Math.pow(2,16);function M7(t,e){return t+e*c4}function t2(t){return t&l4}function T7(t){return(t-(t&l4))/c4}const d4=1,u4=2,Ju=4,f4=8;class Sx{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&f4)>0}get deletedBefore(){return(this.delInfo&(d4|Ju))>0}get deletedAfter(){return(this.delInfo&(u4|Ju))>0}get deletedAcross(){return(this.delInfo&Ju)>0}}class Fn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Fn.empty)return Fn.empty}recover(e){let n=0,r=t2(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+T7(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>e)break;let c=this.ranges[a+i],u=this.ranges[a+o],f=l+c;if(e<=f){let h=c?e==l?-1:e==f?1:n:n,m=l+s+(h<0?0:u);if(r)return m;let g=e==(n<0?l:f)?null:M7(a/3,e-l),p=0;return c&&(p|=e==l?u4:e==f?d4:Ju,(n<0?e!=l:e!=f)&&(p|=f4)),new Sx(m,p,g)}s+=u-c}return r?e+s:new Sx(e+s,0,null)}touches(e,n){let r=0,s=t2(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+i],u=l+c;if(e<=u&&a==s*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],a=o-(this.inverted?i:0),l=o+(this.inverted?0:i),c=this.ranges[s+n],u=this.ranges[s+r];e(a,a+c,l,l+u),i+=u-c}}invert(){return new Fn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Fn.empty:new Fn(e<0?[0,-e,0]:[0,0,e])}}Fn.empty=new Fn([]);class uh{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new uh(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=e.from,r=this._maps.length;n<e.to;n++){let s=e.getMirror(n);s!=null&&(s=s<n&&s>=e.from?r+(s-e.from):void 0),this.appendMap(e._maps[n],s)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.to-1,r=this._maps.length+e._maps.length;n>=e.from;n--){let s=e.getMirror(n);s!=null&&(s=s>n&&s<e.to?r-(s-e.from)-1:void 0),this.appendMap(e._maps[n].invert(),s)}}invert(){let e=new uh;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(a.recover);continue}}s|=a.delInfo,e=a.pos}return r?e:new Sx(e,s,null)}}const Gm=Object.create(null);class Tt{getMap(){return Fn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Gm[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Gm)throw new RangeError("Duplicate use of step JSON ID "+e);return Gm[e]=n,n.prototype.jsonID=e,n}}class kt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new kt(e,null)}static fail(e){return new kt(null,e)}static fromReplace(e,n,r,s){try{return kt.ok(e.replace(n,r,s))}catch(i){if(i instanceof td)return kt.fail(i.message);throw i}}}function V1(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(V1(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return J.fromArray(r)}class ms extends Tt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new ce(V1(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return kt.fromReplace(e,this.from,this.to,i)}invert(e){let n=[];return e.nodesBetween(this.from,this.to,(r,s)=>{if(r.isInline&&r.isAtom){let i=this.mark.addToSet(r.marks);if(!Ge.sameSet(i,r.marks)){let o=Math.max(this.from,s),a=Math.min(this.to,s+r.nodeSize);fh(Zr,o,a,this.mark,n);for(let l of r.marks)l.isInSet(i)||fh(ms,o,a,l,n)}}}),n.length==1?n[0]:new co(n)}map(e){let n=e.map(this.from,1),r=e.map(this.to,-1);return n>=r?null:new ms(n,r,this.mark)}merge(e){return e instanceof ms&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ms(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ms(n.from,n.to,e.markFromJSON(n.mark))}}Tt.jsonID("addMark",ms);class Zr extends Tt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ce(V1(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return kt.fromReplace(e,this.from,this.to,r)}invert(e){let n=[];return e.nodesBetween(this.from,this.to,(r,s)=>{r.isInline&&r.isAtom&&this.mark.isInSet(r.marks)&&fh(ms,Math.max(this.from,s),Math.min(this.to,s+r.nodeSize),this.mark,n)}),n.length==1?n[0]:new co(n)}map(e){let n=e.map(this.from,1),r=e.map(this.to,-1);return n>=r?null:new Zr(n,r,this.mark)}merge(e){return e instanceof Zr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Zr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Zr(n.from,n.to,e.markFromJSON(n.mark))}}Tt.jsonID("removeMark",Zr);function fh(t,e,n,r,s){let i=s.length?s[s.length-1]:null;i&&i instanceof t&&i.to==e&&i.mark.eq(r)?s[s.length-1]=new t(i.from,n,r):s.push(new t(e,n,r))}class co extends Tt{constructor(e){super(),this.steps=e}apply(e){for(let n of this.steps){let r=n.apply(e);if(!r.doc)return r;e=r.doc}return new kt(e,null)}invert(e){return new co(this.steps.map(n=>n.invert(e)))}map(e){let n=[];for(let r of this.steps){let s=r.map(e);s&&n.push(s)}return n.length?new co(n):null}toJSON(){return{stepType:"markSet",steps:this.steps.map(e=>e.toJSON())}}static fromJSON(e,n){if(!Array.isArray(n.steps)||!n.steps.every(r=>r.stepType=="addMark"||r.stepType=="removeMark"))throw new RangeError("Invalid JSON for MarkSetStep");return new co(n.steps.map(r=>Tt.fromJSON(e,r)))}}Tt.jsonID("markSet",co);class si extends Tt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return kt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return kt.fromReplace(e,this.pos,this.pos+1,new ce(J.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new si(this.pos,n.marks[s]);return new si(this.pos,this.mark)}}return new Oo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new si(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new si(n.pos,e.markFromJSON(n.mark))}}Tt.jsonID("addNodeMark",si);class Oo extends Tt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return kt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return kt.fromReplace(e,this.pos,this.pos+1,new ce(J.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new si(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Oo(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Oo(n.pos,e.markFromJSON(n.mark))}}Tt.jsonID("removeNodeMark",Oo);class bt extends Tt{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&jx(e,this.from,this.to)?kt.fail("Structure replace would overwrite content"):kt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Fn([this.from,this.to-this.from,this.slice.size])}invert(e){return new bt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&bt.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new bt(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof bt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ce.empty:new ce(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new bt(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ce.empty:new ce(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new bt(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new bt(n.from,n.to,ce.fromJSON(e,n.slice),!!n.structure)}}bt.MAP_BIAS=1;Tt.jsonID("replace",bt);class Ft extends Tt{constructor(e,n,r,s,i,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=a}apply(e){if(this.structure&&(jx(e,this.from,this.gapFrom)||jx(e,this.gapTo,this.to)))return kt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return kt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?kt.fromReplace(e,this.from,this.to,r):kt.fail("Content does not fit in gap")}getMap(){return new Fn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Ft(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos||s>i?null:new Ft(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ft(n.from,n.to,n.gapFrom,n.gapTo,ce.fromJSON(e,n.slice),n.insert,!!n.structure)}}Tt.jsonID("replaceAround",Ft);function jx(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function O7(t,e,n,r){let s=[];t.doc.nodesBetween(e,n,(i,o,a)=>{if(!i.isInline)return;let l=i.marks;if(!r.isInSet(l)&&a.type.allowsMarkType(r.type)){let c=Math.max(o,e),u=Math.min(o+i.nodeSize,n);fh(ms,c,u,r,s)}}),s.forEach(i=>t.step(i))}function A7(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline||!o.isAtom)return;i++;let l=null;if(r instanceof Ip){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let u=0;u<l.length;u++){let f=l[u],h;for(let m=0;m<s.length;m++){let g=s[m];g.step==i-1&&f.eq(s[m].style)&&(h=g)}h?(h.to=c,h.step=i):s.push({style:f,from:Math.max(a,e),to:c,step:i})}}}),s.forEach(o=>t.step(new Zr(o.from,o.to,o.style)))}function W1(t,e,n,r=n.contentMatch,s=!0){let i=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,f=r.matchType(c.type);if(!f)o.push(new bt(a,u,ce.empty));else{r=f;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new Zr(a,u,c.marks[h]));if(s&&c.isText&&n.whitespace!="pre"){let h,m=/\r?\n|\r/g,g;for(;h=m.exec(c.text);)g||(g=new ce(J.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new bt(a+h.index,a+h.index+h[0].length,g))}}a=u}if(!r.validEnd){let l=r.fillBefore(J.empty,!0);t.replace(a,a,new ce(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function R7(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Cl(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,i=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+s,l=t.$to.indexAfter(r)-i;if(r<t.depth&&o.canReplace(a,l,n))return r;if(r==0||o.type.spec.isolating||!R7(o,a,l))break;a&&(s=1),l<o.childCount&&(i=1)}return null}function I7(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),a=s.after(i+1),l=o,c=a,u=J.empty,f=0;for(let g=i,p=!1;g>n;g--)p||r.index(g)>0?(p=!0,u=J.from(r.node(g).copy(u)),f++):l--;let h=J.empty,m=0;for(let g=i,p=!1;g>n;g--)p||s.after(g+1)<s.end(g)?(p=!0,h=J.from(s.node(g).copy(h)),m++):c++;t.step(new Ft(l,c,o,a,new ce(u.append(h),f,m),u.size-f,!0))}function h4(t,e,n=null,r=t){let s=P7(t,e),i=s&&D7(r,e);return i?s.map(n2).concat({type:e,attrs:n}).concat(i.map(n2)):null}function n2(t){return{type:t,attrs:null}}function P7(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function D7(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<s;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function z7(t,e,n){let r=J.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=J.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new Ft(s,i,s,i,new ce(r,0,0),n.length,!0))}function L7(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,l)&&F7(t.doc,t.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let m=r.whitespace=="pre",g=!!r.contentMatch.matchType(r.schema.linebreakReplacement);m&&!g?c=!1:!m&&g&&(c=!0)}c===!1&&m4(t,o,a,i),W1(t,t.mapping.slice(i).map(a,1),r,void 0,c===null);let u=t.mapping.slice(i),f=u.map(a,1),h=u.map(a+o.nodeSize,1);return t.step(new Ft(f,h,f+1,h-1,new ce(J.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&p4(t,o,a,i),!1}})}function p4(t,e,n,r){e.forEach((s,i)=>{if(s.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(s.text);){let l=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function m4(t,e,n,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
771
- `))}})}function F7(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function B7(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ft(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ce(J.from(o),0,0),1,!0))}function Cs(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,u=n-2;c>i;c--,u--){let f=s.node(c),h=s.index(c);if(f.type.spec.isolating)return!1;let m=f.content.cutByIndex(h,f.childCount),g=r&&r[u+1];g&&(m=m.replaceChild(0,g.type.create(g.attrs)));let p=r&&r[u]||f;if(!f.canReplace(h+1,f.childCount)||!p.type.validContent(m))return!1}let a=s.indexAfter(i),l=r&&r[0];return s.node(i).canReplaceWith(a,a,l?l.type:s.node(i+1).type)}function V7(t,e,n=1,r){let s=t.doc.resolve(e),i=J.empty,o=J.empty;for(let a=s.depth,l=s.depth-n,c=n-1;a>l;a--,c--){i=J.from(s.node(a).copy(i));let u=r&&r[c];o=J.from(u?u.type.create(u.attrs,o):s.node(a).copy(o))}t.step(new bt(e,e,new ce(i.append(o),n,n),!0))}function Bo(t,e){let n=t.resolve(e),r=n.index();return g4(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function W7(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function g4(t,e){return!!(t&&e&&!t.isLeaf&&W7(t,e))}function Pp(t,e,n=-1){let r=t.resolve(e);for(let s=r.depth;;s--){let i,o,a=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(s+1),a++,o=r.node(s).maybeChild(a)):(i=r.node(s).maybeChild(a-1),o=r.node(s+1)),i&&!i.isTextblock&&g4(i,o)&&r.node(s).canReplace(a,a+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function U7(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(s&&o.inlineContent){let u=o.whitespace=="pre",f=!!o.contentMatch.matchType(s);u&&!f?r=!1:!u&&f&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);m4(t,u.node(),u.before(),a)}o.inlineContent&&W1(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new bt(c,l.map(e+n,-1),ce.empty,!0)),r===!0){let u=t.doc.resolve(c);p4(t,u.node(),u.before(),t.steps.length)}return t}function Z7(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function H7(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1;for(let l=0;l<2;l++){if(l){if(!a)break;a=-a}let c=r.index(o)+(a>0?1:0),u=r.node(o),f=!1;if(i==1)f=u.canReplace(c,c,s);else{let h=u.contentMatchAt(c).findWrapping(s.firstChild.type);f=h&&u.canReplaceWith(c,c,h[0])}if(f)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}}return null}function Dp(t,e,n=e,r=ce.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return y4(s,i,r)?new bt(e,n,r):new q7(s,i,r).fit()}function y4(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class q7{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=J.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=J.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,a=s.depth;for(;o&&a&&i.childCount==1;)i=i.firstChild.content,o--,a--;let l=new ce(i,o,a);return e>-1?new Ft(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new bt(r.pos,s.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=r2(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,f=null;if(n==1&&(o?c.matchType(o.type)||(f=c.fillBefore(J.from(o),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:f};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced;return s2(e,-1)<=n?!1:(this.unplaced.size>1&&s2(e,1)>r&&r++,this.unplaced=new ce(e,n+1,r),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=r2(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new ce(Xl(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ce(Xl(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let p=0;p<i.length;p++)this.openFrontierNode(i[p]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,u=[],{match:f,type:h}=this.frontier[n];if(s){for(let p=0;p<s.childCount;p++)u.push(s.child(p));f=f.matchFragment(s)}let m=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let p=a.child(c),x=f.matchType(p.type);if(!x)break;c++,(c>1||l==0||p.content.size)&&(f=x,u.push(x4(p.mark(h.allowedMarks(p.marks)),c==1?l:0,c==a.childCount?m:-1)))}let g=c==a.childCount;g||(m=-1),this.placed=ec(this.placed,n,J.from(u)),this.frontier[n].match=f,g&&m<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let p=0,x=u[u.length-1];x&&p<m;p++)this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),x=x.lastChild;this.unplaced=g?e==0?ce.empty:new ce(Xl(o.content,e-1,1),e-1,m<0?o.openEnd:e-1):new ce(Xl(o.content,e,c),e,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Ym(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=Ym(e,n,s,r,i);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Ym(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=ec(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=ec(this.placed,this.depth,J.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(J.empty,!0);n.childCount&&(this.placed=ec(this.placed,this.frontier.length,n))}}function Xl(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Xl(t.firstChild.content,e-1,n)))}function ec(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(ec(t.lastChild.content,e-1,n)))}function r2(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function x4(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,x4(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(J.empty,!0)))),t.copy(r)}function Ym(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,o);return a&&!K7(n,i.content,o)?a:null}function K7(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function J7(t){return t.spec.defining||t.spec.definingForContent}function s2(t,e){for(let n=0;;n++){let r=e<0?t.firstChild:t.lastChild;if(!r||r.isAtom)return n;t=r.content}}function G7(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),i=t.doc.resolve(n);if(y4(s,i,r))return t.step(new bt(e,n,r));let o=k4(s,i);o[o.length-1]==0&&o.pop();let a=-(s.depth+1);o.unshift(a);for(let h=s.depth,m=s.pos-1;h>0;h--,m--){let g=s.node(h).type.spec;if(g.defining||g.definingAsContext||g.isolating)break;o.indexOf(h)>-1?a=h:s.before(h)==m&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],u=r.openStart;for(let h=r.content,m=0;;m++){let g=h.firstChild;if(c.push(g),m==r.openStart)break;h=g.content}for(let h=u-1;h>=0;h--){let m=c[h],g=J7(m.type);if(g&&!m.sameMarkup(s.node(Math.abs(a)-1)))u=h;else if(g||!m.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let m=(h+u+1)%(r.openStart+1),g=c[m];if(g)for(let p=0;p<o.length;p++){let x=o[(p+l)%o.length],y=!0;x<0&&(y=!1,x=-x);let v=s.node(x-1),k=s.index(x-1);if(v.canReplaceWith(k,k,g.type,g.marks))return t.replace(s.before(x),y?i.after(x):n,new ce(v4(r.content,0,r.openStart,m),m,r.openEnd))}}let f=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>f));h--){let m=o[h];m<0||(e=s.before(m),n=i.after(m))}}function v4(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(v4(i.content,e+1,n,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(J.empty,!0))}return t}function Y7(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=Z7(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new ce(J.from(r),0,0))}function Q7(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&r.parentOffset==0&&s.parentOffset==0){let o=r.sharedDepth(n),a=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=s.depth;l>o;l--)s.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=s.depth;l>0&&n==s.start(l);l--)n=s.before(l);r=t.doc.resolve(e),s=t.doc.resolve(n)}}let i=k4(r,s);for(let o=0;o<i.length;o++){let a=i[o],l=o==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),s.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),s.indexAfter(a-1))))return t.delete(r.before(a),s.after(a))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function k4(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(i<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}class Oa extends Tt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return kt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return kt.fromReplace(e,this.pos,this.pos+1,new ce(J.from(s),0,n.isLeaf?0:1))}getMap(){return Fn.empty}invert(e){return new Oa(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Oa(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Oa(n.pos,n.attr,n.value)}}Tt.jsonID("attr",Oa);class sd extends Tt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return kt.ok(r)}getMap(){return Fn.empty}invert(e){return new sd(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new sd(n.attr,n.value)}}Tt.jsonID("docAttr",sd);let nl=class extends Error{};nl=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};nl.prototype=Object.create(Error.prototype);nl.prototype.constructor=nl;nl.prototype.name="TransformError";class w4{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new uh}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new nl(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let s=this.mapping.maps[r];r&&(e=s.map(e,1),n=s.map(n,-1)),s.forEach((i,o,a,l)=>{e=Math.min(e,a),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ce.empty){let s=Dp(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new ce(J.from(r),0,0))}delete(e,n){return this.replace(e,n,ce.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return G7(this,e,n,r),this}replaceRangeWith(e,n,r){return Y7(this,e,n,r),this}deleteRange(e,n){return Q7(this,e,n),this}lift(e,n){return I7(this,e,n),this}join(e,n=1){return U7(this,e,n),this}wrap(e,n){return z7(this,e,n),this}setBlockType(e,n=e,r,s=null){return L7(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return B7(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Oa(e,n,r)),this}setDocAttribute(e,n){return this.step(new sd(e,n)),this}addNodeMark(e,n){return this.step(new si(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Ge)n.isInSet(r.marks)&&this.step(new Oo(e,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new Oo(e,i)),s=i.removeFromSet(s);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return V7(this,e,n,r),this}addMark(e,n,r){return O7(this,e,n,r),this}removeMark(e,n,r){return A7(this,e,n,r),this}clearIncompatible(e,n,r){return W1(this,e,n,r),this}}const Qm=Object.create(null);class Fe{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new X7(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ce.empty){let r=n.content.lastChild,s=null;for(let a=0;a<n.openEnd;a++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),a?ce.empty:n),a==0&&a2(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:a}=s[i],l=e.mapping.slice(r),c=l.map(o.pos),u=l.map(a.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),a2(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new _e(e):sa(e.node(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?sa(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):sa(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Un(e.node(0))}static atStart(e){return sa(e,e,0,0,1)||new Un(e)}static atEnd(e){return sa(e,e,e.content.size,e.childCount,-1)||new Un(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Qm[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Qm)throw new RangeError("Duplicate use of selection JSON ID "+e);return Qm[e]=n,n.prototype.jsonID=e,n}getBookmark(){return _e.between(this.$anchor,this.$head).getBookmark()}}Fe.prototype.visible=!0;class X7{constructor(e,n){this.$from=e,this.$to=n}}let i2=!1;function o2(t){!i2&&!t.parent.inlineContent&&(i2=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class _e extends Fe{constructor(e,n=e){o2(e),o2(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Fe.near(r);let s=e.resolve(n.map(this.anchor));return new _e(s.parent.inlineContent?s:r,r)}replace(e,n=ce.empty){if(super.replace(e,n),n==ce.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof _e&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new zp(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new _e(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=Fe.findFrom(n,r,!0)||Fe.findFrom(n,-r,!0);if(i)n=i.$head;else return Fe.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(Fe.findFrom(e,-r,!0)||Fe.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new _e(e,n)}}Fe.jsonID("text",_e);class zp{constructor(e,n){this.anchor=e,this.head=n}map(e){return new zp(e.map(this.anchor),e.map(this.head))}resolve(e){return _e.between(e.resolve(this.anchor),e.resolve(this.head))}}class we extends Fe{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?Fe.near(i):new we(i)}content(){return new ce(J.from(this.node),0,0)}eq(e){return e instanceof we&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new U1(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new we(e.resolve(n.anchor))}static create(e,n){return new we(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}we.prototype.visible=!1;Fe.jsonID("node",we);class U1{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new zp(r,r):new U1(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&we.isSelectable(r)?new we(n):Fe.near(n)}}class Un extends Fe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ce.empty){if(n==ce.empty){e.delete(0,e.doc.content.size);let r=Fe.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Un(e)}map(e){return new Un(e)}eq(e){return e instanceof Un}getBookmark(){return eW}}Fe.jsonID("all",Un);const eW={map(){return this},resolve(t){return new Un(t)}};function sa(t,e,n,r,s,i=!1){if(e.inlineContent)return _e.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let a=e.child(o);if(a.isAtom){if(!i&&we.isSelectable(a))return we.create(t,n-(s<0?a.nodeSize:0))}else{let l=sa(t,a,n+s,s<0?a.childCount:0,s,i);if(l)return l}n+=a.nodeSize*s}return null}function a2(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof bt||s instanceof Ft))return;let i=t.mapping.maps[r],o;i.forEach((a,l,c,u)=>{o==null&&(o=u)}),t.setSelection(Fe.near(t.doc.resolve(o),n))}const l2=1,wu=2,c2=4;class tW extends w4{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|l2)&~wu,this.storedMarks=null,this}get selectionSet(){return(this.updated&l2)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=wu,this}ensureMarks(e){return Ge.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&wu)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~wu,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ge.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Fe.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=c2,this}get scrolledIntoView(){return(this.updated&c2)>0}}function d2(t,e){return!e||!t?t:t.bind(e)}class tc{constructor(e,n,r){this.name=e,this.init=d2(n.init,r),this.apply=d2(n.apply,r)}}const nW=[new tc("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new tc("selection",{init(t,e){return t.selection||Fe.atStart(e.doc)},apply(t){return t.selection}}),new tc("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new tc("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Xm{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=nW.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new tc(r.key,r.spec.state,r))})}}class Xi{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=s?s[o].n:0,c=s?s[o].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!s){s=[];for(let f=0;f<this.config.plugins.length;f++)s.push(f<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Xi(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new tW(this)}static create(e){let n=new Xm(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Xi(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(e,r);return r}reconfigure(e){let n=new Xm(this.schema,e.plugins),r=n.fields,s=new Xi(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new Xm(e.schema,e.plugins),i=new Xi(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=xi.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=Fe.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[o.name]=c.fromJSON.call(l,e,n[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function b4(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=b4(s,e,{})),n[r]=s}return n}class Pn{constructor(e){this.spec=e,this.props={},e.props&&b4(e.props,this,this.props),this.key=e.key?e.key.key:S4("plugin")}getState(e){return e[this.key]}}const eg=Object.create(null);function S4(t){return t in eg?t+"$"+ ++eg[t]:(eg[t]=0,t+"$")}class Or{constructor(e="key"){this.key=S4(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const j4=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function C4(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const _4=(t,e,n)=>{let r=C4(t,n);if(!r)return!1;let s=Z1(r);if(!s){let o=r.blockRange(),a=o&&Cl(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(I4(t,s,e,-1))return!0;if(r.parent.content.size==0&&(rl(i,"end")||we.isSelectable(i)))for(let o=r.depth;;o--){let a=Dp(t.doc,r.before(o),r.after(o),ce.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(rl(i,"end")?Fe.findFrom(l.doc.resolve(l.mapping.map(s.pos,-1)),-1):we.create(l.doc,s.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},rW=(t,e,n)=>{let r=C4(t,n);if(!r)return!1;let s=Z1(r);return s?N4(t,s,e):!1},sW=(t,e,n)=>{let r=$4(t,n);if(!r)return!1;let s=H1(r);return s?N4(t,s,e):!1};function N4(t,e,n){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let u=s.lastChild;if(!u)return!1;s=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=Dp(t.doc,i,l,ce.empty);if(!c||c.from!=i||c instanceof bt&&c.slice.size>=l-i)return!1;if(n){let u=t.tr.step(c);u.setSelection(_e.create(u.doc,i)),n(u.scrollIntoView())}return!0}function rl(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const E4=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=Z1(r)}let o=i&&i.nodeBefore;return!o||!we.isSelectable(o)?!1:(e&&e(t.tr.setSelection(we.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function Z1(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function $4(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const M4=(t,e,n)=>{let r=$4(t,n);if(!r)return!1;let s=H1(r);if(!s)return!1;let i=s.nodeAfter;if(I4(t,s,e,1))return!0;if(r.parent.content.size==0&&(rl(i,"start")||we.isSelectable(i))){let o=Dp(t.doc,r.before(),r.after(),ce.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(rl(i,"start")?Fe.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):we.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},T4=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=H1(r)}let o=i&&i.nodeAfter;return!o||!we.isSelectable(o)?!1:(e&&e(t.tr.setSelection(we.create(t.doc,i.pos)).scrollIntoView()),!0)};function H1(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const iW=(t,e)=>{let n=t.selection,r=n instanceof we,s;if(r){if(n.node.isTextblock||!Bo(t.doc,n.from))return!1;s=n.from}else if(s=Pp(t.doc,n.from,-1),s==null)return!1;if(e){let i=t.tr.join(s);r&&i.setSelection(we.create(i.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},oW=(t,e)=>{let n=t.selection,r;if(n instanceof we){if(n.node.isTextblock||!Bo(t.doc,n.to))return!1;r=n.to}else if(r=Pp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},aW=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&Cl(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)},O4=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
772
- `).scrollIntoView()),!0)};function q1(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const lW=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=q1(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(Fe.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},A4=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof Un||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=q1(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,a=t.tr.insert(o,i.createAndFill());a.setSelection(_e.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},R4=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Cs(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&Cl(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function cW(t){return(e,n)=>{if(e.selection instanceof we&&e.selection.node.isBlock){let{$from:m}=e.selection;return!m.parentOffset||!Cs(e.doc,m.pos)?!1:(n&&n(e.tr.split(m.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof _e||e.selection instanceof Un)&&r.deleteSelection();let{$from:s}=r.selection,i=r.steps.length,o=[],a,l,c=!1,u=!1;for(let m=s.depth;;m--)if(s.node(m).isBlock){c=s.end(m)==s.pos+(s.depth-m),u=s.start(m)==s.pos-(s.depth-m),l=q1(s.node(m-1).contentMatchAt(s.indexAfter(m-1))),o.unshift(c&&l?{type:l}:null),a=m;break}else{if(m==1)return!1;o.unshift(null)}let f=s.pos,h=Cs(r.doc,f,o.length,o);if(h||(o[0]=l?{type:l}:null,h=Cs(r.doc,f,o.length,o)),!h)return!1;if(r.split(f,o.length,o),!c&&u&&s.node(a).type!=l){let m=r.mapping.slice(i),g=m.map(s.before(a)),p=r.doc.resolve(g);l&&s.node(a-1).canReplaceWith(p.index(),p.index()+1,l)&&r.setNodeMarkup(m.map(s.before(a)),l)}return n&&n(r.scrollIntoView()),!0}}const dW=cW(),uW=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(we.create(t.doc,s))),!0)};function fW(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||Bo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function I4(t,e,n,r){let s=e.nodeBefore,i=e.nodeAfter,o,a,l=s.type.spec.isolating||i.type.spec.isolating;if(!l&&fW(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(n){let m=e.pos+i.nodeSize,g=J.empty;for(let y=o.length-1;y>=0;y--)g=J.from(o[y].create(null,g));g=J.from(s.copy(g));let p=t.tr.step(new Ft(e.pos-1,m,e.pos,m,new ce(g,1,0),o.length,!0)),x=p.doc.resolve(m+2*o.length);x.nodeAfter&&x.nodeAfter.type==s.type&&Bo(p.doc,x.pos)&&p.join(x.pos),n(p.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:Fe.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),h=f&&Cl(f);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(f,h).scrollIntoView()),!0;if(c&&rl(i,"start",!0)&&rl(s,"end")){let m=s,g=[];for(;g.push(m),!m.isTextblock;)m=m.lastChild;let p=i,x=1;for(;!p.isTextblock;p=p.firstChild)x++;if(m.canReplace(m.childCount,m.childCount,p.content)){if(n){let y=J.empty;for(let k=g.length-1;k>=0;k--)y=J.from(g[k].copy(y));let v=t.tr.step(new Ft(e.pos-g.length,e.pos+i.nodeSize,e.pos+x,e.pos+i.nodeSize-x,new ce(y,g.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function P4(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(_e.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const hW=P4(-1),pW=P4(1);function mW(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),a=o&&h4(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function u2(t,e=null){return function(n,r){let s=!1;for(let i=0;i<n.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(o,a,(l,c)=>{if(s)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)s=!0;else{let u=n.doc.resolve(c),f=u.index();s=u.parent.canReplaceWith(f,f+1,t)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];i.setBlockType(a,l,t,e)}r(i.scrollIntoView())}return!0}}function K1(...t){return function(e,n,r){for(let s=0;s<t.length;s++)if(t[s](e,n,r))return!0;return!1}}K1(j4,_4,E4);K1(j4,M4,T4);K1(O4,A4,R4,dW);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function gW(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i);if(!o)return!1;let a=r?n.tr:null;return yW(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function yW(t,e,n,r=null){let s=!1,i=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);i=new ch(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new ch(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let a=h4(i,n,r,e);return a?(t&&xW(t,e,a,s,n),!0):!1}function xW(t,e,n,r,s){let i=J.empty;for(let u=n.length-1;u>=0;u--)i=J.from(n[u].type.create(n[u].attrs,i));t.step(new Ft(e.start-(r?2:0),e.end,e.start,e.end,new ce(i,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==s&&(o=u+1);let a=n.length-o,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,f=e.endIndex,h=!0;u<f;u++,h=!1)!h&&a&&Cs(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function hh(t,e){return t instanceof wx?e==t:t.indexOf(e)>-1}function vW(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&hh(t,o.firstChild.type));return i?n?hh(t,r.node(i.depth-1).type)?kW(e,n,i):wW(e,n,i):!0:!1}}function kW(t,e,n){let r=t.tr,s=n.end,i=n.$to.end(n.depth),o=n.parent.child(n.endIndex-1).type;s<i&&(r.step(new Ft(s-1,i,s,i,new ce(J.from(o.create(null,n.parent.copy())),1,0),1,!0)),n=new ch(r.doc.resolve(n.$from.pos),r.doc.resolve(i),n.depth));const a=Cl(n);if(a==null)return!1;r.lift(n,a);let l=r.doc.resolve(r.mapping.map(s,-1)-1);return Bo(r.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&r.join(l.pos),e(r.scrollIntoView()),!0}function wW(t,e,n){let r=t.tr,s=n.parent;for(let m=n.end,g=n.endIndex-1,p=n.startIndex;g>p;g--)m-=s.child(g).nodeSize,r.delete(m-1,m+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==s.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?J.empty:J.from(s))))return!1;let f=i.pos,h=f+o.nodeSize;return r.step(new Ft(f-(a?1:0),h+(l?1:0),f+1,h-1,new ce((a?J.empty:J.from(s.copy(J.empty))).append(l?J.empty:J.from(s.copy(J.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function bW(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,c=>c.childCount>0&&hh(t,c.firstChild.type));if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let a=i.parent,l=a.child(o-1);if(!hh(t,l.type))return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=J.from(c?l.lastChild.lastChild.type.create():null),f=new ce(J.from(l.type.create(null,J.from(a.type.create(null,u)))),c?3:1,0),h=i.start,m=i.end;n(e.tr.step(new Ft(h-(c?3:1),m,h,m,f,1,!0)).scrollIntoView())}return!0}}const ln=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e};function sl(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e}let Cx=null;function zr(t,e,n){let r=Cx||(Cx=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r}function SW(){Cx=null}function yc(t,e,n,r){return n&&(h2(t,e,n,r,-1)||h2(t,e,n,r,1))}const f2=/^(img|br|input|textarea|hr)$/i;function h2(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;if(e==(s<0?0:zt(t))){let o=t.parentNode;if(!o||!Se(o)||id(t)||f2.test(t.nodeName)||t.contentEditable=="false")return!1;e=ln(t)+(s<0?0:1),t=o}else if(Se(t)){let o=t.childNodes[e+(s<0?-1:0)];if(Se(o)&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else{if(id(o)||f2.test(o.nodeName))return!1;t=o,e=s<0?zt(t):0}}else return!1}}function zt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Se(t){return t.nodeType==1}function Ct(t){return t.nodeType==3}function il(t,e){return e?t.contains(Se(e)?e:e.parentNode):!1}function J1(t,e){for(;;){if(Ct(t)&&e)return t;if(Se(t)&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=zt(t)}else if(t.parentNode&&!id(t,!0))e=ln(t),t=t.parentNode;else return null}}function G1(t,e){for(;;){if(Ct(t)&&e<t.nodeValue.length)return t;if(Se(t)&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!id(t,!0))e=ln(t)+1,t=t.parentNode;else return null}}function jW(t,e,n){for(let r=e==0,s=e==zt(t);r||s;){if(t==n)return!0;let i=ln(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==zt(t)}}function id(t,e=!1){let n;for(let r=t;r&&!(n=r.pmViewDesc);r=r.parentNode);return n&&n.node&&(!e||n.node.isBlock)&&(n.dom==t||n.contentDOM==t)}function Lp(t){return t.focusNode&&yc(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)}function D4(t,e){t.collapse(e.anchorNode,e.anchorOffset),(e.focusNode!=e.anchorNode||e.focusOffset!=e.anchorOffset)&&t.extend(e.focusNode,e.focusOffset)}function CW(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function _W(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function NW(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(zt(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(zt(r.startContainer),r.startOffset)}}}const es=typeof navigator<"u"?navigator:null,p2=typeof document<"u"?document:null,ol=es&&es.userAgent||"",$r=/gecko\/(\d+)/i.test(ol)&&!/edge?\//i.test(ol);$r&&+(/Firefox\/(\d+)/.exec(ol)||[0,0])[1];const _x=/Chrome\/(\d+)/.exec(ol),gn=!!_x,z4=_x?+_x[1]:0,cn=!!es&&/Apple Computer/.test(es.vendor),al=cn&&(/Mobile\/\w+/.test(ol)||!!es&&es.maxTouchPoints>2),er=al||(es?/Mac/.test(es.platform):!1),L4=es?/Win/.test(es.platform):!1,vs=/Android \d/.test(ol),Fp=!!p2&&"webkitFontSmoothing"in p2.documentElement.style,EW=Fp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function $W(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function is(t,e){return typeof t=="number"?t:t[e]}function MW(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function m2(t,e,n){for(;;)if(n<0?e:e<zt(t)){if(Ct(t))return Lr(zr(t,e+(n<0?-1:0),e+(n>0?1:0)),-n);let r=t.childNodes[n<0?e-1:e];if(Ct(r))t=r,e=n<0?r.nodeValue.length:0;else return Se(r)?Lr(r,-n):null}else{if(id(t,!0)||!t.parentNode)return null;e=ln(t)+(n<0?0:1),t=t.parentNode}}function g2(t,e,n){if(!Nx(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(!Se(o)){o=sl(o);continue}let a=o==i.body,l=a?$W(i):MW(o),c=0,u=0;if(e.top<l.top+is(r,"top")?u=-(l.top-e.top+is(s,"top")):e.bottom>l.bottom-is(r,"bottom")&&(u=e.bottom-e.top>l.bottom-l.top?e.top+is(s,"top")-l.top:e.bottom-l.bottom+is(s,"bottom")),e.left<l.left+is(r,"left")?c=-(l.left-e.left+is(s,"left")):e.right>l.right-is(r,"right")&&(c=e.right-l.right+is(s,"right")),c||u)if(a)i.defaultView.scrollBy(c,u);else{let h=o.scrollLeft,m=o.scrollTop;u&&(o.scrollTop+=u),c&&(o.scrollLeft+=c);let g=o.scrollLeft-h,p=o.scrollTop-m;e={left:e.left-g,top:e.top-p,right:e.right-g,bottom:e.bottom-p}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:sl(o)}}function TW(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(i,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,s=l.top;break}}return{refDOM:r,refTop:s,stack:F4(t.dom)}}function F4(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=sl(r));return e}function OW({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;B4(n,r==0?0:r-e)}function B4(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:s,left:i}=t[n];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Jo=null;function V4(t){if(t.setActive)return t.setActive();if(Jo)return t.focus(Jo);let e=F4(t);t.focus(Jo==null?{get preventScroll(){return Jo={preventScroll:!0},!0}}:void 0),Jo||(Jo=!1,B4(e,0))}function W4(t,e){let n,r=2e8,s,i=0,o=e.top,a=e.top,l,c;for(let u=t.firstChild,f=0;u;u=u.nextSibling,f++){let h;if(Se(u))h=u.getClientRects();else if(Ct(u))h=zr(u).getClientRects();else continue;for(let m=0;m<h.length;m++){let g=h[m];if(g.top<=o&&g.bottom>=a){o=Math.max(g.bottom,o),a=Math.min(g.top,a);let p=g.left>e.left?g.left-e.left:g.right<e.left?e.left-g.right:0;if(p<r){n=u,r=p,s=p&&Ct(n)?{left:g.right<e.left?g.right:g.left,top:e.top}:e,Se(u)&&p&&(i=f+(e.left>=(g.left+g.right)/2?1:0));continue}}else g.top>e.top&&!l&&g.left<=e.left&&g.right>=e.left&&(l=u,c={left:Math.max(g.left,Math.min(g.right,e.left)),top:g.top});!n&&(e.left>=g.right&&e.top>=g.top||e.left>=g.left&&e.top>=g.bottom)&&(i=f+1)}}return!n&&l&&(n=l,s=c,r=0),n&&Ct(n)?AW(n,s):!n||r?{node:t,offset:i}:W4(n,s)}function AW(t,e){let n=t.nodeValue.length,r=document.createRange(),s;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let o=Lr(r,1);if(o.top!=o.bottom&&Y1(e,o)){s={node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:t,offset:0}}function Y1(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function RW(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function IW(t,e,n){let{node:r,offset:s}=W4(e,n),i=-1;if(Se(r)&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return{pos:t.docView.posFromDOM(r,s,i),affinity:U4(r,s,n)}}function y2(t,e){return t<e.left?e.left-t:t>e.right?t-e.right:0}function U4(t,e,n){let r=m2(t,e,-1),s=m2(t,e,1);return r?s?r.bottom<=s.top?n.top>(r.bottom+s.top)/2?1:-1:y2(n.left,r)<y2(n.left,s)?-1:1:-1:1}function PW(t,e,n,r){let s=-1;for(let i=e;i!=t.dom;){let o=t.docView.nearestDesc(i,!0),a;if(!o)return null;if(Se(o.dom)&&((a=o.dom.getBoundingClientRect()).width||a.height)){if(!o.contentDOM&&!o.node.isText&&r.left>=a.left&&r.left<=a.right&&r.top>=a.top&&r.top<=a.bottom){let l=o.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2;return{pos:l?o.posBefore:o.posAfter,affinity:l?1:-1}}o.node.isBlock&&o.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(o.dom.nodeName)&&(r.top<a.top||r.top>a.bottom)&&(s=r.top<a.top?o.posBefore:o.posAfter)}i=o.dom.parentNode}return s>-1?{pos:s,affinity:0}:{pos:t.docView.posFromDOM(e,n,-1),affinity:U4(e,n,r)}}function Z4(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=t.childNodes[i];if(Se(o)){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Y1(e,c))return Z4(o,e,c)}}if((i=(i+1)%r)==s)break}return t}function DW(t,e){let n=t.dom.ownerDocument,r,s=0,i=NW(n,e.left,e.top);i&&({node:r,offset:s}=i);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a,l=0;if(!o||!t.dom.contains(o)){let u=t.dom.getBoundingClientRect();if(!Y1(e,u)||(o=Z4(t.dom,e,u),!o))return null}if(cn)for(let u=o;r&&u;u=sl(u))u.draggable&&(r=void 0);if(o=RW(o,e),r){if($r&&Se(r)&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let f=r.childNodes[s],h;f.nodeName=="IMG"&&(h=f.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&s++}let u;if(Fp&&s&&Se(r)&&Se(u=r.childNodes[s-1])&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&Se(r.lastChild)&&e.top>r.lastChild.getBoundingClientRect().bottom)a=t.state.doc.content.size;else if(s==0||!Se(r)||r.childNodes[s-1].nodeName!="BR"){let f=PW(t,r,s,e);f&&({pos:a,affinity:l}=f)}}a==null&&({pos:a,affinity:l}=IW(t,o,e));let c=t.docView.nearestDesc(o,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1,affinity:l}}function Nx(t){return t.top<t.bottom||t.left<t.right}function Lr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Nx(r))return r}return Array.prototype.find.call(n,Nx)||t.getBoundingClientRect()}const zW=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function H4(t,e,n){let{node:r,offset:s,atom:i}=t.docView.domFromPos(e,n<0?-1:1),o=Fp||$r;if(Ct(r))if(o&&(zW.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let l=Lr(zr(r,s,s),n);if($r&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=Lr(zr(r,s-1,s-1),-1);if(c.top==l.top){let u=Lr(zr(r,s,s+1),-1);if(u.top!=l.top)return Fl(u,u.left<c.left)}}return l}else{let l=s,c=s,u=n<0?1:-1;return n<0&&!s?(c++,u=-1):n>=0&&s==r.nodeValue.length?(l--,u=1):n<0?l--:c++,Fl(Lr(zr(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==zt(r))){let l=r.childNodes[s-1];if(Se(l))return tg(l.getBoundingClientRect(),!1)}if(i==null&&s<zt(r)){let l=r.childNodes[s];if(Se(l))return tg(l.getBoundingClientRect(),!0)}return tg(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==zt(r))){let l=r.childNodes[s-1],c=Ct(l)?zr(l,zt(l)-(o?0:1)):Se(l)&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Fl(Lr(c,1),!1)}if(i==null&&s<zt(r)){let l=r.childNodes[s];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?Ct(l)?zr(l,0,o?0:1):Se(l)?l:null:null;if(c)return Fl(Lr(c,-1),!0)}return Fl(Lr(Ct(r)?zr(r):r,-n),n>=0)}function Fl(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function tg(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function q4(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function LW(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return q4(t,e,()=>{let{node:i}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let o=H4(t,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(Se(a))l=a.getClientRects();else if(Ct(a))l=zr(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const FW=/[\u0590-\u08ac]/;function BW(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,a=t.domSelection();return a?!FW.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:o:q4(t,e,()=>{let l=t.domSel.readRange(),c=a.caretBidiLevel;a.modify("move",n,"character");let u=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:f,focusOffset:h}=t.domSel.readRange(),m=f&&!il(u,f)||l.focusNode==f&&l.focusOffset==h;return D4(a,l),c!=null&&(a.caretBidiLevel=c),m}):r.pos==r.start()||r.pos==r.end()}let x2=null,v2=null,k2=!1;function VW(t,e,n){return x2==e&&v2==n?k2:(x2=e,v2=n,k2=n=="up"||n=="down"?LW(t,e,n):BW(t,e,n))}class Fd{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.damage=0,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let s=this.children[n];if(s==e)return r;r+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&il(this.contentDOM,e))if(r<0){let i,o;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>ln(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM)){let i=e.compareDocumentPosition(this.contentDOM);i&16?s=n>Array.from(e.childNodes).findIndex(o=>o.contains(this.contentDOM)):s=!(i&4)}else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(Se(o)?il(o,e):o==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let a=s.children[o];if(a.size){s=a;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.size;if(a>e){s=e-i;break}i=a}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(;r>0;r--){let i=this.children[r-1];if(i.size||!(i instanceof J4||i instanceof K4&&i.side>=0))break}if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?ln(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?ln(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(s==-1&&e<=c){let u=o+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=o;for(let f=a;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){s=ln(h.dom)+1;break}e-=h.size}s==-1&&(s=0)}if(s>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=ln(f.dom);break}n+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(!Se(n)||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDamage(e){e&&(this.damage|=e,this.markParentDamage())}markParentDamage(){for(let e=this;;){let{parent:n}=e;if(!n||n.damage&1)break;n.damage|=1,e=n}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class K4 extends Fd{constructor(e,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){let a=Se(o)?o:document.createElement("span");a!=o&&(a.appendChild(o),o=a),a.hasAttribute("contenteditable")||(a.contentEditable="false"),a.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return!this.damage&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class WW extends Fd{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class ki extends Fd{constructor(e,n,r,s,i){super(e,[],r,s),this.mark=n,this.spec=i}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=Fo.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ki(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.damage&4||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return!(this.damage&4)&&this.mark.eq(e)}markDamage(e){var n;this.damage|=e,(n=this.parent)===null||n===void 0||n.markDamage(2)}slice(e,n,r){let s=ki.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=Ex(i,n,o,r)),e>0&&(i=Ex(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class wi extends Fd{constructor(e,n,r,s,i,o,a){super(e,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=a}static create(e,n,r,s,i,o){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,s),u=c&&c.dom,f=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(!Ct(u))throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=Fo.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let h=u;return u=Q4(u,r,n),c?l=new G4(e,n,r,s,u,f||null,h,c):n.isText?new Bd(e,n,r,s,u,h):new wi(e,n,r,s,u,f||null,h)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let s=this.children[r];if(this.dom.contains(s.dom.parentNode)){n.contentElement=s.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(s=>Se(s)&&e.indexOf(s.parentNode)<0&&this.dom.contains(s));r?n.contentElement=r:n.getContent=()=>J.empty}}return n}matchesNode(e,n,r){return!this.damage&&e.eq(this.node)&&ph(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new ZW(this,o&&o.node,e),c=this.node.inlineContent,u=c&&this.node.isBlock;KW(this.node,this.innerDeco,(f,h,m)=>{f.spec.marks?l.syncToMarks(f.spec.marks,r,e,h):f.type.side>=0&&!m&&l.syncToMarks(h==this.node.childCount?Ge.none:this.node.child(h).marks,r,e,h),l.placeWidget(f,e,s)},(f,h,m,g)=>{l.syncToMarks(f.marks,r,e,g),u&&f.isAtom&&!f.isText&&l.addHackNode("IMG",l.top);let p;l.findNodeMatch(f,h,m,g)||a&&e.state.selection.from>s&&e.state.selection.to<s+f.nodeSize&&(p=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(f,h,m,p,e,s)||l.updateNextNode(f,h,m,e,g,s)||l.addNode(f,h,m,e,s),s+=f.nodeSize,c&&(u=f.isAtom&&!f.isText)}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.damage&2)&&(o&&this.protectLocalComposition(e,o),Y4(this.contentDOM,this.children,e),al&&JW(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof _e)||r<n||s>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,a=GW(this.node.content,o,r-n,s-n);return a<0?null:{node:i,pos:a,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new WW(this,i,n,s);e.input.compositionNodes.push(o),this.children=Ex(this.children,r,r+s.length,e,o)}update(e,n,r,s,i){return this.damage&4||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s,i),!0)}updateInner(e,n,r,s,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,i+1),this.damage=0}updateOuterDeco(e){if(ph(e,this.outerDeco))return;let n=!Se(this.nodeDOM),r=this.dom;this.dom=Q1(this.dom,this.nodeDOM,od(this.outerDeco,this.node,n),od(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){Se(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){Se(this.nodeDOM)&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function w2(t,e,n,r,s,i){i?Q1(r,r,od(i,t,!1),od(e,t,!1)):Q4(r,e,t);let o=new wi(void 0,t,e,n,r,r,r);return o.contentDOM&&o.updateChildren(s,0),o}class Bd extends wi{constructor(e,n,r,s,i,o){super(e,n,r,s,i,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.damage&4||this.damage&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.damage&8||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.damage=0,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return!1}slice(e,n,r){let s=this.node.cut(e,n),i=document.createTextNode(s.text);return new Bd(this.parent,s,this.outerDeco,this.innerDeco,i,i)}get domAtom(){return!1}isText(e){return this.node.text==e}}class J4 extends Fd{parseRule(){return{ignore:!0}}matchesHack(e){return!this.damage&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class G4 extends wi{constructor(e,n,r,s,i,o,a,l){super(e,n,r,s,i,o,a),this.spec=l}update(e,n,r,s,i){if(this.damage&4)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,s,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Y4(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=b2(r),s=!0;r=r.nextSibling}else s=!0,t.insertBefore(a,r);if(o instanceof ki){let l=r?r.previousSibling:t.lastChild;Y4(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=b2(r),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const xc=function(t){t&&(this.nodeName=t)};xc.prototype=Object.create(null);const eo=[new xc];function od(t,e,n){if(t.length==0)return eo;let r=n?eo[0]:new xc,s=[r];for(let i=0;i<t.length;i++){let o=t[i].type.attrs;if(o){o.nodeName&&s.push(r=new xc(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&s.length==1&&s.push(r=new xc(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return s}function Q1(t,e,n,r){if(n==eo&&r==eo)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],a=n[i];if(i){let l;a&&a.nodeName==o.nodeName&&s!=t&&(l=s.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(s),a=eo[0]),s=l}UW(s,a||eo[0],o)}return s}function UW(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&t.classList.add(s[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function Q4(t,e,n){return Q1(t,t,eo,od(e,n,!Se(t)))}function ph(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function b2(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class ZW{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=HW(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,s){let i=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;i<a&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.damage=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;s<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let f=this.top.children[u];if(f.matchesMark(e[o])&&!this.isLocked(f.dom)){l=u;break}}if(l<0&&this.index<this.top.children.length){let u=this.top.children[this.index];u instanceof ki&&!(u.damage&4)&&u.mark.type==e[o].type&&u.spec.update&&!this.isLocked(u.dom)&&u.spec.update(e[o])&&(u.mark=e[o],l=this.index,this.changed=!0)}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=ki.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,s,i,o){let a=this.top.children[s];return a.damage&4&&a.dom==a.contentDOM&&(a.damage=2),a.update(e,n,r,i,o)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=n}}updateNextNode(e,n,r,s,i,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof wi){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,f,h=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&!(l.damage&4)&&ph(n,l.outerDeco));if(!h&&l.update(e,n,r,s,o))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(l,e,n,r,s,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=f,f.contentDOM&&(f.damage|=2,f.updateChildren(s,o+1),f.damage=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,s,i,o){if(e.damage&3||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!ph(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let a=wi.create(this.top,n,r,s,i,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,s,i){let o=wi.create(this.top,e,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new K4(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof ki;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Bd)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((cn||gn)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new J4(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||Se(e)&&e.contains(this.lock.parentNode))}}function HW(t,e){let n=e,r=n.children.length,s=[],i=t.childCount,o=new Map,a=[];e:for(;i>0;){let l;for(;;)if(r){let u=n.children[r-1];if(u instanceof ki)s.push(r-1),n=u,r=u.children.length;else{l=u,r--;break}}else{if(n==e)break e;r=s.pop(),n=n.parent}let c=l.node;if(c){if(c!=t.child(i-1))break;--i,o.set(l,i),a.push(l)}}return{index:i,matched:o,matches:a.reverse()}}function qW(t,e){return t.type.side-e.type.side}function KW(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,s,e.forChild(i,u),c),i+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,f;for(;o<s.length&&s[o].to==i;){let x=s[o++];x.widget&&(u?(f||(f=[u])).push(x):u=x)}if(u)if(f){f.sort(qW);for(let x=0;x<f.length;x++)n(f[x],c,!!l)}else n(u,c,!!l);let h,m;if(l)m=-1,h=l,l=null;else if(c<t.childCount)m=c,h=t.child(c++);else break;for(let x=0;x<a.length;x++)a[x].to<=i&&a.splice(x--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)a.push(s[o++]);let g=i+h.nodeSize;if(h.isText){let x=g;o<s.length&&s[o].from<x&&(x=s[o].from);for(let y=0;y<a.length;y++)a[y].to<x&&(x=a[y].to);x<g&&(l=h.cut(x-i),h=h.cut(0,x-i),g=x,m=-1)}else for(;o<s.length&&s[o].to<g;)o++;let p=h.isInline&&!h.isLeaf?a.filter(x=>!x.inline):a.slice();r(h,p,e.forChild(i,h),m),i=g}}function JW(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function GW(t,e,n,r){for(let s=0,i=0;s<t.childCount&&i<=r;){let o=t.child(s++),a=i;if(i+=o.nodeSize,!o.isText)continue;let l=o.text;for(;s<t.childCount;){let c=t.child(s++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Ex(t,e,n,r,s){let i=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],c=a,u=a+=l.size;c>=n||u<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),s&&(i.push(s),s=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function $x(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&Fe.findFrom(i,e)}function Ks(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function S2(t,e,n){let r=t.state.selection;if(r instanceof _e)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Ks(t,new _e(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=$x(t.state,e);return s&&s instanceof we?Ks(t,s):!1}else if(!er||n.indexOf("m")<0){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let a=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?we.isSelectable(i)?Ks(t,new we(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):Ks(t,new _e(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1}}else return!1;else{if(r instanceof we&&r.node.isInline)return Ks(t,new _e(e>0?r.$to:r.$from));{let s=$x(t.state,e);return s?Ks(t,s):!1}}}function vc(t,e){let n=t.pmViewDesc;return n?n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR"):Se(t)&&t.contentEditable=="false"}function Go(t,e){return e<0?YW(t):QW(t)}function YW(t){let e=t.domSel.readRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for($r&&Se(n)&&r<zt(n)&&vc(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(!Se(n))break;let a=n.childNodes[r-1];if(vc(a,-1))s=n,i=--r;else if(Ct(a))n=a,r=n.nodeValue.length;else break}else{if(X4(n))break;{let a=n.previousSibling;for(;a&&vc(a,-1);)s=n.parentNode,i=ln(a),a=a.previousSibling;if(a)n=a,r=zt(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Mx(t,n,r):s&&Mx(t,s,i)}function QW(t){let e=t.domSel.readRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=zt(n),i,o;for(;;)if(r<s){if(!Se(n))break;let a=n.childNodes[r];if(vc(a,1))i=n,o=++r;else break}else{if(X4(n))break;{let a=n.nextSibling;for(;a&&vc(a,1);)i=a.parentNode,o=ln(a)+1,a=a.nextSibling;if(a)n=a,r=0,s=zt(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&Mx(t,i,o)}function X4(t){for(let e=t;e;e=e.parentNode){let n=e.pmViewDesc;if(n)return n.node?n.node.isBlock:!1}return!1}function Mx(t,e,n){if(!Ct(e)){let o,a;(a=G1(e,n))?(e=a,n=0):(o=J1(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection(),s=t.domSel.readRange();if(!r)return;Lp(s)?r.collapse(e,n):r.extend&&(r.collapse(s.anchorNode,s.anchorOffset),r.extend(e,n)),t.domSel.ignore();let{state:i}=t;setTimeout(()=>{t.state==i&&t.domSel.sync()},50)}function j2(t,e){let n=t.state.doc.resolve(e);if(!(gn||L4)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}let r=t.dom;for(let i=n.depth;i>0;i--)if(n.node(i).isBlock){r=t.nodeDOM(n.before(i))||r;break}return getComputedStyle(r).direction=="rtl"?"rtl":"ltr"}function C2(t,e,n){let r=t.state.selection;if(r instanceof _e&&!r.empty||n.indexOf("s")>-1||er&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=$x(t.state,e);if(o&&o instanceof we)return Ks(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof Un?Fe.near(o,e):Fe.findFrom(o,e);return a?Ks(t,a):!1}return!1}function _2(t,e){if(!(t.state.selection instanceof _e))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function N2(t,e,n){t.domObserver.stopped(()=>e.contentEditable=n)}function XW(t){if(!cn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSel.readRange();if(e&&Se(e)&&n==0&&e.firstChild&&Se(e.firstChild)&&e.firstChild.contentEditable=="false"){let r=e.firstChild;N2(t,r,"true"),setTimeout(()=>N2(t,r,"false"),20)}return!1}function eU(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function tU(t,e){let n=e.keyCode,r=eU(e);if(n==8||er&&n==72&&r=="c")return _2(t,-1)||Go(t,-1);if(n==46&&!e.shiftKey||er&&n==68&&r=="c")return _2(t,1)||Go(t,1);if(n==13||n==27)return!0;if(n==37||er&&n==66&&r=="c"){let s=n==37?j2(t,t.state.selection.from)=="ltr"?-1:1:-1;return S2(t,s,r)||Go(t,s)}else if(n==39||er&&n==70&&r=="c"){let s=n==39?j2(t,t.state.selection.from)=="ltr"?1:-1:1;return S2(t,s,r)||Go(t,s)}else{if(n==38||er&&n==80&&r=="c")return C2(t,-1,r)||Go(t,-1);if(n==40||er&&n==78&&r=="c")return XW(t)||C2(t,1,r)||Go(t,1);if(r==(er?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function X1(t,e){t.someProp("transformCopied",m=>{e=m(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let m=r.firstChild;n.push(m.type.name,m.attrs!=m.type.defaultAttrs?m.attrs:null),r=m.content}let o=t.someProp("clipboardSerializer")||Fo.fromSchema(t.state.schema),a=iO(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,f=0;for(;c&&Se(c)&&(u=sO[c.nodeName.toLowerCase()]);){for(let m=u.length-1;m>=0;m--){let g=a.createElement(u[m]);for(;l.firstChild;)g.appendChild(l.firstChild);l.appendChild(g),f++}c=l.firstChild}c&&Se(c)&&c.setAttribute("data-pm-slice",`${s} ${i}${f?` -${f}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",m=>m(e,t))||e.content.textBetween(0,e.content.size,`
773
-
774
- `);return{dom:l,text:h,slice:e}}function eO(t,e,n,r,s){let i=s.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=!!e&&(r||i||!n);if(l){if(t.someProp("transformPastedText",h=>{e=h(e,i||r,t)}),i)return a=new ce(J.from(t.state.schema.text(e.replace(/\r\n?/g,`
775
- `))),0,0),t.someProp("transformPasted",h=>{a=h(a,t,!0)}),a;let f=t.someProp("clipboardTextParser",h=>h(e,s,r,t));if(f)a=f;else{let h=s.marks(),{schema:m}=t.state,g=Fo.fromSchema(m);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(p=>{let x=o.appendChild(document.createElement("p"));p&&x.appendChild(g.serializeNode(m.text(p,h)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),o=iU(n),Fp&&oU(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let h=o.firstChild;for(;h&&!Se(h);)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||vi.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!nU.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=aU(E2(a,+u[1],+u[2]),u[4]);else if(a=ce.maxOpen(rU(a.content,s),!0),a.openStart||a.openEnd){let f=0,h=0;for(let m=a.content.firstChild;f<a.openStart&&!m.type.spec.isolating;f++,m=m.firstChild);for(let m=a.content.lastChild;h<a.openEnd&&!m.type.spec.isolating;h++,m=m.lastChild);a=E2(a,f,h)}return t.someProp("transformPasted",f=>{a=f(a,t,r)}),a}const nU=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function rU(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(a=>{if(!o)return;let l=s.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&i.length&&nO(l,i,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=rO(o[o.length-1],i.length));let u=tO(a,l);o.push(u),s=s.matchType(u.type),i=l}}),o)return J.from(o)}return t}function tO(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,J.from(t));return t}function nO(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=nO(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(J.from(tO(n,t,s+1))))}}function rO(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,rO(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(J.empty,!0);return t.copy(n.append(r))}function Tx(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(i=0),s<r-1&&(a=Tx(a,e,n,r,s+1,i)),s>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,i<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(J.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function E2(t,e,n){return e<t.openStart&&(t=new ce(Tx(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ce(Tx(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const sO={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function iO(){return document.implementation.createHTMLDocument("title")}let Bl=null;function sU(t){let e=window.trustedTypes;if(!e)return t;if(!Bl){if(Bl=e.defaultPolicy)try{return Bl.createHTML(t)}catch{}Bl=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})}return Bl.createHTML(t)}function iU(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=iO(),r=n.body,s=/<([a-z][^>\s]+)/i.exec(t),i;if((i=s&&sO[s[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=sU(t),i)for(let o=0;o<i.length;o++)r=r.querySelector(i[o])||r;for(let o=0;o<n.styleSheets.length;o++){let a=n.styleSheets[o];for(let l=0;l<a.rules.length;l++){let c=a.rules[l];if(c instanceof CSSStyleRule){let u=r.querySelectorAll(c.selectorText);for(let f=0;f<u.length;f++)u[f].style.cssText+=c.style.cssText}}}return r}function oU(t){let e=t.querySelectorAll(gn?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function aU(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:s,openStart:i,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs()||!l.createAndFill(null,s))break;try{s=J.from(l.create(r[a+1],s))}catch{break}i++,o++}return new ce(s,i,o)}class jn{constructor(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}static from(e){return e instanceof jn?e:new jn(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}jn.null=new jn(null,0,null,0);class lU{constructor(e){this.view=e,this.range=jn.null,this.active=!1,this.synced=!1,this.suppress=!1,this.currentDocument=null,this.onSelectionChange=this.onSelectionChange.bind(this)}ensureListener(){let e=this.view.dom.ownerDocument;e!=this.currentDocument&&(this.currentDocument&&this.currentDocument.removeEventListener("selectionchange",this.onSelectionChange),this.currentDocument=e,e.addEventListener("selectionchange",this.onSelectionChange))}destroy(){this.currentDocument&&(this.currentDocument.removeEventListener("selectionchange",this.onSelectionChange),this.currentDocument=null),this.active=!1,this.range=jn.null}suppressChanges(){this.suppress=!0,setTimeout(()=>this.suppress=!1,50)}onSelectionChange(){if(this.suppress&&this.view.hasFocus())return this.sync();this.read()&&this.view.domObserver.flush(!1)}readRange(){let{view:e}=this,n=e.dom.isConnected!==!1&&e.domSelection();return n?cn&&e.root.nodeType===11&&_W(e.dom.ownerDocument)==e.dom?jn.from(cU(e,n)||n):jn.from(n):jn.null}read(){this.ensureListener();let e=lO(this.view);if(!e){this.active=!1,this.range=jn.null;return}return this.active=!0,this.range.eq(e)?!1:(this.range=e,this.synced=!1,!0)}sync(e=!1){let{view:n}=this;n.docView&&(this.ensureListener(),n.domObserver.stopped(()=>{pU(n,n.state.selection);let r=n.state.selection;if(n.input.mouseSelecting||oO(n)){let{desc:s,start:i}=aO(n.docView,r.from,r.to,0);n.cursorWrapper?hU(n):s instanceof G4&&s.spec.setSelection?s.spec.setSelection(r.anchor-i,r.head-i,n.root):dU(n,e,s,i),this.synced=this.active=!0}r.visible==n.dom.classList.contains("ProseMirror-hideselection")&&(r.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),fU(n))),this.range=this.readRange()}))}ignore(e=this.readRange()){this.range=jn.from(e),this.synced=!0}deactivate(){this.range=jn.null,this.active=this.synced=!1}}function cU(t,e){if(e.getComposedRanges){let s=e.getComposedRanges({shadowRoots:[t.root]})[0];if(s)return $2(t,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?$2(t,n):null}function $2(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return yc(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),new jn(n,r,s,i)}function e0(t,e,n=null){let r=t.state.doc;if(!e.focusNode)return null;let s=t.docView.nearestDesc(e.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(e.focusNode,e.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(Lp(e)){for(l=o;s&&!s.node;)s=s.parent;if(s&&s.node.isAtom&&we.isSelectable(s.node)&&s.parent&&!(s.node.isInline&&jW(e.focusNode,e.focusOffset,s.dom))){let f=s.posBefore;c=new we(o==f?a:r.resolve(f))}else if($r&&n=="key"&&o>t.state.selection.to&&Se(e.focusNode)&&e.focusOffset==e.focusNode.childNodes.length&&s&&s.posAtStart>t.state.selection.to)for(let f=e.focusNode;;f=f.parentNode){if(getComputedStyle(f).overflow!="visible"){c=Fe.findFrom(r.resolve(s.posAtStart),1);break}if(f==s.dom||f.nextSibling||!f.parentNode||!Se(f.parentNode))break}}else{if(e instanceof t.dom.ownerDocument.defaultView.Selection&&e.rangeCount>1){let f=o,h=o;for(let m=0;m<e.rangeCount;m++){let g=e.getRangeAt(m);f=Math.min(f,t.docView.posFromDOM(g.startContainer,g.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(g.endContainer,g.endOffset,-1))}if(f<0)return null;[l,o]=h==t.state.selection.anchor?[h,f]:[f,h],a=r.resolve(o)}else l=t.docView.posFromDOM(e.anchorNode,e.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let f=n=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;c=ll(t,u,a,f)}return c}function oO(t){return t.editable?t.hasFocus():cO(t,t.domSel.readRange())&&(!document.activeElement||document.activeElement.contains(t.dom))}function dU(t,e,n,r){let s=t.state.selection,{anchor:i,head:o}=s,a,l;M2&&!(s instanceof _e)&&(s.$from.parent.inlineContent||(a=T2(t,s.from)),!s.empty&&!s.$from.parent.inlineContent&&(l=T2(t,s.to)));let c=n.domFromPos(i-r,i>r?-1:1),u=o==i?c:n.domFromPos(o-r,o>r?-1:1);uU(i,o,c,u,t,e),M2&&(a&&O2(a),l&&O2(l))}function aO(t,e,n,r=0){for(let s=0,i=r;s<t.children.length;s++){let o=t.children[s],a=i+o.size;if(e>i&&n<a)return aO(o,e,n,i+o.border);i=a}return{desc:t,start:r}}function uU(t,e,n,r,s,i){let o=!1;if(($r||cn)&&t==e){let{node:u,offset:f}=n;if(Ct(u)){if(o=!!(f&&u.nodeValue[f-1]==`
776
- `),o&&f==u.nodeValue.length)for(let h=u,m;h;h=h.parentNode){if(m=h.nextSibling){m.nodeName=="BR"&&(n=r={node:m.parentNode,offset:ln(m)+1});break}let g=h.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let h=u.childNodes[f-1];o=h&&(h.nodeName=="BR"||h.contentEditable=="false")}}let a=s.domSel.readRange();if($r&&a.focusNode&&a.focusNode!=r.node&&Se(a.focusNode)){let u=a.focusNode.childNodes[a.focusOffset];u&&u.contentEditable=="false"&&(i=!0)}if(!(i||o&&cn)&&yc(n.node,n.offset,a.anchorNode,a.anchorOffset)&&yc(r.node,r.offset,a.focusNode,a.focusOffset))return;let l=s.domSelection(),c=s.input.mouseSelecting;if(c&&c.affinity&&t==e&&c.pos==t){let{affinity:u}=c,{node:f,offset:h}=r,m,g=0;if(Ct(f)&&(u>0?h<zt(f):h>0)?(m=f,g=h+u):(m=(u>0?G1:J1)(f,h),m&&(g=u>0?1:m.nodeValue.length-1)),m){l.collapse(m,g),l.modify("move",u>0?"backward":"forward","lineboundary");let{focusNode:p,focusOffset:x}=l;if(cn&&s.root.nodeType==11){let y=l.getComposedRanges({shadowRoots:[s.root]});y.length&&(p=y[0].startContainer,x=y[0].startOffset)}if(yc(f,h,p,x))return}}D4(l,{focusNode:r.node,focusOffset:r.offset,anchorNode:n.node,anchorOffset:n.offset})}const M2=cn||gn&&z4<63;function T2(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(cn&&s&&s.contentEditable=="false")return ng(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return ng(s);if(i)return ng(i)}}function ng(t){return t.contentEditable="true",cn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function O2(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function fU(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSel.readRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!oO(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function hU(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom;n.nodeName=="IMG"?e.collapse(n.parentNode,ln(n)+1):e.collapse(n,0)}function pU(t,e){if(e instanceof we){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(A2(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else A2(t)}function A2(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ll(t,e,n,r){let s=t.someProp("createSelectionBetween",i=>i(t,e,n))||_e.between(e,n,r);return t.someProp("adjustSelectionFromDOM",i=>{s=i(t,s)}),s}function lO(t){if(t.editable&&!t.hasFocus())return null;let e=t.domSel.readRange();return e&&cO(t,e)?e:null}function cO(t,e){if(!e.anchorNode)return!1;try{return il(t.dom,e.anchorNode)&&(t.editable||il(t.dom,e.focusNode))}catch{return!1}}const vn={},kn={},mU={touchstart:!0,touchmove:!0};class gU{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastKeyDispatched=!1,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.mouseSelecting=null,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function yU(t){for(let e in vn){let n=vn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{vU(t,r)&&(t.input.composing&&(r.type=="keydown"||r.type=="beforeinput")&&r.isComposing===!1&&fO(t,!0),!t0(t,r)&&(t.editable||!(r.type in kn))&&n(t,r))},mU[e]?{passive:!0}:void 0)}cn&&t.dom.addEventListener("input",()=>null),Ox(t)}function Bp(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function xU(t){t.input.mouseDown&&t.input.mouseDown.done(),t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Ox(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>t0(t,r))})}function t0(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function vU(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function kU(t,e){!t0(t,e)&&vn[e.type]&&(t.editable||!(e.type in kn))&&vn[e.type](t,e)}function Xs(t,e){let{input:n}=t;return n.lastKeyDispatched||t.composing?!1:(n.lastKeyDispatched=!0,typeof e=="string"&&(e=CW(e=="Backspace"?8:13,e)),t.someProp("handleKeyDown",r=>r(t,e)))}kn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),t.input.lastKeyDispatched=!1,!(vs&&gn&&n.keyCode==13)){if(al&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(Xs(t,"Enter"),t.input.lastIOSEnter=0)},200);return}n.keyCode!=229&&t.domObserver.forceFlush(!0),Xs(t,n)||tU(t,n)?n.preventDefault():Bp(t,"key")}};kn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};kn.keypress=(t,e)=>{let n=e;if($U(t)||!n.charCode||n.ctrlKey&&!n.altKey||er&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof _e)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function ad(t){return{left:t.clientX,top:t.clientY}}function wU(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function n0(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,a=>o>i.depth?a(t,n,i.nodeAfter,i.before(o),s,!0):a(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function dO(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function bU(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&we.isSelectable(r)?(dO(t,new we(n)),!0):!1}function SU(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof we&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o);if(we.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(dO(t,we.create(t.state.doc,s)),!0):!1}function jU(t,e,n,r,s){return n0(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?SU(t,n):bU(t,n))}function CU(t,e,n,r){return n0(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function _U(t,e,n,r){return n0(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))}function R2(t,e,n){if(e==-1)return t.inlineContent?_e.create(t,0,t.content.size):null;let r=t.resolve(e);for(let s=r.depth+1;s>0;s--){let i=s>r.depth?r.nodeAfter:r.node(s),o=r.before(s);if(i.inlineContent)return _e.create(t,o+1,o+1+i.content.size);if(n&&we.isSelectable(i))return we.create(t,o)}return null}let Ax=/[\w_\u00a1-\uffff]+/g;try{Ax=new RegExp("[\\p{L}\\p{N}_]+","gu")}catch{}function I2(t,e){let n=t.resolve(e),r=n.node(),s="",i=e,o=e;for(let p=n.indexAfter(),x=!1;p>0;p--){let y=r.child(p-1);if(!y.text)break;let v=i==e?e-n.posAtIndex(p-1):y.text.length,k=v;for(;k>0;k--)if(/\S/.test(y.text[k-1]))x=!0;else if(x)break;if(s=y.text.slice(k,v)+s,i-=v-k,k||i<e-50)break}for(let p=n.index(),x=!1;p<r.childCount;p++){let y=r.child(p);if(!y.text)break;let v=o==e?e-n.posAtIndex(p):0,k=v;for(;k<y.text.length;k++)if(/\S/.test(y.text[k]))x=!0;else if(x)break;if(s+=y.text.slice(v,k),o+=k-v,k<y.text.length||o>e+50)break}let a=i,l=o;if(Intl.Segmenter){for(let p of new Intl.Segmenter(void 0,{granularity:"word"}).segment(s))if(p.isWordLike){let x=p.index+i,y=x+p.segment.length;if(y<e)a=y;else if(x>e){l=x;break}else return _e.create(t,x,y)}}else{Ax.lastIndex=0;for(let p;p=Ax.exec(s);){let x=p.index+i,y=x+p[0].length;if(y<e)a=y;else if(x>e){l=x;break}else return _e.create(t,x,y)}}let c=s.slice(a-i,e-i),u=s.slice(e-i,l-i),f=/\S*$/.exec(c)[0].length,h=/^\S*/.exec(u)[0].length;if(f||h)return _e.create(t,e-f,e+h);let m=/\s*$/.exec(c)[0].length,g=/^\s*/.exec(u)[0].length;return _e.create(t,e-m,e+g)}const uO=er?"metaKey":"ctrlKey";vn.mousedown=(t,e)=>{let n=e,r=Date.now();if(t.input.shiftKey=n.shiftKey,t.input.lastTouch>r-500)return!1;Ao(t);let s="singleClick";r-t.input.lastClick.time<500&&wU(n,t.input.lastClick)&&!n[uO]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:s,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let i=t.posAtCoords(ad(n));if(i)if(n.button==0){if(!t.hasFocus()){V4(t.dom);let a=t.root.activeElement;a&&!a.contains(t.dom)&&a.blur()}(t.input.mouseDown=new NU(t,i,n,s)).mightDrag||n.preventDefault()}else Bp(t,"pointer")};class NU{constructor(e,n,r,s){var i;this.view=e,this.startPos=n,this.event=r,this.type=s,this.didMove=!1,this.lastPos=-1,this.anchorRange=null,this.startDoc=e.state.doc,this.selectNode=!!r[uO],this.extend=r.shiftKey,this.anchorDoc=this.startDoc;let o=P2(e);if(this.extend){let a=e.state.selection;this.anchorRange=a instanceof we?{from:a.from,to:a.to}:{from:a.anchor,to:a.anchor};let l=a instanceof we?e.nodeDOM(a.from).getBoundingClientRect():e.coordsAtPos(a.anchor);this.anchorOffset={x:(l.left+l.right)/2-o.x,y:(l.top+l.bottom)/2-o.y}}else this.anchorOffset={x:r.clientX-o.x,y:r.clientY-o.y};if(s=="singleClick"){let{selection:a}=e.state,l,c,u=!1;if(a instanceof we&&a.from<=n.pos&&a.to>=n.pos)c=a.from,l=a.node,u=!0;else if(n.inside>-1)l=e.state.doc.nodeAt(n.inside),c=n.inside;else{let f=e.state.doc.resolve(n.pos);l=f.parent,c=f.depth?f.before():-1}if(u||c>-1&&l.type.spec.draggable&&l.type.spec.selectable!==!1){let f=(i=e.docView.descAt(c))===null||i===void 0?void 0:i.nodeDOM;this.mightDrag={node:l,elt:f,pos:c,addAttr:!1},f&&!f.draggable&&(this.mightDrag.addAttr=!0,e.domObserver.stopped(()=>f.draggable=!0))}else this.mightDrag=EU(e,r)}else this.mightDrag=!1;e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),this.mightDrag||this.select(this.startPos,!0)}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null),typeof this.mightDrag=="object"&&this.mightDrag.addAttr&&this.view.domObserver.stopped(()=>this.mightDrag.elt.removeAttribute("draggable"))}maybeRunHandler(e,n){return(this.type=="singleClick"?jU:this.type=="doubleClick"?CU:_U)(this.view,e.pos,e.inside,n,this.selectNode)}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.startPos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(ad(e))),n&&(this.didMove||this.maybeRunHandler(n,e)||this.select(n,!0),e.preventDefault())}move(e){if(e.buttons==0){this.done();return}if(!this.didMove&&(Math.abs(this.event.x-e.clientX)>8||Math.abs(this.event.y-e.clientY)>8)&&(this.didMove=!0,this.mightDrag=!1),!this.mightDrag){let n=this.view.posAtCoords(ad(e));n&&this.select(n,!1)}e.preventDefault()}select(e,n){if(e.pos==this.lastPos)return;this.lastPos=e.pos;let{view:r}=this,{doc:s}=r.state,i=this.type=="singleClick"?D2(r,s,e):this.type=="doubleClick"?I2(s,e.pos):R2(s,e.inside,n);i&&(n&&!this.extend?this.anchorRange=i:(!n||this.extend)&&(s.eq(this.anchorDoc)||this.restoreAnchor(),this.anchorRange&&this.anchorRange.from<i.from?i=ll(r,s.resolve(this.anchorRange.from),s.resolve(i.to)):this.anchorRange&&this.anchorRange.to>i.to&&(i=ll(r,s.resolve(this.anchorRange.to),s.resolve(i.from)))),i.eq(r.state.selection)||(r.input.mouseSelecting=e,r.dispatch(r.state.tr.setSelection(i).setMeta("pointer",!0).scrollIntoView()),r.input.mouseSelecting=null))}restoreAnchor(){let e=P2(this.view),n=this.view.posAtCoords({left:this.anchorOffset.x+e.x,top:this.anchorOffset.y+e.y});if(!n)this.anchorRange=null;else{let{doc:r}=this.view.state;this.anchorRange=this.type=="singleClick"?D2(this.view,r,n):this.type=="doubleClick"?I2(r,n.pos):R2(r,n.inside,!1),this.anchorDoc=this.view.state.doc}}}function P2(t){let e=t.dom.getBoundingClientRect();return{x:e.left-t.dom.scrollLeft,y:e.top-t.dom.scrollTop}}function D2(t,e,n){if(n.inside>-1){let s=e.nodeAt(n.inside);if(s.isAtom&&we.isSelectable(s))return we.create(e,n.inside)}let r=e.resolve(n.pos);return ll(t,r,r)}function EU(t,e){let{selection:n}=t.state;if(n.empty)return!1;let r=t.domSelection();if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i<s.length;i++){let o=s[i];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}vn.touchstart=t=>{t.input.lastTouch=Date.now(),Ao(t),Bp(t,"pointer")};vn.touchmove=t=>{t.input.lastTouch=Date.now(),Bp(t,"pointer")};vn.contextmenu=t=>Ao(t);function $U(t,e){return t.composing?!0:cn&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const MU=vs?5e3:-1;kn.compositionstart=kn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof _e&&e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||gn&&L4&&TU(t)))t.markCursor=t.state.storedMarks||n.marks(),Ao(t,!0),t.markCursor=null;else if(Ao(t,!e.selection.empty),$r&&t.domSel.active&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(let{focusNode:r,focusOffset:s}=t.domSel.range;r&&Se(r)&&s!=0;){let i=s<0?r.lastChild:r.childNodes[s-1];if(!i)break;if(Ct(i)){let o=t.domSelection();o&&o.collapse(i,i.nodeValue.length);break}else r=i,s=-1}t.input.composing=!0}hO(t,MU)};function TU(t){let{focusNode:e,focusOffset:n}=t.domSel.range;if(!e||!Se(e)||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return Se(r)&&r.contentEditable=="false"}kn.compositionend=(t,e)=>{t.composing&&fO(t)};function fO(t,e=!1){t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,e?Ao(t):hO(t,20)}function hO(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ao(t),e))}function pO(t){t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());for(let e;e=t.input.compositionNodes.pop();)e.markParentDamage()}function OU(t){let e=t.domSel.range;if(!t.domSel.active||!e.focusNode)return null;let n=J1(e.focusNode,e.focusOffset),r=G1(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function Ao(t,e=!1){if(!(vs&&t.domObserver.flushingSoon>=0)&&(t.domObserver.forceFlush(),pO(t),e||t.docView&&t.docView.damage)){let n=e0(t,t.domSel.readRange()),r=t.state.selection;n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state)}}function AU(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ld=al&&EW<604;vn.copy=kn.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=ld?null:n.clipboardData,o=r.content(),{dom:a,text:l}=X1(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):AU(t,a),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function RU(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function IU(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?cd(t,r.value,null,s,e):cd(t,r.textContent,r.innerHTML,s,e)},50)}function cd(t,e,n,r,s){let i=eO(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,s,i||ce.empty)))return!0;if(!i)return!1;let o=RU(i),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function mO(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}kn.paste=(t,e)=>{let n=e;if(t.composing&&!vs)return;let r=ld?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&cd(t,mO(r),r.getData("text/html"),s,n)?n.preventDefault():IU(t,n)};class gO{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const PU=er?"altKey":"ctrlKey";function yO(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[PU]}vn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(ad(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof we?s.to-1:s.to))){if(r&&typeof r.mightDrag=="object")o=we.create(t.state.doc,r.mightDrag.pos);else if(n.target&&Se(n.target)){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(o=we.create(t.state.doc,f.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:c,slice:u}=X1(t,a);(!n.dataTransfer.files.length||!gn||z4>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ld?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ld||n.dataTransfer.setData("text/plain",c),t.dragging=new gO(u,yO(t,n),o)};vn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};kn.dragover=kn.dragenter=(t,e)=>e.preventDefault();kn.drop=(t,e)=>{try{DU(t,e,t.dragging)}finally{t.dragging=null}};function DU(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(ad(e));if(!r)return;let s=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",m=>{i=m(i,t,!1)}):i=eO(t,mO(e.dataTransfer),ld?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&yO(t,e));if(t.someProp("handleDrop",m=>m(t,e,i||ce.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?H7(t.state.doc,s.pos,i):s.pos;a==null&&(a=s.pos);let l=t.state.tr;if(o){let{node:m}=n;m?m.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=l.doc;if(u?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i),l.doc.eq(f))return;let h=l.doc.resolve(c);if(u&&we.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new we(h));else{let m=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((g,p,x,y)=>m=y),l.setSelection(ll(t,h,l.doc.resolve(m)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}vn.focus=t=>{if(t.input.lastFocus=Date.now(),!t.focused&&(t.domObserver.stopped(()=>t.dom.classList.add("ProseMirror-focused")),t.focused=!0,t.domSel.read(),!t.domSel.synced)){let e=t.domSel.range;setTimeout(()=>{let n=t.domSel.readRange();n&&e.eq(n)&&t.domSel.sync()},20)}};vn.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stopped(()=>t.dom.classList.remove("ProseMirror-focused")),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domSel.deactivate(),t.focused=!1)};vn.beforeinput=(t,e)=>{if(vs&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||t.domObserver.pendingRecords().length||(t.dom.blur(),t.focus(),Xs(t,"Backspace")))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in kn)vn[t]=kn[t];function dd(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Rx{constructor(e){this.frag=e,this.index=0,this.off=0}nodeAt(e){for(;this.off<=e&&this.index<this.frag.childCount;){let n=this.frag.child(this.index);if(this.off==e)return n;this.off+=n.nodeSize,this.index++}return null}}class mh{constructor(e,n){this.toDOM=e,this.spec=n||uo,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new kr(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof mh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&dd(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class bi{constructor(e,n){this.attrs=e,this.spec=n||uo}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new kr(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof bi&&dd(this.attrs,e.attrs)&&dd(this.spec,e.spec)}static is(e){return e.type instanceof bi}destroy(){}}class r0{constructor(e,n){this.attrs=e,this.spec=n||uo}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new kr(i.pos-r,o.pos-r,this)}valid(e,n,r){let s=r.nodeAt(n.from);return!!s&&!s.isText&&n.from+s.nodeSize==n.to}eq(e){return this==e||e instanceof r0&&dd(this.attrs,e.attrs)&&dd(this.spec,e.spec)}destroy(){}}class kr{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new kr(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new kr(e,e,new mh(n,r))}static inline(e,n,r,s){return new kr(e,n,new bi(r,s))}static node(e,n,r,s){return new kr(e,n,new r0(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof bi}get widget(){return this.type instanceof mh}}const ia=[],uo={};class Dt{constructor(e,n){this.local=e.length?e:ia,this.children=n.length?n:ia}static create(e,n){return n.length?gh(n,e,0,uo):rn}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let a=this.local[o];if(a.from>n)break;a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+s,a.to+s))}for(let o=0;o<this.children.length&&!(this.children[o]>=n);o+=3)if(this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,s+a,i)}}map(e,n,r){return this==rn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||uo)}mapInner(e,n,r,s,i){let o;if(this.local.length){let a=new Rx(n.content);for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,r,s);c&&c.type.valid(n,c,a)?(o||(o=[])).push(c):i.onRemove&&i.onRemove(this.local[l].spec)}}return this.children.length?zU(this.children,o||[],e,n,r,s,i):o?new Dt(o.sort(ii),ia):rn}add(e,n){return n.length?this==rn?Dt.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((a,l)=>{let c=l+r,u;if(u=vO(n,a,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<l;)i+=3;s[i]==l?s[i+2]=s[i+2].addInner(a,u,c+1):s.splice(i,0,l,l+a.nodeSize,gh(u,a,c+1,uo)),i+=3}});let o=xO(i?kO(n):n,-r).sort(ii);if(o.length){let a=new Rx(e.content);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l],a)||o.splice(l--,1)}return new Dt(o.length?this.local.concat(o).sort(ii):this.local,s||this.children)}remove(e){return e.length==0||this==rn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,a=r[i]+n,l=r[i+1]+n;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>a&&f.to<l&&(e[u]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,a+1);c!=rn?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let a=0;a<s.length;a++)s[a].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new Dt(s,r):rn}forChild(e,n){if(this==rn)return this;if(n.isLeaf)return Dt.empty;let r,s,i=0,o=this.children.length/3;for(;i<o;){let c=i+o>>>1,u=c*3,f=this.children[u];if(f<e)i=c+1;else if(f>e)o=c;else{r=this.children[u+2];break}}let a=e+1,l=a+n.content.size;for(let c=0;c<this.local.length;c++){let u=this.local[c];if(u.from<l&&u.to>a&&u.type instanceof bi){let f=Math.max(a,u.from)-a,h=Math.min(l,u.to)-a;f<h&&(s||(s=[])).push(u.copy(f,h))}}if(s){let c=new Dt(s.sort(ii),ia);return r?new ei([c,r]):c}return r||rn}eq(e){if(this==e)return!0;if(!(e instanceof Dt)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return s0(this.localsInner(e))}localsInner(e){if(this==rn)return ia;if(e.inlineContent||!this.local.some(bi.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof bi||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Dt.empty=new Dt([],[]);Dt.removeOverlap=s0;const rn=Dt.empty;class ei{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,uo));return ei.from(r)}forChild(e,n){if(n.isLeaf)return Dt.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=rn&&(i instanceof ei?r=r.concat(i.members):r.push(i))}return ei.from(r)}eq(e){if(!(e instanceof ei)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?s0(r?n:n.sort(ii)):ia}static from(e){switch(e.length){case 0:return rn;case 1:return e[0];default:return new ei(e.every(n=>n instanceof Dt)?e:e.reduce((n,r)=>n.concat(r instanceof Dt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function zU(t,e,n,r,s,i,o){let a=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let f=0;n.maps[c].forEach((h,m,g,p)=>{let x=p-g-(m-h);for(let y=0;y<a.length;y+=3){let v=a[y+1];if(v<0||h>v+u-f)continue;let k=a[y]+u-f;m>=k?a[y+1]=h<=k?-2:-1:h>=u&&x&&(a[y]+=x,a[y+1]+=x)}f+=x}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+i),f=u-s;if(f<0||f>=r.content.size){l=!0;continue}let h=n.map(t[c+1]+i,-1),m=h-s,{index:g,offset:p}=r.content.findIndex(f),x=r.maybeChild(g);if(x&&p==f&&p+x.nodeSize==m){let y=a[c+2].mapInner(n,x,u+1,t[c]+i+1,o);y!=rn?(a[c]=f,a[c+1]=m,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=LU(a,t,e,n,s,i,o),u=gh(c,r,0,o);e=u.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,h=0;f<u.children.length;f+=3){let m=u.children[f];for(;h<a.length&&a[h]<m;)h+=3;a.splice(h,0,u.children[f],u.children[f+1],u.children[f+2])}}return new Dt(e.sort(ii),a)}function xO(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new kr(s.from+e,s.to+e,s.type))}return n}function LU(t,e,n,r,s,i,o){function a(l,c){for(let u=0;u<l.local.length;u++){let f=l.local[u].map(r,s,c);f?n.push(f):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+i+1);return n}function vO(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function kO(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function gh(t,e,n,r){let s=[],i=!1;e.forEach((a,l)=>{let c=vO(t,a,l+n);if(c){i=!0;let u=gh(c,a,n+l+1,r);u!=rn&&s.push(l,l+a.nodeSize,u)}});let o=xO(i?kO(t):t,-n).sort(ii);if(o.length){let a=new Rx(e.content);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l],a)||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1))}return o.length||s.length?new Dt(o,s):rn}function ii(t,e){return t.from-e.from||t.to-e.to}function s0(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),z2(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),z2(e,s,r.copy(i.from,r.to)));break}}}return e}function z2(t,e,n){for(;e<t.length&&ii(n,t[e])>0;)e++;t.splice(e,0,n)}function rg(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=rn&&e.push(r)}),t.cursorWrapper&&e.push(Dt.create(t.state.doc,[t.cursorWrapper.deco])),ei.from(e)}function FU(t,e,n,r){let{node:s,fromOffset:i,toOffset:o,from:a,to:l}=t.docView.parseRange(e,n),c=t.domSel.range,u,f=c.anchorNode;if(f&&il(t.dom,f)&&(u=[{node:f,offset:c.anchorOffset}],Lp(c)||u.push({node:c.focusNode,offset:c.focusOffset})),gn&&t.input.lastKeyCode===8)for(let y=o;y>i;y--){let v=s.childNodes[y-1],k=v.pmViewDesc;if(v.nodeName=="BR"&&!k){o=y;break}if(!k||k.size)break}let h=t.state.doc,m=t.someProp("domParser")||vi.fromSchema(t.state.schema),g=h.resolve(a),p=null,x=m.parse(s,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:o,preserveWhitespace:g.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:BU(r),context:g});if(u&&u[0].pos!=null){let y=u[0].pos,v=u[1]&&u[1].pos;v==null&&(v=y),p={anchor:y+a,head:v+a}}return{doc:x,sel:p,from:a,to:l}}const BU=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(cn&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||cn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},VU=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function WU(t,e,n,r,s,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let S=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,_=e0(t,t.domSel.range,S);if(_&&!t.state.selection.eq(_)&&t.domSel.active){if(gn&&vs&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&Xs(t,"Enter"))return;let N=t.state.tr.setSelection(_);S=="pointer"?N.setMeta("pointer",!0):S=="key"&&N.scrollIntoView(),o&&N.setMeta("composition",o),t.dispatch(N)}return}let a=t.state.doc.resolve(e),l=a.sharedDepth(n);e=a.before(l+1),n=t.state.doc.resolve(n).after(l+1);let c=t.state.selection,u=FU(t,e,n,i),f=t.state.doc,h=f.slice(u.from,u.to),m,g;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(m=t.state.selection.to,g="end"):(m=t.state.selection.from,g="start"),t.input.lastKeyCode=null;let p=qU(h.content,u.doc.content,u.from,m,g);if(p&&t.input.domChangeCount++,(al&&t.input.lastIOSEnter>Date.now()-225||vs)&&i.some(S=>Se(S)&&!VU.test(S.nodeName))&&(!p||p.endA>=p.endB)&&Xs(t,"Enter")){t.input.lastIOSEnter=0;return}if(!p)if(s&&c instanceof _e&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))p={start:c.from,endA:c.to,endB:c.to};else{if(u.sel){let S=L2(t,t.state.doc,u.sel);if(S&&!S.eq(t.state.selection)){let _=t.state.tr.setSelection(S);o&&_.setMeta("composition",o),t.dispatch(_)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof _e&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to));let x=u.doc.resolveNoCache(p.start-u.from),y=u.doc.resolveNoCache(p.endB-u.from),v=f.resolve(p.start),k=x.sameParent(y)&&x.parent.inlineContent&&v.end()>=p.endA;if((al&&t.input.lastIOSEnter>Date.now()-225&&(!k||i.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!k&&HU(u.doc,x.pos,y.pos))&&Xs(t,"Enter")){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&(k?p.endA>p.start&&p.endB==p.start:ZU(f,p.start,p.endA,x,y))&&Xs(t,"Backspace")){vs&&gn&&t.domSel.suppressChanges();return}gn&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),vs&&!k&&x.start()!=y.start()&&y.parentOffset==0&&x.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==p.endA&&(p.endB-=2,y=u.doc.resolveNoCache(p.endB-u.from),setTimeout(()=>Xs(t,"Enter"),20));let w=p.start,j=p.endA,C=S=>{let _=S||t.state.tr.replace(w,j,u.doc.slice(p.start-u.from,p.endB-u.from));if(u.sel){let N=L2(t,_.doc,u.sel);N&&!(gn&&t.composing&&N.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(N.head==w||N.head==_.mapping.map(j)-1))&&_.setSelection(N)}return o&&_.setMeta("composition",o),_.scrollIntoView()},E;if(k)if(x.pos==y.pos){let S=C(t.state.tr.delete(w,j)),_=f.resolve(p.start).marksAcross(f.resolve(p.endA));_&&S.ensureMarks(_),t.dispatch(S)}else if(p.endA==p.endB&&(E=UU(x.parent.content.cut(x.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,p.endA-v.start())))){let S=C(t.state.tr);E.type=="add"?S.addMark(w,j,E.mark):S.removeMark(w,j,E.mark),t.dispatch(S)}else if(x.parent.child(x.index()).isText&&x.index()==y.index()-(y.textOffset?0:1)){let S=x.parent.textBetween(x.parentOffset,y.parentOffset),_=()=>C(t.state.tr.insertText(S,w,j));t.someProp("handleTextInput",N=>N(t,w,j,S,_))||t.dispatch(_())}else t.dispatch(C());else t.dispatch(C())}function L2(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ll(t,e.resolve(n.anchor),e.resolve(n.head))}function UU(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,a,l;for(let u=0;u<r.length;u++)s=r[u].removeFromSet(s);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(s.length==1&&i.length==0)a=s[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(s.length==0&&i.length==1)a=i[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(J.from(c).eq(t))return{mark:a,type:o}}function ZU(t,e,n,r,s){if(n-e<=s.pos-r.pos||sg(r,!0,!1)<s.pos)return!1;let i=t.resolve(e);if(!r.parent.inlineContent){let a=i.nodeAfter;return a!=null&&n==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=t.resolve(sg(i,!0,!0));return!o.parent.isTextblock||o.pos>n||sg(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function HU(t,e,n){let r=0,s=0;return t.nodesBetween(e,n,(i,o)=>{i.isTextblock&&o>=e&&o<n?r++:(i.isText?/\S/.test(i.text.slice(Math.max(0,e-o),Math.min(i.nodeSize,n-o))):i.isLeaf)&&s++}),s==0&&r==1}function sg(t,e,n){let r=t.depth,s=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function qU(t,e,n,r,s){let i=t.findDiffStart(e,n),o=n+t.size,a=n+e.size;if(i==null)return null;let{a:l,b:c}=t.findDiffEnd(e,o,a);if(s=="end"){let u=Math.max(0,i-Math.min(l,c));r-=l+u-i}if(l<i&&o<a){let u=r<=i&&r>=l?i-r:0;i-=u,c=i+(c-l),l=i}else if(c<i){let u=r<=i&&r>=c?i-r:0;i-=u,l=i+(l-c),c=i}return{start:i,endA:l,endB:c}}const KU={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0};class JU{constructor(e){this.view=e,this.queue=[],this.flushingSoon=-1,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.started=!1,this.observer=new window.MutationObserver(n=>{for(let r=0;r<n.length;r++)this.queue.push(n[r]);cn&&e.composing&&n.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()})}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(e=!1){this.flushingSoon>-1?(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush(!0)):e&&this.flush(!0)}start(){this.observer.takeRecords(),this.observer.observe(this.view.dom,KU),this.started=!0}stop(){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect(),this.started=!1}stopped(e){if(!this.started)return e();this.stop();try{return e()}finally{this.start()}}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=sl(i))n.add(i);for(let i=e.anchorNode;i;i=sl(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:Ct(r)?r.parentNode:r}))return this.view.domSel.ignore(e),!0}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(e=!0){let{view:n}=this;if(!n.docView||this.flushingSoon>-1)return;let r=this.pendingRecords();r.length&&(this.queue=[]),e&&n.domSel.read();let s=!n.domSel.suppress&&!n.domSel.synced&&!!lO(n)&&!this.ignoreSelectionChange(n.domSel.range),i=-1,o=-1,a=!1,l=[];if(n.editable)for(let u=0;u<r.length;u++){let f=this.registerMutation(r[u],l);f&&(i=i<0?f.from:Math.min(f.from,i),o=o<0?f.to:Math.max(f.to,o),f.typeOver&&(a=!0))}if(l.some(u=>u.nodeName=="BR")&&(n.input.lastKeyCode==8||n.input.lastKeyCode==46||gn&&(n.composing||n.input.compositionEndedAt>Date.now()-50)&&r.some(u=>u.type=="childList"&&u.removedNodes.length))){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let f=u.nextSibling;for(;f&&Se(f);){if(f.contentEditable=="false"){u.parentNode.removeChild(u);break}f=f.firstChild}}}else if($r&&l.length){let u=l.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,h]=u;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=n.domSel.range;for(let h of u){let m=h.parentNode;m&&m.nodeName=="LI"&&(!f||YU(n,f)!=m)&&h.remove()}}}let c=null;i<0&&s&&n.domSel.active&&n.input.lastFocus>Date.now()-200&&n.input.lastTouch<Date.now()-300&&Lp(n.domSel.range)&&(c=e0(n,n.domSel.range))&&c.eq(Fe.near(n.state.doc.resolve(0),1))?(n.input.lastFocus=0,n.domSel.sync(),n.scrollToSelection()):(i>-1||s)&&(i>-1&&GU(n),n.input.badSafariComposition&&(n.input.badSafariComposition=!1,QU(n,l)),WU(this.view,i,o,s,a,l),n.docView&&n.docView.damage?n.updateState(n.state):s&&n.domSel.sync())}registerMutation(e,n){var r;if(n.indexOf(e.target)>-1)return null;let s;for(let i=e.target;i&&!(s=this.view.docView.getDesc(i));i=i.parentNode);if(e.type=="attributes"&&(s==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!s||s.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;f<e.addedNodes.length;f++){let h=e.addedNodes[f];n.push(h),Ct(h)&&(this.lastChangedTextNode=h)}if(s.contentDOM&&s.contentDOM!=s.dom&&!s.contentDOM.contains(e.target))return s.markDamage(4),{from:s.posBefore,to:s.posAfter};let i=e.previousSibling,o=e.nextSibling,a=i&&i.parentNode==e.target?ln(i)+1:0,l=s.localPosFromDOM(e.target,a,-1),c=o&&o.parentNode==e.target?ln(o):e.target.childNodes.length,u=s.localPosFromDOM(e.target,c,1);return s.markDamage(!((r=s.contentDOM)===null||r===void 0)&&r.contains(e.target)?2:4),{from:l,to:u}}else return e.type=="attributes"?(s.markDamage(4),{from:s.posAtStart-s.border,to:s.posAtEnd+s.border}):(this.lastChangedTextNode=e.target,s.markDamage(s instanceof Bd&&e.target==s.nodeDOM?8:4),{from:s.posAtStart,to:s.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let F2=new WeakMap,B2=!1;function GU(t){if(!F2.has(t)&&(F2.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=$r,B2)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),B2=!0}}function YU(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function QU(t,e){var n;let{focusNode:r,focusOffset:s}=t.domSel.range;for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=i.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||!Se(l)||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(i,a.firstChild),r==i&&t.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}class wO{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new gU,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(H2),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=U2(this),W2(this),this.nodeViews=Z2(this),this.docView=w2(this.state.doc,V2(this),rg(this),this.dom,this),this.domObserver=new JU(this),this.domSel=new lU(this),this.domObserver.start(),this.domSel.read(),yU(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ox(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(H2),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(pO(this),o=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let m=Z2(this);eZ(m,this.nodeViews)&&(this.nodeViews=m,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ox(this),this.editable=U2(this),W2(this);let l=rg(this),c=V2(this),u=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,c,l);(f||!e.selection.eq(s.selection))&&(o=!0);let h=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&TW(this);o&&this.domObserver.stopped(()=>{let m=f&&gn&&!this.composing&&!s.selection.empty&&!e.selection.empty&&XU(s.selection,e.selection);if(f){let g=gn?this.trackWrites=this.domSel.range.focusNode:null;if(this.composing&&(this.input.compositionNode=OU(this)),i||!this.docView.update(e.doc,c,l,this,-1)){let p=this.docView.outerDeco;this.docView.destroy(),this.docView=w2(e.doc,c,l,this.dom,this,p)}g&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(m=!0)}this.domSel.sync(m)}),this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&OW(h)}scrollToSelection(){let e=this.domSel.range.focusNode;if(!(!e||!this.domSel.active)){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof we){let n=this.docView.domAfterPos(this.state.selection.from);Se(n)&&g2(this,n.getBoundingClientRect(),e)}else g2(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,s=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new gO(e.slice,e.move,s<0?void 0:we.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(s=n?n(a):a))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let a=i[o].props[e];if(a!=null&&(s=n?n(a):a))return s}}hasFocus(){return this.root.activeElement==this.dom}focus(){this.editable&&V4(this.dom),this.domSel.sync()}get root(){let e=this.dom.isConnected!==!1;e||(this._root=null);let n=this._root;if(n==null&&e){for(let r=this.dom.parentNode;r;r=r.parentNode)if(r.nodeType==9||r.nodeType==11&&r.host)return r.getSelection||(Object.getPrototypeOf(r).getSelection=()=>r.ownerDocument.getSelection()),this._root=r}return n||document}updateRoot(){this._root=null}posAtCoords(e){return DW(this,e)}coordsAtPos(e,n=1){return H4(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return VW(this,n||this.state,e)}pasteHTML(e,n){return cd(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return cd(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return X1(this,e)}destroy(){this.docView&&(xU(this),this.domSel.destroy(),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],rg(this),this,-1),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,SW())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return kU(this,e)}domSelection(){return this.root.getSelection()}}wO.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function V2(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[kr.node(0,t.state.doc.content.size,e)]}function W2(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:kr.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function U2(t){return!t.someProp("editable",e=>e(t.state)===!1)}function XU(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Z2(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function eZ(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function H2(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ri={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},yh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},tZ=typeof navigator<"u"&&/Mac/.test(navigator.platform),nZ=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Jt=0;Jt<10;Jt++)Ri[48+Jt]=Ri[96+Jt]=String(Jt);for(var Jt=1;Jt<=24;Jt++)Ri[Jt+111]="F"+Jt;for(var Jt=65;Jt<=90;Jt++)Ri[Jt]=String.fromCharCode(Jt+32),yh[Jt]=String.fromCharCode(Jt);for(var ig in Ri)yh.hasOwnProperty(ig)||(yh[ig]=Ri[ig]);function rZ(t){var e=tZ&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||nZ&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?yh:Ri)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const sZ=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),iZ=typeof navigator<"u"&&/Win/.test(navigator.platform);function oZ(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))sZ?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function aZ(t){let e=Object.create(null);for(let n in t)e[oZ(n)]=t[n];return e}function og(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function lZ(t){return new Pn({props:{handleKeyDown:cZ(t)}})}function cZ(t){let e=aZ(t);return function(n,r){let s=rZ(r),i,o=e[og(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let a=e[og(s,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(iZ&&r.ctrlKey&&r.altKey)&&(i=Ri[r.keyCode])&&i!=s){let a=e[og(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var dZ=Object.defineProperty,i0=(t,e)=>{for(var n in e)dZ(t,n,{get:e[n],enumerable:!0})};function Vp(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,i=n.storedMarks,n}}}var Wp=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:s}=n,i=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,a])=>[o,(...c)=>{const u=a(...c)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o=[],a=!!t,l=t||s.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(l),o.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(n).map(([f,h])=>[f,(...g)=>{const p=this.buildProps(l,e),x=h(...g)(p);return o.push(x),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,i=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:Vp({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)(o)]))}};return o}},bO={};i0(bO,{blur:()=>uZ,clearContent:()=>fZ,clearNodes:()=>hZ,command:()=>pZ,createParagraphNear:()=>mZ,cut:()=>gZ,deleteCurrentNode:()=>yZ,deleteNode:()=>xZ,deleteRange:()=>vZ,deleteSelection:()=>bZ,enter:()=>SZ,exitCode:()=>jZ,extendMarkRange:()=>CZ,first:()=>_Z,focus:()=>EZ,forEach:()=>$Z,insertContent:()=>MZ,insertContentAt:()=>OZ,insertDefaultBlock:()=>AZ,joinBackward:()=>PZ,joinDown:()=>IZ,joinForward:()=>DZ,joinItemBackward:()=>zZ,joinItemForward:()=>LZ,joinTextblockBackward:()=>FZ,joinTextblockForward:()=>BZ,joinUp:()=>RZ,keyboardShortcut:()=>WZ,lift:()=>UZ,liftEmptyBlock:()=>ZZ,liftListItem:()=>HZ,newlineInCode:()=>qZ,resetAttributes:()=>KZ,scrollIntoView:()=>JZ,selectAll:()=>GZ,selectNodeBackward:()=>YZ,selectNodeForward:()=>QZ,selectParentNode:()=>XZ,selectTextblockEnd:()=>eH,selectTextblockStart:()=>tH,setContent:()=>nH,setMark:()=>vH,setMeta:()=>kH,setNode:()=>wH,setNodeSelection:()=>bH,setTextDirection:()=>SH,setTextSelection:()=>jH,sinkListItem:()=>CH,splitBlock:()=>_H,splitListItem:()=>NH,toggleList:()=>$H,toggleMark:()=>MH,toggleNode:()=>TH,toggleWrap:()=>OH,undoInputRule:()=>AH,unsetAllMarks:()=>RH,unsetMark:()=>IH,unsetTextDirection:()=>PH,updateAttributes:()=>DH,wrapIn:()=>zH,wrapInList:()=>LH});var uZ=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),fZ=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),hZ=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,f=c.resolve(u.map(l)),h=c.resolve(u.map(l+a.nodeSize)),m=f.blockRange(h);if(!m)return;const g=Cl(m);if(a.type.isTextblock){const{defaultType:p}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(m.start,p)}(g||g===0)&&e.lift(m,g)})}),!0},pZ=t=>e=>t(e),mZ=()=>({state:t,dispatch:e})=>A4(t,e),gZ=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new _e(r.doc.resolve(Math.max(o-1,0)))),!0},yZ=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const a=s.before(i),l=s.after(i);t.delete(a,l).scrollIntoView()}return!0}return!1};function Vt(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var xZ=t=>({tr:e,state:n,dispatch:r})=>{const s=Vt(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const l=i.before(o),c=i.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},vZ=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},kZ=t=>t.content?/^text(\*|\+)/.test(t.content):!1,q2=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;const r=e.nodes[t.parent.type.name].spec;return kZ(r)?n==="left"?t.start()-1:t.end()+1:t.pos},wZ=(t,e,n)=>{const r=q2(t,n,"left"),s=q2(e,n,"right");return{from:r,to:s}},bZ=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){const n=t.tr,{ranges:r}=t.selection,s=n.steps.length;r.forEach(i=>{const o=n.mapping.slice(s),a=n.doc.resolve(o.map(i.$from.pos)),l=n.doc.resolve(o.map(i.$to.pos)),{from:c,to:u}=wZ(a,l,t.schema);n.deleteRange(c,u)}),n.selection.empty||n.setSelection(_e.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),e(n)}return!0},SZ=()=>({commands:t})=>t.keyboardShortcut("Enter"),jZ=()=>({state:t,dispatch:e})=>lW(t,e);function o0(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function xh(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:o0(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function SO(t,e,n={}){return t.find(r=>r.type===e&&xh(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function K2(t,e,n={}){return!!SO(t,e,n)}function a0(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===e))return;if(!n){const c=r.node.marks.find(u=>u.type===e);c&&(n=c.attrs)}if(!SO([...r.node.marks],e,n))return;let i=r.index,o=t.start()+r.offset,a=i+1,l=o+r.node.nodeSize;for(;i>0&&K2([...t.parent.child(i-1).marks],e,n);)i-=1,o-=t.parent.child(i).nodeSize;for(;a<t.parent.childCount&&K2([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:o,to:l}}function Ls(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var CZ=(t,e)=>({tr:n,state:r,dispatch:s})=>{const i=Ls(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:c,to:u}=a;if(s){const f=a0(l,i,e);if(f&&f.from<=c&&f.to>=u){const h=_e.create(o,f.from,f.to);n.setSelection(h)}}return!0},_Z=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function jO(t){return t instanceof _e}function to(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Ix(t,e=null){if(!e)return null;const n=Fe.atStart(t),r=Fe.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const s=n.from,i=r.to;return e==="all"?_e.create(t,to(0,s,i),to(t.content.size,s,i)):_e.create(t,to(e,s,i),to(e,s,i))}function J2(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function vh(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function NZ(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var EZ=(t=null,e={})=>({editor:n,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(vh()||J2())&&r.dom.focus(),NZ()&&!vh()&&!J2()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!jO(n.state.selection))return o(),!0;const a=Ix(s.doc,t)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||s.setSelection(a),l&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},$Z=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),MZ=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),CO=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&CO(r)}return t};function bu(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return CO(n)}function cl(t,e,n){if(t instanceof xi||t instanceof J)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return J.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),cl("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,a="";const l=new i4({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?vi.fromSchema(l).parseSlice(bu(t),n.parseOptions):vi.fromSchema(l).parse(bu(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=vi.fromSchema(e);return n.slice?i.parseSlice(bu(t),n.parseOptions).content:i.parse(bu(t),n.parseOptions)}return cl("",e,n)}function _O(t,e,n){const r=t.steps.length-1;if(r<e)return;const s=t.steps[r];if(!(s instanceof bt||s instanceof Ft))return;const i=t.mapping.maps[r];let o=0;i.forEach((a,l,c,u)=>{o===0&&(o=u)}),t.setSelection(Fe.near(t.doc.resolve(o),n))}var TZ=t=>!("type"in t),OZ=(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=x=>{i.emit("contentError",{editor:i,error:x,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{cl(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(x){l(x)}try{a=cl(e,i.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(x){return l(x),!1}let{from:u,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,m=!0;if((TZ(a)?a:[a]).forEach(x=>{x.check(),h=h?x.isText&&x.marks.length===0:!1,m=m?x.isBlock:!1}),u===f&&m){const{parent:x}=r.doc.resolve(u);x.isTextblock&&!x.type.spec.code&&!x.childCount&&(u-=1,f+=1)}let p;if(h){if(Array.isArray(e))p=e.map(x=>x.text||"").join("");else if(e instanceof J){let x="";e.forEach(y=>{y.text&&(x+=y.text)}),p=x}else typeof e=="object"&&e&&e.text?p=e.text:p=e;r.insertText(p,u,f)}else{p=a;const x=r.doc.resolve(u),y=x.node(),v=x.parentOffset===0,k=y.isText||y.isTextblock,w=y.content.size>0;v&&k&&w&&m&&(u=Math.max(0,u-1)),r.replaceWith(u,f,p)}n.updateSelection&&_O(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:p}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:p})}return!0};function NO(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var AZ=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{pos:s,attrs:i,content:o,updateSelection:a=!0}=t;let l;typeof s=="number"?l=e.doc.resolve(s):s?l=s:l=e.selection.$from;const c=NO(l.parent.contentMatchAt(l.index()));if(!c)return!1;const u=Object.keys(c.spec.attrs||{}),f=i?Object.fromEntries(Object.entries(i).filter(([m])=>u.includes(m))):{};let h;if(o){const m=cl(o,r.schema);h=c.createAndFill(f,m)}else h=c.createAndFill(f);return h?(n&&(e.insert(l.pos,h),a&&_O(e,e.steps.length-1,-1)),!0):!1},RZ=()=>({state:t,dispatch:e})=>iW(t,e),IZ=()=>({state:t,dispatch:e})=>oW(t,e),PZ=()=>({state:t,dispatch:e})=>_4(t,e),DZ=()=>({state:t,dispatch:e})=>M4(t,e),zZ=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Pp(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},LZ=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Pp(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},FZ=()=>({state:t,dispatch:e})=>rW(t,e),BZ=()=>({state:t,dispatch:e})=>sW(t,e);function EO(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function VZ(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))vh()||EO()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var WZ=t=>({editor:e,view:n,tr:r,dispatch:s})=>{const i=VZ(t).split(/-(?!$)/),o=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l==null||l.steps.forEach(c=>{const u=c.map(r.mapping);u&&s&&r.maybeStep(u)}),!0};function ud(t,e,n={}){const{from:r,to:s,empty:i}=t.selection,o=e?Vt(e,t.schema):null,a=[];t.doc.nodesBetween(r,s,(f,h)=>{if(f.isText)return;const m=Math.max(r,h),g=Math.min(s,h+f.nodeSize);a.push({node:f,from:m,to:g})});const l=s-r,c=a.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>xh(f.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((f,h)=>f+h.to-h.from,0)>=l}var UZ=(t,e={})=>({state:n,dispatch:r})=>{const s=Vt(t,n.schema);return ud(n,s,e)?aW(n,r):!1},ZZ=()=>({state:t,dispatch:e})=>R4(t,e),HZ=t=>({state:e,dispatch:n})=>{const r=Vt(t,e.schema);return vW(r)(e,n)},qZ=()=>({state:t,dispatch:e})=>O4(t,e);function Up(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function G2(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var KZ=(t,e)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=Up(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=Vt(t,r.schema)),a==="mark"&&(o=Ls(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,f)=>{i&&i===u.type&&(l=!0,s&&n.setNodeMarkup(f,void 0,G2(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(h=>{o===h.type&&(l=!0,s&&n.addMark(f,f+u.nodeSize,o.create(G2(h.attrs,e))))})})}),l},JZ=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),GZ=()=>({tr:t,dispatch:e})=>{if(e){const n=new Un(t.doc);t.setSelection(n)}return!0},YZ=()=>({state:t,dispatch:e})=>E4(t,e),QZ=()=>({state:t,dispatch:e})=>T4(t,e),XZ=()=>({state:t,dispatch:e})=>uW(t,e),eH=()=>({state:t,dispatch:e})=>pW(t,e),tH=()=>({state:t,dispatch:e})=>hW(t,e);function Px(t,e,n={},r={}){return cl(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var nH=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:a})=>{const{doc:l}=i;if(r.preserveWhitespace!=="full"){const c=Px(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&i.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function $O(t,e){const n=Ls(e,t.schema),{from:r,to:s,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function MO(t,e){const n=new w4(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function rH(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function sH(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function l0(t){return e=>sH(e.$from,t)}function ke(t,e,n){return t.config[e]===void 0&&t.parent?ke(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ke(t.parent,e,n):null}):t.config[e]}function c0(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=ke(e,"addExtensions",n);return r?[e,...c0(r())]:e}).flat(10)}function d0(t,e){const n=Fo.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function TO(t){return typeof t=="function"}function Xe(t,e=void 0,...n){return TO(t)?e?t.bind(e)(...n):t(...n):t}function iH(t={}){return Object.keys(t).length===0&&t.constructor===Object}function dl(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function OO(t){const e=[],{nodeExtensions:n,markExtensions:r}=dl(t),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(c=>c.name!=="text").map(c=>c.name),a=r.map(c=>c.name),l=[...o,...a];return t.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage,extensions:s},f=ke(c,"addGlobalAttributes",u);if(!f)return;f().forEach(m=>{let g;Array.isArray(m.types)?g=m.types:m.types==="*"?g=l:m.types==="nodes"?g=o:m.types==="marks"?g=a:g=[],g.forEach(p=>{Object.entries(m.attributes).forEach(([x,y])=>{e.push({type:p,name:x,attribute:{...i,...y}})})})})}),s.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage},f=ke(c,"addAttributes",u);if(!f)return;const h=f();Object.entries(h).forEach(([m,g])=>{const p={...i,...g};typeof(p==null?void 0:p.default)=="function"&&(p.default=p.default()),p!=null&&p.isRequired&&(p==null?void 0:p.default)===void 0&&delete p.default,e.push({type:c.name,name:m,attribute:p})})}),e}function oH(t){const e=[];let n="",r=!1,s=!1,i=0;const o=t.length;for(let a=0;a<o;a+=1){const l=t[a];if(l==="'"&&!s){r=!r,n+=l;continue}if(l==='"'&&!r){s=!s,n+=l;continue}if(!r&&!s){if(l==="("){i+=1,n+=l;continue}if(l===")"&&i>0){i-=1,n+=l;continue}if(l===";"&&i===0){e.push(n),n="";continue}}n+=l}return n&&e.push(n),e}function Y2(t){const e=[],n=oH(t||""),r=n.length;for(let s=0;s<r;s+=1){const i=n[s],o=i.indexOf(":");if(o===-1)continue;const a=i.slice(0,o).trim(),l=i.slice(o+1).trim();a&&l&&e.push([a,l])}return e}function Ii(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const a=i?String(i).split(" "):[],l=r[s]?r[s].split(" "):[],c=a.filter(u=>!l.includes(u));r[s]=[...l,...c].join(" ")}else if(s==="style"){const a=new Map([...Y2(r[s]),...Y2(i)]);r[s]=Array.from(a.entries()).map(([l,c])=>`${l}: ${c}`).join("; ")}else r[s]=i}),r},{})}function kh(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Ii(n,r),{})}function aH(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Q2(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const s=e.reduce((i,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):aH(n.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function X2(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&iH(n)?!1:n!=null))}function eS(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function lH(t,e){var n;const r=OO(t),{nodeExtensions:s,markExtensions:i}=dl(t),o=(n=s.find(c=>ke(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(s.map(c=>{const u=r.filter(y=>y.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((y,v)=>{const k=ke(v,"extendNodeSchema",f);return{...y,...k?k(c):{}}},{}),m=X2({...h,content:Xe(ke(c,"content",f)),marks:Xe(ke(c,"marks",f)),group:Xe(ke(c,"group",f)),inline:Xe(ke(c,"inline",f)),atom:Xe(ke(c,"atom",f)),selectable:Xe(ke(c,"selectable",f)),draggable:Xe(ke(c,"draggable",f)),code:Xe(ke(c,"code",f)),whitespace:Xe(ke(c,"whitespace",f)),linebreakReplacement:Xe(ke(c,"linebreakReplacement",f)),defining:Xe(ke(c,"defining",f)),isolating:Xe(ke(c,"isolating",f)),attrs:Object.fromEntries(u.map(eS))}),g=Xe(ke(c,"parseHTML",f));g&&(m.parseDOM=g.map(y=>Q2(y,u)));const p=ke(c,"renderHTML",f);p&&(m.toDOM=y=>p({node:y,HTMLAttributes:kh(y,u)}));const x=ke(c,"renderText",f);return x&&(m.toText=x),[c.name,m]})),l=Object.fromEntries(i.map(c=>{const u=r.filter(x=>x.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((x,y)=>{const v=ke(y,"extendMarkSchema",f);return{...x,...v?v(c):{}}},{}),m=X2({...h,inclusive:Xe(ke(c,"inclusive",f)),excludes:Xe(ke(c,"excludes",f)),group:Xe(ke(c,"group",f)),spanning:Xe(ke(c,"spanning",f)),code:Xe(ke(c,"code",f)),attrs:Object.fromEntries(u.map(eS))}),g=Xe(ke(c,"parseHTML",f));g&&(m.parseDOM=g.map(x=>Q2(x,u)));const p=ke(c,"renderHTML",f);return p&&(m.toDOM=x=>p({mark:x,HTMLAttributes:kh(x,u)})),[c.name,m]}));return new i4({topNode:o,nodes:a,marks:l})}function cH(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function kc(t){return t.sort((n,r)=>{const s=ke(n,"priority")||100,i=ke(r,"priority")||100;return s>i?-1:s<i?1:0})}function AO(t){const e=kc(c0(t)),n=cH(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function RO(t,e,n){const{from:r,to:s}=e,{blockSeparator:i=`
777
-
778
- `,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,s,(l,c,u,f)=>{var h;l.isBlock&&c>r&&(a+=i);const m=o==null?void 0:o[l.type.name];if(m)return u&&(a+=m({node:l,pos:c,parent:u,index:f,range:e})),!1;l.isText&&(a+=(h=l==null?void 0:l.text)==null?void 0:h.slice(Math.max(r,c)-c,s-c))}),a}function dH(t,e){const n={from:0,to:t.content.size};return RO(t,n,e)}function IO(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function uH(t,e){const n=Vt(e,t.schema),{from:r,to:s}=t.selection,i=[];t.doc.nodesBetween(r,s,a=>{i.push(a)});const o=i.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function PO(t,e){const n=Up(typeof e=="string"?e:e.name,t.schema);return n==="node"?uH(t,e):n==="mark"?$O(t,e):{}}function fH(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function hH(t){const e=fH(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function DO(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=n[i];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(i).map(a,-1),u=e.slice(i).map(l),f=e.invert().map(c,-1),h=e.invert().map(u);r.push({oldRange:{from:f,to:h},newRange:{from:c,to:u}})})}),hH(r)}function u0(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const i=n.resolve(t),o=a0(i,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,e,(s,i)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}function Vl(t,e){return e.nodes[t]||e.marks[t]||null}function Gu(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var pH=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,a)=>{var l,c;const u=((c=(l=s.type.spec).toText)==null?void 0:c.call(l,{node:s,pos:i,parent:o,index:a}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?u:u.slice(0,Math.max(0,r-i))}),n};function Dx(t,e,n={}){const{empty:r,ranges:s}=t.selection,i=e?Ls(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>xh(f.attrs,n,{strict:!1}));let o=0;const a=[];if(s.forEach(({$from:f,$to:h})=>{const m=f.pos,g=h.pos;t.doc.nodesBetween(m,g,(p,x)=>{if(i&&p.inlineContent&&!p.type.allowsMarkType(i))return!1;if(!p.isText&&!p.marks.length)return;const y=Math.max(m,x),v=Math.min(g,x+p.nodeSize),k=v-y;o+=k,a.push(...p.marks.map(w=>({mark:w,from:y,to:v})))})}),o===0)return!1;const l=a.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>xh(f.mark.attrs,n,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),c=a.filter(f=>i?f.mark.type!==i&&f.mark.type.excludes(i):!0).reduce((f,h)=>f+h.to-h.from,0);return(l>0?l+c:l)>=o}function mH(t,e,n={}){if(!e)return ud(t,null,n)||Dx(t,null,n);const r=Up(e,t.schema);return r==="node"?ud(t,e,n):r==="mark"?Dx(t,e,n):!1}function tS(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function ag(t,e){const{nodeExtensions:n}=dl(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=Xe(ke(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function f0(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(i=>{s!==!1&&(f0(i,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}var zO=class LO{constructor(e){this.position=e}static fromJSON(e){return new LO(e.position)}toJSON(){return{position:this.position}}};function gH(t,e){const n=e.mapping.mapResult(t.position);return{position:new zO(n.pos),mapResult:n}}function yH(t){return new zO(t)}function xH(t,e,n){var r;const{selection:s}=e;let i=null;if(jO(s)&&(i=s.$cursor),i){const a=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(c=>c.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(u,f,h)=>{if(c)return!1;if(u.isInline){const m=!h||h.type.allowsMarkType(n),g=!!n.isInSet(u.marks)||!u.marks.some(p=>p.type.excludes(n));c=m&&g}return!c}),c})}var vH=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:a}=i,l=Ls(t,r.schema);if(s)if(o){const c=$O(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,f=c.$to.pos;r.doc.nodesBetween(u,f,(h,m)=>{const g=Math.max(m,u),p=Math.min(m+h.nodeSize,f);h.marks.find(y=>y.type===l)?h.marks.forEach(y=>{l===y.type&&n.addMark(g,p,l.create({...y.attrs,...e}))}):n.addMark(g,p,l.create(e))})});return xH(r,n,l)},kH=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),wH=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const i=Vt(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:a})=>u2(i,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>u2(i,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},bH=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=to(t,0,r.content.size),i=we.create(r,s);e.setSelection(i)}return!0},SH=(t,e)=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=i.from,a=i.to),s&&n.doc.nodesBetween(o,a,(l,c)=>{l.isText||n.setNodeMarkup(c,void 0,{...l.attrs,dir:t})}),!0},jH=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:i}=typeof t=="number"?{from:t,to:t}:t,o=_e.atStart(r).from,a=_e.atEnd(r).to,l=to(s,o,a),c=to(i,o,a),u=_e.create(r,l,c);e.setSelection(u)}return!0},CH=t=>({state:e,dispatch:n})=>{const r=Vt(t,e.schema);return bW(r)(e,n)};function nS(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}var _H=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:a,$to:l}=i,c=s.extensionManager.attributes,u=Gu(c,a.node().type.name,a.node().attrs);if(i instanceof we&&i.node.isBlock)return!a.parentOffset||!Cs(o,a.pos)?!1:(r&&(t&&nS(n,s.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const f=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:NO(a.node(-1).contentMatchAt(a.indexAfter(-1)));let m=f&&h?[{type:h,attrs:u}]:void 0,g=Cs(e.doc,e.mapping.map(a.pos),1,m);if(!m&&!g&&Cs(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(g=!0,m=h?[{type:h,attrs:u}]:void 0),r){if(g&&(i instanceof _e&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,m),h&&!f&&!a.parentOffset&&a.parent.type!==h)){const p=e.mapping.map(a.before()),x=e.doc.resolve(p);a.node(-1).canReplaceWith(x.index(),x.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&nS(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return g},NH=(t,e={})=>({tr:n,state:r,dispatch:s,editor:i})=>{var o;const a=Vt(t,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const f=l.node(-1);if(f.type!==a)return!1;const h=i.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(s){let y=J.empty;const v=l.index(-1)?1:l.index(-2)?2:3;for(let S=l.depth-v;S>=l.depth-3;S-=1)y=J.from(l.node(S).copy(y));const k=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,w={...Gu(h,l.node().type.name,l.node().attrs),...e},j=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(w))||void 0;y=y.append(J.from(a.createAndFill(null,j)||void 0));const C=l.before(l.depth-(v-1));n.replace(C,l.after(-k),new ce(y,4-v,0));let E=-1;n.doc.nodesBetween(C,n.doc.content.size,(S,_)=>{if(E>-1)return!1;S.isTextblock&&S.content.size===0&&(E=_+1)}),E>-1&&n.setSelection(_e.near(n.doc.resolve(E))),n.scrollIntoView()}return!0}const m=c.pos===l.end()?f.contentMatchAt(0).defaultType:null,g={...Gu(h,f.type.name,f.attrs),...e},p={...Gu(h,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const x=m?[{type:a,attrs:g},{type:m,attrs:p}]:[{type:a,attrs:g}];if(!Cs(n.doc,l.pos,2))return!1;if(s){const{selection:y,storedMarks:v}=r,{splittableMarks:k}=i.extensionManager,w=v||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,x).scrollIntoView(),!w||!s)return!0;const j=w.filter(C=>k.includes(C.type.name));n.ensureMarks(j)}return!0};function rS(t){return!t||t==="1"?null:t}function FO(t,e){return rS(t)===rS(e)}var lg=(t,e)=>{const n=l0(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return!(n.node.type===(s==null?void 0:s.type)&&Bo(t.doc,n.pos))||!FO(n.node.attrs.type,s==null?void 0:s.attrs.type)||t.join(n.pos),!0},cg=(t,e)=>{const n=l0(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return!(n.node.type===(s==null?void 0:s.type)&&Bo(t.doc,r))||!FO(n.node.attrs.type,s==null?void 0:s.attrs.type)||t.join(r),!0};function EH(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),s=e.resolve(n.nodeSize-1);return _e.between(r,s)}var $H=(t,e,n,r={})=>({editor:s,tr:i,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:f,splittableMarks:h}=s.extensionManager,m=Vt(t,o.schema),g=Vt(e,o.schema),{selection:p,storedMarks:x}=o,{$from:y,$to:v}=p,k=y.blockRange(v),w=x||p.$to.parentOffset&&p.$from.marks();if(!k)return!1;const j=l0(V=>ag(V.type.name,f))(p),C=p.from===0&&p.to===o.doc.content.size,E=o.doc.content.content,S=E.length===1?E[0]:null,_=C&&S&&ag(S.type.name,f)?{node:S,pos:0}:null,N=j??_,M=!!j&&k.depth>=1&&k.depth-j.depth<=1,P=!!_;if((M||P)&&N){if(N.node.type===m)return C&&P?l().command(({tr:V,dispatch:Z})=>{const Y=EH(V);return Y?(V.setSelection(Y),Z&&Z(V),!0):!1}).liftListItem(g).run():c.liftListItem(g);if(ag(N.node.type.name,f)&&m.validContent(N.node.content))return l().command(()=>(i.setNodeMarkup(N.pos,m),!0)).command(()=>lg(i,m)).command(()=>cg(i,m)).run()}return!n||!w||!a?l().command(()=>u().wrapInList(m,r)?!0:c.clearNodes()).wrapInList(m,r).command(()=>lg(i,m)).command(()=>cg(i,m)).run():l().command(()=>{const V=u().wrapInList(m,r),Z=w.filter(Y=>h.includes(Y.type.name));return i.ensureMarks(Z),V?!0:c.clearNodes()}).wrapInList(m,r).command(()=>lg(i,m)).command(()=>cg(i,m)).run()},MH=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=Ls(t,r.schema);return Dx(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},TH=(t,e,n={})=>({state:r,commands:s})=>{const i=Vt(t,r.schema),o=Vt(e,r.schema),a=ud(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?s.setNode(o,l):s.setNode(i,{...l,...n})},OH=(t,e={})=>({state:n,commands:r})=>{const s=Vt(t,n.schema);return ud(n,s,e)?r.lift(s):r.wrapIn(s,e)},AH=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let i;if(s.spec.isInputRules&&(i=s.getState(t))){if(e){const o=t.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else o.delete(i.from,i.to)}return!0}}return!1},RH=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:s=!1}=t,{selection:i}=e,{empty:o,ranges:a}=i;if(o)return!0;const{nonClearableMarks:l}=r.extensionManager;if(n){const c=Object.values(r.schema.marks).filter(u=>s||!l.includes(u.name));a.forEach(u=>{for(const f of c)e.removeMark(u.$from.pos,u.$to.pos,f)})}return!0},IH=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=Ls(t,r.schema),{$from:c,empty:u,ranges:f}=a;if(!s)return!0;if(u&&o){let{from:h,to:m}=a;const g=(i=c.marks().find(x=>x.type===l))==null?void 0:i.attrs,p=a0(c,l,g);p&&(h=p.from,m=p.to),n.removeMark(h,m,l)}else f.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,l)});return n.removeStoredMark(l),!0},PH=t=>({tr:e,state:n,dispatch:r})=>{const{selection:s}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},DH=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=Up(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=Vt(t,r.schema)),a==="mark"&&(o=Ls(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{const u=c.$from.pos,f=c.$to.pos;let h,m,g,p;n.selection.empty?r.doc.nodesBetween(u,f,(x,y)=>{i&&i===x.type&&(l=!0,g=Math.max(y,u),p=Math.min(y+x.nodeSize,f),h=y,m=x)}):r.doc.nodesBetween(u,f,(x,y)=>{y<u&&i&&i===x.type&&(l=!0,g=Math.max(y,u),p=Math.min(y+x.nodeSize,f),h=y,m=x),y>=u&&y<=f&&(i&&i===x.type&&(l=!0,s&&n.setNodeMarkup(y,void 0,{...x.attrs,...e})),o&&x.marks.length&&x.marks.forEach(v=>{if(o===v.type&&(l=!0,s)){const k=Math.max(y,u),w=Math.min(y+x.nodeSize,f);n.addMark(k,w,o.create({...v.attrs,...e}))}}))}),m&&(h!==void 0&&s&&n.setNodeMarkup(h,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(x=>{o===x.type&&s&&n.addMark(g,p,o.create({...x.attrs,...e}))}))}),l},zH=(t,e={})=>({state:n,dispatch:r})=>{const s=Vt(t,n.schema);return mW(s,e)(n,r)},LH=(t,e={})=>({state:n,dispatch:r})=>{const s=Vt(t,n.schema);return gW(s,e)(n,r)},FH=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}};function BH(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}function VH(t){return typeof t=="number"}function WH(t){return Object.prototype.toString.call(t).slice(8,-1)}function Su(t){return WH(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}var UH={};i0(UH,{createAtomBlockMarkdownSpec:()=>ZH,createBlockMarkdownSpec:()=>HH,createInlineMarkdownSpec:()=>JH,parseAttributes:()=>h0,parseIndentedBlocks:()=>GH,renderNestedMarkdownContent:()=>YH,serializeAttributes:()=>p0});function h0(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([\w-]+)/g);if(s){const c=s.map(u=>u.trim().slice(1));e.class=c.join(" ")}const i=r.match(/(?:^|\s)#([\w-]+)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,u])=>{var f;const h=parseInt(((f=u.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),m=n[h];m&&(e[c]=m.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([\w-]+)/g,"").replace(/(?:^|\s)#([\w-]+)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function p0(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function ZH(t){const{nodeName:e,name:n,parseAttributes:r=h0,serializeAttributes:s=p0,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:a}=t,l=n||e,c=u=>{if(!a)return u;const f={};return a.forEach(h=>{h in u&&(f[h]=u[h])}),f};return{parseMarkdown:(u,f)=>{const h={...i,...u.attributes};return f.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(u){var f;const h=new RegExp(`^:::${l}(?:\\s|$)`,"m"),m=(f=u.match(h))==null?void 0:f.index;return m!==void 0?m:-1},tokenize(u,f,h){const m=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),g=u.match(m);if(!g)return;const p=g[1]||"",x=r(p);if(!o.find(v=>!(v in x)))return{type:e,raw:g[0],attributes:x}}},renderMarkdown:u=>{const f=c(u.attrs||{}),h=s(f),m=h?` {${h}}`:"";return`:::${l}${m} :::`}}}function HH(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=h0,serializeAttributes:i=p0,defaultAttributes:o={},content:a="block",allowedAttributes:l}=t,c=n||e,u=f=>{if(!l)return f;const h={};return l.forEach(m=>{m in f&&(h[m]=f[m])}),h};return{parseMarkdown:(f,h)=>{let m;if(r){const p=r(f);m=typeof p=="string"?[{type:"text",text:p}]:p}else a==="block"?m=h.parseChildren(f.tokens||[]):m=h.parseInline(f.tokens||[]);const g={...o,...f.attributes};return h.createNode(e,g,m)},markdownTokenizer:{name:e,level:"block",start(f){var h;const m=new RegExp(`^:::${c}`,"m"),g=(h=f.match(m))==null?void 0:h.index;return g!==void 0?g:-1},tokenize(f,h,m){var g;const p=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),x=f.match(p);if(!x)return;const[y,v=""]=x,k=s(v);let w=1;const j=y.length;let C="";const E=/^:::([\w-]*)(\s.*)?/gm,S=f.slice(j);for(E.lastIndex=0;;){const _=E.exec(S);if(_===null)break;const N=_.index,M=_[1];if(!((g=_[2])!=null&&g.endsWith(":::"))){if(M)w+=1;else if(w-=1,w===0){const P=S.slice(0,N);C=P.trim();const V=f.slice(0,j+N+_[0].length);let Z=[];if(C)if(a==="block")for(Z=m.blockTokens(P),Z.forEach(Y=>{Y.text&&(!Y.tokens||Y.tokens.length===0)&&(Y.tokens=m.inlineTokens(Y.text))});Z.length>0;){const Y=Z[Z.length-1];if(Y.type==="paragraph"&&(!Y.text||Y.text.trim()===""))Z.pop();else break}else Z=m.inlineTokens(C);return{type:e,raw:V,attributes:k,content:C,tokens:Z}}}}}},renderMarkdown:(f,h)=>{const m=u(f.attrs||{}),g=i(m),p=g?` {${g}}`:"",x=h.renderChildren(f.content||[],`
779
-
780
- `);return`:::${c}${p}
781
-
782
- ${x}
783
-
784
- :::`}}}function qH(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,i,o]=r;e[s]=i||o,r=n.exec(t)}return e}function KH(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function JH(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=qH,serializeAttributes:i=KH,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=t,c=n||e,u=h=>{if(!l)return h;const m={};return l.forEach(g=>{const p=typeof g=="string"?g:g.name,x=typeof g=="string"?void 0:g.skipIfDefault;if(p in h){const y=h[p];if(x!==void 0&&y===x)return;m[p]=y}}),m},f=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,m)=>{const g={...o,...h.attributes};if(a)return m.createNode(e,g);const p=r?r(h):h.content||"";return p?m.createNode(e,g,[m.createTextNode(p)]):m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"inline",start(h){const m=a?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),g=h.match(m),p=g==null?void 0:g.index;return p!==void 0?p:-1},tokenize(h,m,g){const p=a?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),x=h.match(p);if(!x)return;let y="",v="";if(a){const[,w]=x;v=w}else{const[,w,j]=x;v=w,y=j||""}const k=s(v.trim());return{type:e,raw:x[0],content:y.trim(),attributes:k}}},renderMarkdown:h=>{let m="";r?m=r(h):h.content&&h.content.length>0&&(m=h.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const g=u(h.attrs||{}),p=i(g),x=p?` ${p}`:"";return a?`[${c}${x}]`:`[${c}${x}]${m}[/${c}]`}}}function GH(t,e,n){var r,s,i,o;const a=t.split(`
785
- `),l=[];let c="",u=0;const f=e.baseIndentSize||2;for(;u<a.length;){const h=a[u],m=h.match(e.itemPattern);if(!m){if(l.length>0)break;if(h.trim()===""){u+=1,c=`${c}${h}
786
- `;continue}else return}const g=e.extractItemData(m),{indentLevel:p,mainContent:x}=g;c=`${c}${h}
787
- `;const y=[x];for(u+=1;u<a.length;){const j=a[u];if(j.trim()===""){const E=a.slice(u+1).findIndex(N=>N.trim()!=="");if(E===-1)break;if((((s=(r=a[u+1+E].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>p){y.push(j),c=`${c}${j}
788
- `,u+=1;continue}else break}if((((o=(i=j.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>p)y.push(j),c=`${c}${j}
789
- `,u+=1;else break}let v;const k=y.slice(1);if(k.length>0){const j=k.map(C=>C.slice(p+f)).join(`
790
- `);j.trim()&&(e.customNestedParser?v=e.customNestedParser(j):v=n.blockTokens(j))}const w=e.createToken(g,v);l.push(w)}if(l.length!==0)return{items:l,raw:c}}function YH(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[i,...o]=t.content,a=e.renderChildren([i]);let l=`${s}${a}`;return o&&o.length>0&&o.forEach((c,u)=>{var f,h;const m=(h=(f=e.renderChild)==null?void 0:f.call(e,c,u+1))!=null?h:e.renderChildren([c]);if(m!=null){const g=m.split(`
791
- `).map(p=>p?e.indent(p):e.indent("")).join(`
792
- `);l+=c.type==="paragraph"?`
793
-
794
- ${g}`:`
795
- ${g}`}}),l}function BO(t,e){const n={...t};return Su(t)&&Su(e)&&Object.keys(e).forEach(r=>{Su(e[r])&&Su(t[r])?n[r]=BO(t[r],e[r]):n[r]=e[r]}),n}function QH(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((a,l)=>{const c=i.mapping.map(l),u=i.mapping.map(l)+a.nodeSize;let f=null;if(a.marks.forEach(m=>{if(m!==o)return!1;f=m}),!f)return;let h=!1;if(Object.keys(n).forEach(m=>{n[m]!==f.attrs[m]&&(h=!0)}),h){const m=t.type.create({...t.attrs,...n});i.removeMark(c,u,t.type),i.addMark(c,u,m)}}),i.docChanged&&e.view.dispatch(i)}var VO=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},XH=(t,e)=>{if(o0(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function ju(t){var e;const{editor:n,from:r,to:s,text:i,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const f=pH(c)+i;return o.forEach(h=>{if(u)return;const m=XH(f,h.find);if(!m)return;const g=m[0].length-i.length;if(g>0){const C=c.parentOffset-g;if(C<0||c.parent.textBetween(C,c.parentOffset)!==m[0].slice(0,g))return}const p=l.state.tr,x=Vp({state:l.state,transaction:p}),y={from:r-(m[0].length-i.length),to:s},{commands:v,chain:k,can:w}=new Wp({editor:n,state:x});h.handler({state:x,range:y,match:m,commands:v,chain:k,can:w})===null||!p.steps.length||(h.undoable&&p.setMeta(a,{transform:p,from:r,to:s,text:i}),l.dispatch(p),u=!0)}),u}function eq(t){const{editor:e,rules:n}=t,r=new Pn({state:{init(){return null},apply(s,i,o){const a=s.getMeta(r);if(a)return a;const l=s.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=d0(J.from(u),o.schema);const{from:f}=l,h=f+u.length;ju({editor:e,from:f,to:h,text:u,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,a){return ju({editor:e,from:i,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&ju({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?ju({editor:e,from:o.pos,to:o.pos,text:`
796
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var m0=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Xe(ke(this,"addOptions",{name:this.name}))}}get storage(){return{...Xe(ke(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>BO(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Vd=class WO extends m0{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new WO(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const l=o.find(c=>(c==null?void 0:c.type.name)===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},UO=class{constructor(t){this.find=t.find,this.handler=t.handler}},tq=(t,e,n)=>{if(o0(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=t,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function nq(t){const{editor:e,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:c,can:u}=new Wp({editor:e,state:n}),f=[];return n.doc.nodesBetween(r,s,(m,g)=>{var p,x,y,v,k;if((x=(p=m.type)==null?void 0:p.spec)!=null&&x.code||!(m.isText||m.isTextblock||m.isInline))return;const w=(k=(v=(y=m.content)==null?void 0:y.size)!=null?v:m.nodeSize)!=null?k:0,j=Math.max(r,g),C=Math.min(s,g+w);if(j>=C)return;const E=m.isText?m.text||"":m.textBetween(j-g,C-g,void 0,"");tq(E,i.find,o).forEach(_=>{if(_.index===void 0)return;const N=j+_.index+1,M=N+_[0].length,P={from:n.tr.mapping.map(N),to:n.tr.mapping.map(M)},V=i.handler({state:n,range:P,match:_,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});f.push(V)})}),f.every(m=>m!==null)}var Cu=null,rq=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function sq(t){const{editor:e,rules:n}=t;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:f,to:h,rule:m,pasteEvt:g})=>{const p=u.tr,x=Vp({state:u,transaction:p});if(!(!nq({editor:e,state:x,from:Math.max(f-1,0),to:h.b-1,rule:m,pasteEvent:g,dropEvent:a})||!p.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,p}};return n.map(u=>new Pn({view(f){const h=g=>{var p;r=(p=f.dom.parentElement)!=null&&p.contains(g.target)?f.dom.parentElement:null,r&&(Cu=e)},m=()=>{Cu&&(Cu=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",m),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",m)}}},props:{handleDOMEvents:{drop:(f,h)=>{if(i=r===f.dom.parentElement,a=h,!i){const m=Cu;m!=null&&m.isEditable&&setTimeout(()=>{const g=m.state.selection;g&&m.commands.deleteRange({from:g.from,to:g.to})},10)}return!1},paste:(f,h)=>{var m;const g=(m=h.clipboardData)==null?void 0:m.getData("text/html");return o=h,s=!!(g!=null&&g.includes("data-pm-slice")),!1}}},appendTransaction:(f,h,m)=>{const g=f[0],p=g.getMeta("uiEvent")==="paste"&&!s,x=g.getMeta("uiEvent")==="drop"&&!i,y=g.getMeta("applyPasteRules"),v=!!y;if(!p&&!x&&!v)return;if(v){let{text:j}=y;typeof j=="string"?j=j:j=d0(J.from(j),m.schema);const{from:C}=y,E=C+j.length,S=rq(j);return l({rule:u,state:m,from:C,to:{b:E},pasteEvt:S})}const k=h.doc.content.findDiffStart(m.doc.content),w=h.doc.content.findDiffEnd(m.doc.content);if(!(!VH(k)||!w||k===w.b))return l({rule:u,state:m,from:k,to:w,pasteEvt:o})}}))}var Zp=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=AO(t),this.schema=lH(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Vl(e.name,this.schema)},r=ke(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return kc([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Vl(r.name,this.schema)},i=[],o=ke(r,"addKeyboardShortcuts",s);let a={};if(r.type==="mark"&&ke(r,"exitable",s)&&(a.ArrowRight=()=>Vd.handleExit({editor:t,mark:r})),o){const h=Object.fromEntries(Object.entries(o()).map(([m,g])=>[m,()=>g({editor:t})]));a={...a,...h}}const l=lZ(a);i.push(l);const c=ke(r,"addInputRules",s);if(tS(r,t.options.enableInputRules)&&c){const h=c();if(h&&h.length){const m=eq({editor:t,rules:h}),g=Array.isArray(m)?m:[m];i.push(...g)}}const u=ke(r,"addPasteRules",s);if(tS(r,t.options.enablePasteRules)&&u){const h=u();if(h&&h.length){const m=sq({editor:t,rules:h});i.push(...m)}}const f=ke(r,"addProseMirrorPlugins",s);if(f){const h=f();i.push(...h)}return i})}get attributes(){return OO(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=dl(this.extensions);return Object.fromEntries(e.filter(n=>!!ke(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Vt(n.name,this.schema)},i=ke(n,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const a=(l,c,u,f,h)=>{const m=kh(l,r);return o({node:l,view:c,getPos:u,decorations:f,innerDecorations:h,editor:t,extension:n,HTMLAttributes:m})};return[n.name,a]}))}dispatchTransaction(t){const{editor:e}=this;return kc([...this.extensions].reverse()).reduceRight((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Vl(s.name,this.schema)},o=ke(s,"dispatchTransaction",i);return o?a=>{o.call(i,{transaction:a,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return kc([...this.extensions]).reduce((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Vl(s.name,this.schema)},o=ke(s,"transformPastedHTML",i);return o?(a,l)=>{const c=r(a,l);return o.call(i,c)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=dl(this.extensions);return Object.fromEntries(e.filter(n=>!!ke(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ls(n.name,this.schema)},i=ke(n,"addMarkView",s);if(!i)return[];const o=(a,l,c)=>{const u=kh(a,r);return i()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:f=>{QH(a,t,f)}})};return[n.name,o]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){const n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n,r;const s={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Vl(e.name,this.schema)};e.type==="mark"&&(((n=Xe(ke(e,"keepOnSplit",s)))==null||n)&&this.splittableMarks.push(e.name),(r=Xe(ke(e,"clearable",s)))==null||r||this.nonClearableMarks.push(e.name));const i=ke(e,"onBeforeCreate",s),o=ke(e,"onCreate",s),a=ke(e,"onUpdate",s),l=ke(e,"onSelectionUpdate",s),c=ke(e,"onTransaction",s),u=ke(e,"onFocus",s),f=ke(e,"onBlur",s),h=ke(e,"onDestroy",s);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),a&&this.editor.on("update",a),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),u&&this.editor.on("focus",u),f&&this.editor.on("blur",f),h&&this.editor.on("destroy",h)})}};Zp.resolve=AO;Zp.sort=kc;Zp.flatten=c0;var iq={};i0(iq,{ClipboardTextSerializer:()=>HO,Commands:()=>qO,Delete:()=>KO,Drop:()=>JO,Editable:()=>GO,FocusEvents:()=>QO,Keymap:()=>XO,Paste:()=>eA,Tabindex:()=>tA,TextDirection:()=>nA,focusEventsPluginKey:()=>YO});var rs=class ZO extends m0{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new ZO(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},HO=rs.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Pn({key:new Or("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,i=IO(n),{blockSeparator:o}=this.options,a={...o!==void 0?{blockSeparator:o}:{},textSerializers:i};return[...s.ranges].sort((c,u)=>c.$from.pos-u.$from.pos).map(({$from:c,$to:u})=>RO(r,{from:c.pos,to:u.pos},a)).join(o??`
797
-
798
- `)}}})]}}),qO=rs.create({name:"commands",addCommands(){return{...bO}}}),KO=rs.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const i=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?c:t.getMeta("y-sync$"))return;const u=MO(t.before,[t,...e]);DO(u).forEach(m=>{u.mapping.mapResult(m.oldRange.from).deletedAfter&&u.mapping.mapResult(m.oldRange.to).deletedBefore&&u.before.nodesBetween(m.oldRange.from,m.oldRange.to,(g,p)=>{const x=p+g.nodeSize-2,y=m.oldRange.from<=p&&x<=m.oldRange.to;this.editor.emit("delete",{type:"node",node:g,from:p,to:x,newFrom:u.mapping.map(p),newTo:u.mapping.map(x),deletedRange:m.oldRange,newRange:m.newRange,partial:!y,editor:this.editor,transaction:t,combinedTransform:u})})});const h=u.mapping;u.steps.forEach((m,g)=>{var p,x;if(m instanceof Zr){const y=h.slice(g).map(m.from,-1),v=h.slice(g).map(m.to),k=h.invert().map(y,-1),w=h.invert().map(v),j=y>0?(p=u.doc.nodeAt(y-1))==null?void 0:p.marks.some(E=>E.eq(m.mark)):!1,C=(x=u.doc.nodeAt(v))==null?void 0:x.marks.some(E=>E.eq(m.mark));this.editor.emit("delete",{type:"mark",mark:m.mark,from:m.from,to:m.to,deletedRange:{from:k,to:w},newRange:{from:y,to:v},partial:!!(C||j),editor:this.editor,transaction:t,combinedTransform:u})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),JO=rs.create({name:"drop",addProseMirrorPlugins(){return[new Pn({key:new Or("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),GO=rs.create({name:"editable",addProseMirrorPlugins(){return[new Pn({key:new Or("editable"),props:{editable:()=>this.editor.options.editable}})]}}),YO=new Or("focusEvents"),QO=rs.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Pn({key:YO,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),XO=rs.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:f}=l,{pos:h,parent:m}=f,g=f.parent.isTextblock&&h>0?a.doc.resolve(h-1):f,p=g.parent.type.spec.isolating,x=f.pos-f.parentOffset,y=p&&g.parent.childCount===1?x===f.pos:Fe.atStart(c).from===h;return!u||!m.type.isTextblock||m.textContent.length||!y||y&&f.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return vh()||EO()?i:s},addProseMirrorPlugins(){return[new Pn({key:new Or("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(p=>p.getMeta("composition")))return;const r=t.some(p=>p.docChanged)&&!e.doc.eq(n.doc),s=t.some(p=>p.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:a}=e.selection,l=Fe.atStart(e.doc).from,c=Fe.atEnd(e.doc).to;if(i||!(o===l&&a===c)||!f0(n.doc))return;const h=n.tr,m=Vp({state:n,transaction:h}),{commands:g}=new Wp({editor:this.editor,state:m});if(g.clearNodes(),!!h.steps.length)return h}})]}}),eA=rs.create({name:"paste",addProseMirrorPlugins(){return[new Pn({key:new Or("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),tA=rs.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Pn({key:new Or("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),nA=rs.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=dl(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Pn({key:new Or("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),oq=class nc{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new nc(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new nc(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new nc(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!s&&!o&&l.depth<=this.depth)return;const c=new nc(l,this.editor,s,s||o?n:null);s&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(i[l]!==n[l])break}}else r=s;s=s.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(n);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(l=>n[l]===o.node.attrs[l])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},aq=`.ProseMirror {
799
- position: relative;
800
- }
801
-
802
- .ProseMirror {
803
- word-wrap: break-word;
804
- white-space: pre-wrap;
805
- white-space: break-spaces;
806
- -webkit-font-variant-ligatures: none;
807
- font-variant-ligatures: none;
808
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
809
- }
810
-
811
- .ProseMirror [contenteditable="false"] {
812
- white-space: normal;
813
- }
814
-
815
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
816
- white-space: pre-wrap;
817
- }
818
-
819
- .ProseMirror pre {
820
- white-space: pre-wrap;
821
- }
822
-
823
- img.ProseMirror-separator {
824
- display: inline !important;
825
- border: none !important;
826
- margin: 0 !important;
827
- width: 0 !important;
828
- height: 0 !important;
829
- }
830
-
831
- .ProseMirror-gapcursor {
832
- display: none;
833
- pointer-events: none;
834
- position: absolute;
835
- margin: 0;
836
- }
837
-
838
- .ProseMirror-gapcursor:after {
839
- content: "";
840
- display: block;
841
- position: absolute;
842
- top: -2px;
843
- width: 20px;
844
- border-top: 1px solid black;
845
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
846
- }
847
-
848
- @keyframes ProseMirror-cursor-blink {
849
- to {
850
- visibility: hidden;
851
- }
852
- }
853
-
854
- .ProseMirror-hideselection *::selection {
855
- background: transparent;
856
- }
857
-
858
- .ProseMirror-hideselection *::-moz-selection {
859
- background: transparent;
860
- }
861
-
862
- .ProseMirror-hideselection * {
863
- caret-color: transparent;
864
- }
865
-
866
- .ProseMirror-focused .ProseMirror-gapcursor {
867
- display: block;
868
- }`,lq=class extends FH{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:gH,createMappablePosition:yH},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:s})=>this.options.onDrop(n,r,s)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);const e=this.createDoc();if(!this.editorState){const n=Ix(e,this.options.autofocus);this.editorState=Xi.create({doc:e,schema:this.schema,selection:n||void 0})}this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=BH(aq,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=TO(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e,n,r;const i=[...this.options.enableCoreExtensions?[GO,HO.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),qO,QO,XO,tA.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),JO,eA,KO,nA.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new Zp(i,this)}createCommandManager(){this.commandManager=new Wp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Px(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;const n=Px(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=Xi.create({doc:n,schema:this.schema,selection:Ix(n,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new wO(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:s,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o==null?void 0:o.getMeta("focus"),l=o==null?void 0:o.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return PO(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return mH(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return d0(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
869
-
870
- `,textSerializers:n={}}=t||{};return dH(this.state.doc,{blockSeparator:e,textSerializers:{...IO(this.schema),...n}})}get isEmpty(){return f0(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new oq(e,this,!1,n)}get $doc(){return this.$pos(0)}};function ul(t){return new VO({find:t.find,handler:({state:e,range:n,match:r})=>{const s=Xe(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=n.from+a.indexOf(o),u=c+o.length;if(u0(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(p=>p===t.type&&p!==m.mark.type)).filter(m=>m.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+l,c);const h=n.from+l+o.length;i.addMark(n.from+l,h,t.type.create(s||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}var Hp=class rA extends m0{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new rA(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Ro(t){return new UO({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const i=Xe(t.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),f=n.from+l.indexOf(a),h=f+a.length;if(u0(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(y=>y===t.type&&y!==p.mark.type)).filter(p=>p.to>f).length)return null;h<n.to&&o.delete(h,n.to),f>n.from&&o.delete(n.from+u,f),c=n.from+u+a.length,o.addMark(n.from+u,c,t.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:cq,getOwnPropertySymbols:dq}=Object,{hasOwnProperty:uq}=Object.prototype;function dg(t,e){return function(r,s,i){return t(r,s,i)&&e(r,s,i)}}function Wl(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:i}=s,o=i.get(n),a=i.get(r);if(o&&a)return o===r&&a===n;i.set(n,r),i.set(r,n);const l=t(n,r,s);return i.delete(n),i.delete(r),l}}function fq(t){return t!=null?t[Symbol.toStringTag]:void 0}function sS(t){return cq(t).concat(dq(t))}const hq=Object.hasOwn||((t,e)=>uq.call(t,e));function Vo(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const pq="__v",mq="__o",gq="_owner",yq=64,{getOwnPropertyDescriptor:zx,keys:wh}=Object,{propertyIsEnumerable:Yu}=Object.prototype,xq=zx(Object.getPrototypeOf(Int8Array.prototype),Symbol.toStringTag).get;function vq(t,e){return t.byteLength===e.byteLength&&bh(new Uint8Array(t),new Uint8Array(e))}function kq(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function wq(t,e){return t.byteLength===e.byteLength&&bh(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function bq(t,e){return Vo(t.getTime(),e.getTime())}function Sq(t,e,n){if(t.name!==e.name||t.message!==e.message||t.stack!==e.stack)return!1;const r=t.cause,s=e.cause;if(r!==s&&!n.equals(r,s,"cause","cause",t,e,n))return!1;const i=t.errors,o=e.errors;if(i!==o&&!n.equals(i,o,"errors","errors",t,e,n))return!1;const a=wh(t),l=wh(e);let c=a.length;if(!c&&!l.length)return!0;let u=0,f;for(;c-- >0;)if(f=a[c],!(f==="cause"||f==="errors")){if(f!==l[c]&&!Yu.call(e,f)||!n.equals(t[f],e[f],f,f,t,e,n))return!1;++u}const h=l.length-u;return!h||h===(Yu.call(e,"cause")?1:0)+(Yu.call(e,"errors")?1:0)}function jq(t,e){return t===e}function Cq(t,e,n){return t.name===e.name&&t.message===e.message&&t.stack===e.stack&&oa(t,e,n)}function iS(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.entries();let o,a,l=0;for(;(o=i.next())&&!o.done;){const c=e.entries();let u=!1,f=0;for(;(a=c.next())&&!a.done;){if(s[f]){f++;continue}const h=o.value,m=a.value;if(n.equals(h[0],m[0],l,f,t,e,n)&&n.equals(h[1],m[1],h[0],m[0],t,e,n)){u=s[f]=!0;break}f++}if(!u)return!1;l++}return!0}const _q=Vo;function Nq(t,e,n){const r=wh(t),s=wh(e);let i=r.length;if(s.length!==i)return!1;const o=i<=yq;let a;for(;i-- >0;)if(a=r[i],!sA(t,e,a)&&(a!==s[i]&&!(o?s.includes(a):Yu.call(e,a))||!n.equals(t[a],e[a],a,a,t,e,n)))return!1;return!0}function oa(t,e,n){const r=sS(t);let s=r.length;if(sS(e).length!==s)return!1;let i,o,a;for(;s-- >0;)if(i=r[s],!sA(t,e,i)&&(!hq(e,i)||!n.equals(t[i],e[i],i,i,t,e,n))||(o=zx(t,i),a=zx(e,i),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function Eq(t,e){return Vo(t.valueOf(),e.valueOf())}function $q(t,e){return t.source===e.source&&t.flags===e.flags}function oS(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.values();let o,a;for(;(o=i.next())&&!o.done;){const l=e.values();let c=!1,u=0;for(;(a=l.next())&&!a.done;){if(!s[u]&&n.equals(o.value,a.value,o.value,a.value,t,e,n)){c=s[u]=!0;break}u++}if(!c)return!1}return!0}function bh(t,e){let n=t.length;if(e.length!==n||t.byteOffset!==e.byteOffset)return!1;const r=xq.call(t);if(r==="Float64Array"||r==="Float32Array"||r==="Float16Array"){for(;n-- >0;)if(t[n]!==e[n]&&(t[n]===t[n]||e[n]===e[n]))return!1;return!0}for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function Mq(t,e){return t.href===e.href?!0:t.protocol===e.protocol&&t.username===e.username&&t.password===e.password&&t.host===e.host&&t.pathname===e.pathname&&t.hash===e.hash&&Tq(t.searchParams,e.searchParams)}function Tq(t,e){const n=t.toString(),r=e.toString();return n===r||aS(n)===aS(r)}function aS(t){return t.split("&").sort().join("&")}function sA(t,e,n){return(n===gq||n===mq||n===pq)&&!!(t.$$typeof||e.$$typeof)}const Oq="[object ArrayBuffer]",Aq="[object Arguments]",Rq="[object Boolean]",Iq="[object DataView]",Pq="[object Date]",Dq="[object Error]",zq="[object Map]",Lq="[object Number]",Fq="[object Object]",Bq="[object RegExp]",Vq="[object Set]",Wq="[object String]",Uq={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Zq="[object URL]",Hq=Object.prototype.toString;function qq({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:f,areTypedArraysEqual:h,areUrlsEqual:m,unknownTagComparators:g}){return function(x,y,v){if(x===y)return!0;if(x==null||y==null)return!1;const k=typeof x;if(k!==typeof y)return!1;if(k!=="object")return k==="number"?a(x,y,v):k==="function"?i(x,y,v):!1;const w=x.constructor;if(w!==y.constructor)return!1;if(w===Object)return l(x,y,v);if(Array.isArray(x))return e(x,y,v);if(w===Date)return r(x,y,v);if(w===RegExp)return u(x,y,v);if(w===Map)return o(x,y,v);if(w===Set)return f(x,y,v);if(w==null)return l(x,y,v);const j=Hq.call(x);if(j===Pq)return r(x,y,v);if(j===Bq)return u(x,y,v);if(j===zq)return o(x,y,v);if(j===Vq)return f(x,y,v);if(j===Fq)return typeof x.then!="function"&&typeof y.then!="function"&&l(x,y,v);if(j===Zq)return m(x,y,v);if(j===Dq)return s(x,y,v);if(j===Aq)return l(x,y,v);if(Uq[j])return h(x,y,v);if(j===Oq)return t(x,y,v);if(j===Iq)return n(x,y,v);if(j===Rq||j===Lq||j===Wq)return c(x,y,v);if(g){let C=g[j];if(!C){const E=fq(x);E&&(C=g[E])}if(C)return C(x,y,v)}return!1}}function Kq({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:vq,areArraysEqual:n?oa:kq,areDataViewsEqual:wq,areDatesEqual:bq,areErrorsEqual:n?Cq:Sq,areFunctionsEqual:jq,areMapsEqual:n?dg(iS,oa):iS,areNumbersEqual:_q,areObjectsEqual:n?oa:Nq,arePrimitiveWrappersEqual:Eq,areRegExpsEqual:$q,areSetsEqual:n?dg(oS,oa):oS,areTypedArraysEqual:n?dg(bh,oa):bh,areUrlsEqual:Mq,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=Wl(r.areArraysEqual),i=Wl(r.areErrorsEqual),o=Wl(r.areMapsEqual),a=Wl(r.areObjectsEqual),l=Wl(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areErrorsEqual:i,areMapsEqual:o,areObjectsEqual:a,areSetsEqual:l})}return r}function Jq(t){return function(e,n,r,s,i,o,a){return t(e,n,a)}}function Gq({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(a,l){const{cache:c=t?new WeakMap:void 0,meta:u}=n();return e(a,l,{cache:c,equals:r,meta:u,strict:s})};if(t)return function(a,l){return e(a,l,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(a,l){return e(a,l,i)}}const Yq=Fi();Fi({strict:!0});Fi({circular:!0});Fi({circular:!0,strict:!0});Fi({createInternalComparator:()=>Vo});Fi({strict:!0,createInternalComparator:()=>Vo});Fi({circular:!0,createInternalComparator:()=>Vo});Fi({circular:!0,createInternalComparator:()=>Vo,strict:!0});function Fi(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,i=Kq(t),o=qq(i),a=n?n(o):Jq(o);return Gq({circular:e,comparator:o,createState:r,equals:a,strict:s})}var iA={exports:{}},oA={};/**
871
- * @license React
872
- * use-sync-external-store-shim/with-selector.production.js
873
- *
874
- * Copyright (c) Meta Platforms, Inc. and affiliates.
875
- *
876
- * This source code is licensed under the MIT license found in the
877
- * LICENSE file in the root directory of this source tree.
878
- */var qp=b,Qq=B1;function Xq(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var eK=typeof Object.is=="function"?Object.is:Xq,tK=Qq.useSyncExternalStore,nK=qp.useRef,rK=qp.useEffect,sK=qp.useMemo,iK=qp.useDebugValue;oA.useSyncExternalStoreWithSelector=function(t,e,n,r,s){var i=nK(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=sK(function(){function l(m){if(!c){if(c=!0,u=m,m=r(m),s!==void 0&&o.hasValue){var g=o.value;if(s(g,m))return f=g}return f=m}if(g=f,eK(u,m))return g;var p=r(m);return s!==void 0&&s(g,p)?(u=m,g):(u=m,f=p)}var c=!1,u,f,h=n===void 0?null:n;return[function(){return l(e())},h===null?void 0:function(){return l(h())}]},[e,n,r,s]);var a=tK(t,i[0],i[1]);return rK(function(){o.hasValue=!0,o.value=a},[a]),iK(a),a};iA.exports=oA;var oK=iA.exports,aK=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},lK=({contentComponent:t})=>{const e=B1.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return d.jsx(d.Fragment,{children:Object.values(e)})};function cK(){const t=new Set;let e={},n=!1;const r=()=>{n||!t.size||(n=!0,queueMicrotask(()=>{n=!1,t.forEach(s=>s())}))};return{subscribe(s){return t.add(s),()=>{t.delete(s)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(s,i){e={...e,[s]:dR.createPortal(i.reactElement,i.element,s)},r()},removeRenderer(s){const i={...e};delete i[s],e=i,r()}}}var dK=class extends wr.Component{constructor(t){super(t),this.editorContentRef=wr.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=cK(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var t;const e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return d.jsxs(d.Fragment,{children:[d.jsx("div",{ref:aK(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&d.jsx(lK,{contentComponent:t.contentComponent})]})}},uK=b.forwardRef((t,e)=>{const n=wr.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return wr.createElement(dK,{key:n,innerRef:e,...t})}),g0=wr.memo(uK),fK=typeof window<"u"?b.useLayoutEffect:b.useEffect,hK=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){let e;const n=s=>{(s==null?void 0:s.transaction)!==void 0&&s.transaction===e||(e=s==null?void 0:s.transaction,this.transactionNumber+=1,this.subscribers.forEach(i=>i()))},r=this.editor;return r.on("transaction",n),r.on("update",n),()=>{r.off("transaction",n),r.off("update",n)}}}};function pK(t){var e;const[n]=b.useState(()=>new hK(t.editor)),r=oK.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:Yq);return fK(()=>n.watch(t.editor),[t.editor,n]),b.useDebugValue(r),r}var mK=!1,aA=typeof window>"u",gK=aA||!!(typeof window<"u"&&window.next),yK=class lA{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){const e=this.options.current.immediatelyRender;let n=e??!0;return aA?(n&&mK&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):gK&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)},onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)},onMount:(...r)=>{var s,i;return(i=(s=this.options.current).onMount)==null?void 0:i.call(s,...r)},onUnmount:(...r)=>{var s,i;return(i=(s=this.options.current).onUnmount)==null?void 0:i.call(s,...r)}};return new lq(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,i)=>{var o;return s===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?lA.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,s)=>r===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function cA(t={},e=[]){const n=b.useRef(t);n.current=t;const[r]=b.useState(()=>new yK(n)),s=B1.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return b.useDebugValue(s),b.useEffect(r.onRender(e)),pK({editor:s,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),s}var dA=b.createContext({editor:null});dA.Consumer;var xK=b.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),vK=()=>b.useContext(xK);wr.forwardRef((t,e)=>{const{onDragStart:n}=vK(),r=t.as||"div";return d.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});wr.createContext({markViewContentRef:()=>{}});var y0=b.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});y0.displayName="TiptapContext";var kK=()=>b.useContext(y0);function uA({children:t,...e}){const n="editor"in e?e.editor:e.instance;if(!n)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=b.useMemo(()=>({editor:n}),[n]),s=b.useMemo(()=>({editor:n}),[n]);return d.jsx(dA.Provider,{value:s,children:d.jsx(y0.Provider,{value:r,children:t})})}uA.displayName="Tiptap";function fA({...t}){const{editor:e}=kK();return d.jsx(g0,{editor:e,...t})}fA.displayName="Tiptap.Content";Object.assign(uA,{Content:fA});var wK=Hp.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
879
-
880
- `):""}),hA=wK,_u="&nbsp;",ug=" ",bK=Hp.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ii(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===_u||n[0].text===_u||n[0].raw===ug||n[0].text===ug)&&r.length===1&&r[0].type==="text"&&(r[0].text===_u||r[0].text===ug)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,s;if(!t)return"";const i=Array.isArray(t.content)?t.content:[];if(i.length===0){const o=Array.isArray((r=n==null?void 0:n.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((s=n==null?void 0:n.previousNode)==null?void 0:s.type)==="paragraph"&&o.length===0?_u:""}return e.renderChildren(i)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),pA=bK,SK=Hp.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),mA=SK,lS=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},jK=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,CK=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,_K=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,NK=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,EK=Vd.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return lS("strong",{...Ii(this.options.HTMLAttributes,t),children:lS("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ul({find:jK,type:this.type}),ul({find:_K,type:this.type})]},addPasteRules(){return[Ro({find:CK,type:this.type}),Ro({find:NK,type:this.type})]}}),$K=EK,MK=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,TK=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,OK=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,AK=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,RK=Vd.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Ii(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ul({find:MK,type:this.type}),ul({find:OK,type:this.type})]},addPasteRules(){return[Ro({find:TK,type:this.type}),Ro({find:AK,type:this.type})]}}),IK=RK,PK=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},DK=t=>{const e=/`([^`]+)`(?!`)/g,n=[];let r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},zK=Vd.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ii(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ul({find:PK,type:this.type})]},addPasteRules(){return[Ro({find:DK,type:this.type})]}}),LK=zK;const FK="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos6kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12b0cam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",BK="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Lx="numeric",Fx="ascii",Bx="alpha",wc="asciinumeric",rc="alphanumeric",Vx="domain",gA="emoji",VK="scheme",WK="slashscheme",fg="whitespace";function UK(t,e){return t in e||(e[t]=[]),e[t]}function no(t,e,n){e[Lx]&&(e[wc]=!0,e[rc]=!0),e[Fx]&&(e[wc]=!0,e[Bx]=!0),e[wc]&&(e[rc]=!0),e[Bx]&&(e[rc]=!0),e[rc]&&(e[Vx]=!0),e[gA]&&(e[Vx]=!0);for(const r in e){const s=UK(r,n);s.indexOf(t)<0&&s.push(t)}}function ZK(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Nn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Nn.groups={};Nn.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let s=0;s<t.length;s++)this.tt(t[s],e,n,r)},tr(t,e,n,r){r=r||Nn.groups;let s;return e&&e.j?s=e:(s=new Nn(e),n&&r&&no(e,n,r)),this.jr.push([t,s]),s},ts(t,e,n,r){let s=this;const i=t.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(t[o]);return s.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||Nn.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const i=e;let o,a=s.go(t);if(a?(o=new Nn,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Nn,i){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(ZK(o.t,r),n);no(i,l,r)}else n&&no(i,n,r);o.t=i}return s.j[t]=o,o}};const Ae=(t,e,n,r,s)=>t.ta(e,n,r,s),ht=(t,e,n,r,s)=>t.tr(e,n,r,s),cS=(t,e,n,r,s)=>t.ts(e,n,r,s),G=(t,e,n,r,s)=>t.tt(e,n,r,s),us="WORD",Wx="UWORD",yA="ASCIINUMERICAL",xA="ALPHANUMERICAL",fd="LOCALHOST",Ux="TLD",Zx="UTLD",Qu="SCHEME",aa="SLASH_SCHEME",x0="NUM",Hx="WS",v0="NL",bc="OPENBRACE",Sc="CLOSEBRACE",Sh="OPENBRACKET",jh="CLOSEBRACKET",Ch="OPENPAREN",_h="CLOSEPAREN",Nh="OPENANGLEBRACKET",Eh="CLOSEANGLEBRACKET",$h="FULLWIDTHLEFTPAREN",Mh="FULLWIDTHRIGHTPAREN",Th="LEFTCORNERBRACKET",Oh="RIGHTCORNERBRACKET",Ah="LEFTWHITECORNERBRACKET",Rh="RIGHTWHITECORNERBRACKET",Ih="FULLWIDTHLESSTHAN",Ph="FULLWIDTHGREATERTHAN",Dh="AMPERSAND",zh="APOSTROPHE",Lh="ASTERISK",Js="AT",Fh="BACKSLASH",Bh="BACKTICK",Vh="CARET",ro="COLON",k0="COMMA",Wh="DOLLAR",Pr="DOT",Uh="EQUALS",w0="EXCLAMATION",Xn="HYPHEN",jc="PERCENT",Zh="PIPE",Hh="PLUS",ba="POUND",Hi="QUERY",b0="QUOTE",vA="FULLWIDTHMIDDLEDOT",S0="SEMI",Dr="SLASH",Cc="TILDE",qh="UNDERSCORE",kA="EMOJI",Kh="SYM";var wA=Object.freeze({__proto__:null,ALPHANUMERICAL:xA,AMPERSAND:Dh,APOSTROPHE:zh,ASCIINUMERICAL:yA,ASTERISK:Lh,AT:Js,BACKSLASH:Fh,BACKTICK:Bh,CARET:Vh,CLOSEANGLEBRACKET:Eh,CLOSEBRACE:Sc,CLOSEBRACKET:jh,CLOSEPAREN:_h,COLON:ro,COMMA:k0,DOLLAR:Wh,DOT:Pr,EMOJI:kA,EQUALS:Uh,EXCLAMATION:w0,FULLWIDTHGREATERTHAN:Ph,FULLWIDTHLEFTPAREN:$h,FULLWIDTHLESSTHAN:Ih,FULLWIDTHMIDDLEDOT:vA,FULLWIDTHRIGHTPAREN:Mh,HYPHEN:Xn,LEFTCORNERBRACKET:Th,LEFTWHITECORNERBRACKET:Ah,LOCALHOST:fd,NL:v0,NUM:x0,OPENANGLEBRACKET:Nh,OPENBRACE:bc,OPENBRACKET:Sh,OPENPAREN:Ch,PERCENT:jc,PIPE:Zh,PLUS:Hh,POUND:ba,QUERY:Hi,QUOTE:b0,RIGHTCORNERBRACKET:Oh,RIGHTWHITECORNERBRACKET:Rh,SCHEME:Qu,SEMI:S0,SLASH:Dr,SLASH_SCHEME:aa,SYM:Kh,TILDE:Cc,TLD:Ux,UNDERSCORE:qh,UTLD:Zx,UWORD:Wx,WORD:us,WS:Hx});const as=/[a-z]/;let la=/[a-z]/i,Xu=/[\u{1F000}-\u{1FAFF}\u{2600}-\u{27BF}]|\u{FE0F}/u;try{la=new RegExp("\\p{L}","u"),Xu=new RegExp("\\p{Emoji}","u")}catch{}const ls=/\d/,hg=/\s/,dS="\r",pg=`
881
- `,HK="️",qK="‍",mg="";let Nu=null,Eu=null;function KK(t=[]){const e={};Nn.groups=e;const n=new Nn;Nu==null&&(Nu=uS(FK)),Eu==null&&(Eu=uS(BK)),G(n,"'",zh),G(n,"{",bc),G(n,"}",Sc),G(n,"[",Sh),G(n,"]",jh),G(n,"(",Ch),G(n,")",_h),G(n,"<",Nh),G(n,">",Eh),G(n,"(",$h),G(n,")",Mh),G(n,"「",Th),G(n,"」",Oh),G(n,"『",Ah),G(n,"』",Rh),G(n,"<",Ih),G(n,">",Ph),G(n,"&",Dh),G(n,"*",Lh),G(n,"@",Js),G(n,"`",Bh),G(n,"^",Vh),G(n,":",ro),G(n,",",k0),G(n,"$",Wh),G(n,".",Pr),G(n,"=",Uh),G(n,"!",w0),G(n,"-",Xn),G(n,"%",jc),G(n,"|",Zh),G(n,"+",Hh),G(n,"#",ba),G(n,"?",Hi),G(n,'"',b0),G(n,"/",Dr),G(n,";",S0),G(n,"~",Cc),G(n,"_",qh),G(n,"\\",Fh),G(n,"・",vA);const r=ht(n,ls,x0,{[Lx]:!0});ht(r,ls,r);const s=ht(r,as,yA,{[wc]:!0}),i=ht(r,la,xA,{[rc]:!0}),o=ht(n,as,us,{[Fx]:!0});ht(o,ls,s),ht(o,as,o),ht(s,ls,s),ht(s,as,s);const a=ht(n,la,Wx,{[Bx]:!0});ht(a,as),ht(a,ls,i),ht(a,la,a),ht(i,ls,i),ht(i,as),ht(i,la,i);const l=G(n,pg,v0,{[fg]:!0}),c=G(n,dS,Hx,{[fg]:!0}),u=ht(n,hg,Hx,{[fg]:!0});G(n,mg,u),G(c,pg,l),G(c,mg,u),ht(c,hg,u),G(u,dS),G(u,pg),ht(u,hg,u),G(u,mg,u);const f=ht(n,Xu,kA,{[gA]:!0});G(f,"#"),ht(f,Xu,f),G(f,HK,f);const h=G(f,qK);G(h,"#"),ht(h,Xu,f);const m=[[as,o],[ls,s]],g=[[as,null],[la,a],[ls,i]];for(let p=0;p<Nu.length;p++)Bs(n,Nu[p],Ux,us,m);for(let p=0;p<Eu.length;p++)Bs(n,Eu[p],Zx,Wx,g);no(Ux,{tld:!0,ascii:!0},e),no(Zx,{utld:!0,alpha:!0},e),Bs(n,"file",Qu,us,m),Bs(n,"mailto",Qu,us,m),Bs(n,"http",aa,us,m),Bs(n,"https",aa,us,m),Bs(n,"ftp",aa,us,m),Bs(n,"ftps",aa,us,m),no(Qu,{scheme:!0,ascii:!0},e),no(aa,{slashscheme:!0,ascii:!0},e),t=t.sort((p,x)=>p[0]>x[0]?1:-1);for(let p=0;p<t.length;p++){const x=t[p][0],v=t[p][1]?{[VK]:!0}:{[WK]:!0};x.indexOf("-")>=0?v[Vx]=!0:as.test(x)?ls.test(x)?v[wc]=!0:v[Fx]=!0:v[Lx]=!0,cS(n,x,x,v)}return cS(n,"localhost",fd,{ascii:!0}),n.jd=new Nn(Kh),{start:n,tokens:Object.assign({groups:e},wA)}}function bA(t,e){const n=JK(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let a=t,l=null,c=0,u=null,f=-1,h=-1;for(;o<r&&(l=a.go(n[o]));)a=l,a.accepts()?(f=0,h=0,u=a):f>=0&&(f+=n[o].length,h++),c+=n[o].length,i+=n[o].length,o++;i-=f,o-=h,c-=f,s.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return s}function JK(t){const e=[],n=t.length;let r=0;for(;r<n;){let s=t.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Bs(t,e,n,r,s){let i;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];t.j[l]?i=t.j[l]:(i=new Nn(r),i.jr=s.slice(),t.j[l]=i),t=i}return i=new Nn(n),i.jr=s.slice(),t.j[e[o-1]]=i,i}function uS(t){const e=[],n=[];let r=0,s="0123456789";for(;r<t.length;){let i=0;for(;s.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const hd={defaultProtocol:"http",events:null,format:fS,formatHref:fS,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],ignoreClasses:[],render:null};function j0(t,e=null){let n=Object.assign({},hd);t&&(n=Object.assign(n,t instanceof j0?t.o:t));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=s,this.ignoreClasses=n.ignoreClasses.slice()}j0.prototype={o:hd,ignoreTags:[],ignoreClasses:[],isIgnoredClass(t){if(typeof t!="string"||this.ignoreClasses.length===0)return!1;const e=t.split(/\s+/);for(let n=0;n<e.length;n++)if(this.ignoreClasses.indexOf(e[n])>=0)return!0;return!1},defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:hd[t],typeof s=="function"&&r&&(s=s(e,n))):typeof s=="function"&&r&&(s=s(e,n.t,n)),s)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function fS(t){return t}function SA(t,e){this.t="token",this.v=t,this.tk=e}SA.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=hd.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),i=this.toFormattedString(t),o={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),f=t.getObj("events",n,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:s,attributes:o,content:i,eventListeners:f}}};function Kp(t,e){class n extends SA{constructor(s,i){super(s,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const GK=Kp("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),hS=Kp("text"),YK=Kp("nl"),$u=Kp("url",{isLink:!0,toHref(t=hd.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==fd&&t[1].t===ro}}),Qn=t=>new Nn(t);function QK({groups:t}){const e=t.domain.concat([Dh,Lh,Js,Fh,Bh,Vh,Wh,Uh,Xn,x0,jc,Zh,Hh,ba,Dr,Kh,Cc,qh]),n=[zh,ro,k0,Pr,w0,jc,Hi,b0,S0,Nh,Eh,bc,Sc,jh,Sh,Ch,_h,$h,Mh,Th,Oh,Ah,Rh,Ih,Ph],r=[Dh,zh,Lh,Fh,Bh,Vh,Wh,Uh,Xn,bc,Sc,jc,Zh,Hh,ba,Hi,Dr,Kh,Cc,qh],s=Qn(),i=G(s,Cc);Ae(i,r,i),Ae(i,t.domain,i);const o=Qn(),a=Qn(),l=Qn();Ae(s,t.domain,o),Ae(s,t.scheme,a),Ae(s,t.slashscheme,l),Ae(o,r,i),Ae(o,t.domain,o);const c=G(o,Js);G(i,Js,c),G(a,Js,c),G(l,Js,c);const u=G(i,Pr);Ae(u,r,i),Ae(u,t.domain,i);const f=Qn();Ae(c,t.domain,f),Ae(f,t.domain,f);const h=G(f,Pr);Ae(h,t.domain,f);const m=Qn(GK);Ae(h,t.tld,m),Ae(h,t.utld,m),G(c,fd,m);const g=G(f,Xn);G(g,Xn,g),Ae(g,t.domain,f),Ae(m,t.domain,f),G(m,Pr,h),G(m,Xn,g);const p=G(o,Xn),x=G(o,Pr);G(p,Xn,p),Ae(p,t.domain,o),Ae(x,r,i),Ae(x,t.domain,o);const y=Qn($u);Ae(x,t.tld,y),Ae(x,t.utld,y),Ae(y,t.domain,o),Ae(y,r,i),G(y,Pr,x),G(y,Xn,p),G(y,Js,c);const v=G(y,ro),k=Qn($u);Ae(v,t.numeric,k);const w=Qn($u),j=Qn();Ae(w,e,w),Ae(w,n,j),Ae(j,e,w),Ae(j,n,j),G(y,Dr,w),G(k,Dr,w),G(y,Hi,j),G(y,ba,w),G(k,Hi,j),G(k,ba,w);const C=G(a,ro),E=G(l,ro),S=G(E,Dr),_=G(S,Dr);Ae(a,t.domain,o),G(a,Pr,x),G(a,Xn,p),Ae(l,t.domain,o),G(l,Pr,x),G(l,Xn,p),Ae(C,t.domain,w),G(C,Dr,w),G(C,Hi,w),Ae(_,t.domain,w),Ae(_,e,w),G(_,Dr,w);const N=[[bc,Sc],[Sh,jh],[Ch,_h],[Nh,Eh],[$h,Mh],[Th,Oh],[Ah,Rh],[Ih,Ph]];for(let M=0;M<N.length;M++){const[P,V]=N[M],Z=G(w,P);G(j,P,Z);const Y=Qn($u);Ae(Z,e,Y);const O=Qn();Ae(Z,n,O),G(Z,V,w),Ae(Y,e,Y),Ae(Y,n,O),Ae(O,e,Y),Ae(O,n,O),G(Y,V,w),G(O,V,w)}return G(s,fd,y),G(s,v0,YK),{start:s,tokens:wA}}function XK(t,e,n){let r=n.length,s=0,i=[],o=[];const a=[];for(;s<r;){let l=t,c=null,u=null,f=0,h=null,m=-1,g=[];for(;s<r&&!(c=l.go(n[s].t));)o.push(n[s++]);for(;s<r&&(u=c||l.go(n[s].t));)if(c=null,l=u,s++,f++,l.accepts())m=0,h=l,g=[];else if(m>=0&&m++,g.push(l),a[s]&&a[s].has(l))break;for(let p=0,x=s-g.length+1;p<g.length;p++,x++)(a[x]||(a[x]=new Set)).add(g[p]);if(m<0)s-=f,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(gg(hS,e,o)),o=[]),s-=m,f-=m;const p=h.t,x=n.slice(s-f,s);i.push(gg(p,e,x))}}return o.length>0&&i.push(gg(hS,e,o)),i}function gg(t,e,n){const r=n[0].s,s=n[n.length-1].e,i=e.slice(r,s);return new t(i,n)}const eJ=typeof console<"u"&&console&&console.warn||(()=>{}),tJ="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",nt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function nJ(){return Nn.groups={},nt.scanner=null,nt.parser=null,nt.tokenQueue=[],nt.pluginQueue=[],nt.customSchemes=[],nt.initialized=!1,nt}function pS(t,e=!1){if(nt.initialized&&eJ(`linkifyjs: already initialized - will not register custom scheme "${t}" ${tJ}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
882
- 1. Must only contain digits, lowercase ASCII letters or "-"
883
- 2. Cannot start or end with "-"
884
- 3. "-" cannot repeat`);nt.customSchemes.push([t,e])}function rJ(){nt.scanner=KK(nt.customSchemes);for(let t=0;t<nt.tokenQueue.length;t++)nt.tokenQueue[t][1]({scanner:nt.scanner});nt.parser=QK(nt.scanner.tokens);for(let t=0;t<nt.pluginQueue.length;t++)nt.pluginQueue[t][1]({scanner:nt.scanner,parser:nt.parser});return nt.initialized=!0,nt}function C0(t){return nt.initialized||rJ(),XK(nt.parser.start,t,bA(nt.scanner.start,t))}C0.scan=bA;function jA(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new j0(n),s=C0(t),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}var _0="[\0-   ᠎ -\u2029  ]",sJ=new RegExp(_0),iJ=new RegExp(`${_0}$`),oJ=new RegExp(_0,"g");function aJ(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function lJ(t){return new Pn({key:new Or("autolink"),appendTransaction:(e,n,r)=>{const s=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=MO(n.doc,[...e]);if(DO(a).forEach(({newRange:c})=>{const u=rH(r.doc,c,m=>m.isTextblock);let f,h;if(u.length>1)f=u[0],h=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const m=r.doc.textBetween(c.from,c.to," "," ");if(!iJ.test(m))return;f=u[0],h=r.doc.textBetween(f.pos,c.to,void 0," ")}if(f&&h){const m=h.split(sJ).filter(Boolean);if(m.length<=0)return!1;const g=m[m.length-1],p=f.pos+h.lastIndexOf(g);if(!g)return!1;const x=C0(g).map(y=>y.toObject(t.defaultProtocol));if(!aJ(x))return!1;x.filter(y=>y.isLink).map(y=>({...y,from:p+y.start+1,to:p+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{u0(y.from,y.to,r.doc).some(v=>v.mark.type===t.type)||o.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function cJ(t){return new Pn({key:new Or("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const l=r.target;if(!l)return!1;const c=t.editor.view.dom;o=l.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const l=PO(e.state,t.type.name),c=(s=o.href)!=null?s:l.href,u=(i=o.target)!=null?i:l.target;c&&(window.open(c,u),a=!0)}return a}}})}var dJ=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,uJ=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function CA(t,e){let n=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)n+=1;return n%2===1}function fJ(t,e){let n=0,r=0;for(;r<e;){if(t[r]!=="`"){r+=1;continue}if(n===0&&CA(t,r)){r+=1;continue}let s=0;for(;r<e&&t[r]==="`";)s+=1,r+=1;n===0?n=s:s===n&&(n=0)}return n>0}function _A(t,e,n){var r,s;const[,i,o]=e;return(e.index?t[e.index-1]:void 0)==="!"||CA(t,(r=e.index)!=null?r:0)||fJ(t,(s=e.index)!=null?s:0)?!1:!!i.trim()&&n(o)}function NA(t){var e,n;const[r,s,i,,o,a,l]=t,c=(e=o??a)!=null?e:l;return{index:(n=t.index)!=null?n:0,text:r,replaceWith:s,data:{href:i,title:c||null,markdown:!0}}}function hJ(t,e){return t.index<e.index+e.text.length&&e.index<t.index+t.text.length}function EA(t){var e,n,r;return{href:(e=t.data)==null?void 0:e.href,title:(r=(n=t.data)==null?void 0:n.title)!=null?r:null}}function pJ(t){const e=ul({find:n=>{const r=dJ.exec(n);return!r||!_A(n,r,t.isAllowedHref)?null:NA(r)},type:t.type,getAttributes:EA});return new VO({find:e.find,handler:n=>{const r=e.handler(n);return r!==null&&n.state.tr.steps.length&&n.state.tr.setMeta("preventAutolink",!0),r}})}function mJ(t){const e=Ro({find:n=>{var r,s;const i=[];for(const a of n.matchAll(uJ))_A(n,a,t.isAllowedHref)&&i.push(NA(a));const o=((s=(r=t.findPlainUrls)==null?void 0:r.call(t,n))!=null?s:[]).filter(a=>!i.some(l=>hJ(l,a)));return[...i,...o]},type:t.type,getAttributes:EA});return new UO({find:e.find,handler:n=>{var r;const s=e.handler(n);return s!==null&&n.state.tr.steps.length&&((r=n.match.data)!=null&&r.markdown)&&n.state.tr.setMeta("preventAutolink",!0),s}})}function gJ(t){return new Pn({key:new Or("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:i}=e,{selection:o}=i,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(u=>{l+=u.textContent});const c=jA(l,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c||s!==void 0&&!s(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function cs(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(oJ,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var yJ=Vd.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){pS(t);return}pS(t.scheme,t.optionalSlashes)})},onDestroy(){nJ()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!cs(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const s=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},addAttributes(){var t,e,n;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(t=this.options.HTMLAttributes.target)!=null?t:null},rel:{default:(e=this.options.HTMLAttributes.rel)!=null?e:null},class:{default:(n=this.options.HTMLAttributes.class)!=null?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!cs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!cs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ii(this.options.HTMLAttributes,t),0]:["a",Ii(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,s,i;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",a=(i=(s=t.attrs)==null?void 0:s.title)!=null?i:"",l=e.renderChildren(t);return a?`[${l}](${o} "${a}")`:`[${l}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!cs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!cs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){return this.options.markdownLinks?[pJ({type:this.type,isAllowedHref:t=>this.options.isAllowedUri(t,{defaultValidate:e=>!!cs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const t=e=>{const n=[];if(e){const{protocols:r,defaultProtocol:s}=this.options;jA(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:a=>!!cs(a,r),protocols:r,defaultProtocol:s})).forEach(o=>{this.options.shouldAutoLink(o.value)&&n.push({text:o.value,data:{href:o.href},index:o.start})})}return n};return this.options.markdownLinks?[mJ({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:n=>!!cs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:t})]:[Ro({find:t,type:this.type,getAttributes:e=>{var n;return{href:(n=e.data)==null?void 0:n.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(lJ({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!cs(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(cJ({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(gJ({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),xJ=yJ;function Ln({value:t,onSave:e,as:n="span",className:r="",multiline:s=!1,label:i,id:o}){const[a,l]=b.useState(!1);if(a)return d.jsx(vJ,{value:t,multiline:s,className:r,label:i,onDone:u=>{l(!1),u!==void 0&&u.trim()&&u!==t&&e(u)}});const c=()=>{var u;(u=window.getSelection())!=null&&u.toString()||l(!0)};return d.jsx(n,{id:o,className:`${r} -mx-1 cursor-text rounded-md px-1 transition-[background-color] hover:bg-sunken/60 focus-visible:bg-sunken/60`,tabIndex:0,title:"Click to edit","aria-description":`${i}. Press Enter to edit.`,onClick:u=>{u.target.closest("a")||c()},onKeyDown:u=>{u.key==="Enter"&&u.target===u.currentTarget&&(u.preventDefault(),l(!0))},children:d.jsx(el,{text:t,multiline:s})})}function vJ({value:t,multiline:e,className:n,label:r,onDone:s}){const i=b.useRef(null),o=b.useRef(!1),a=(u,f)=>{o.current||(o.current=!0,s(f&&u?bJ(u.getJSON()):void 0))},l=cA({extensions:[hA,pA,mA,$K,IK,LK,xJ.configure({openOnClick:!1,autolink:!0,linkOnPaste:!0})],content:wJ(t,e),autofocus:"end",immediatelyRender:!0,editorProps:{attributes:{class:"outline-none [&>p+p]:mt-[0.8em]","aria-label":r,role:"textbox","aria-multiline":String(e)},handleKeyDown:(u,f)=>f.key==="Escape"?(a(null,!1),!0):f.key==="Enter"&&!f.shiftKey&&(!e||f.metaKey||f.ctrlKey)?(a(c.current,!0),!0):!1},onBlur:({editor:u,event:f})=>{var h;f.relatedTarget instanceof Node&&((h=i.current)!=null&&h.contains(f.relatedTarget))||a(u,!0)}}),c=b.useRef(null);return c.current=l,d.jsxs("div",{className:`${n} relative -mx-1 rounded-md bg-raised px-1 ring-2 ring-poney/50`,children:[d.jsx(kJ,{editor:l,bar:i}),d.jsx(g0,{editor:l})]})}function kJ({editor:t,bar:e}){const[n,r]=b.useState(!1),[s,i]=b.useState("");if(!t)return null;const o=(l,c,u,f,h)=>d.jsx("button",{type:"button","aria-label":c,"aria-pressed":l,title:`${c} (${h})`,onMouseDown:m=>m.preventDefault(),onClick:f,className:`grid h-7 w-7 place-items-center rounded-md ${l?"bg-ink text-paper":"text-ink-2 hover:bg-sunken"}`,children:u}),a=/Mac|iPhone|iPad/.test(navigator.platform)?"⌘":"Ctrl+";return d.jsxs("div",{ref:e,className:"absolute -top-10 left-0 z-20 flex items-center gap-0.5 rounded-lg border border-rule bg-raised p-0.5 font-sans text-[13px] font-normal leading-none tracking-normal shadow-float",children:[o(t.isActive("bold"),"Bold",d.jsx(jD,{size:14}),()=>t.chain().focus().toggleBold().run(),`${a}B`),o(t.isActive("italic"),"Italic",d.jsx(wD,{size:14}),()=>t.chain().focus().toggleItalic().run(),`${a}I`),o(t.isActive("code"),"Code",d.jsx(fD,{size:14}),()=>t.chain().focus().toggleCode().run(),`${a}E`),o(t.isActive("link"),"Link",d.jsx(_D,{size:14}),()=>{if(t.isActive("link"))return void t.chain().focus().unsetLink().run();i(""),r(!0)},"paste a URL on a selection"),n&&d.jsx("form",{className:"flex items-center gap-1 pl-1",onSubmit:l=>{l.preventDefault(),s.trim()?t.chain().focus().setLink({href:s.trim()}).run():t.commands.focus(),r(!1)},children:d.jsx("input",{autoFocus:!0,value:s,onChange:l=>i(l.target.value),onKeyDown:l=>l.key==="Escape"&&(r(!1),t.commands.focus()),placeholder:"https://","aria-label":"Link address",className:"h-7 w-56 rounded-md border border-rule bg-paper px-2 text-[12.5px] outline-none focus:border-rule-strong"})})]})}function wJ(t,e){const n=e?Kv(t):[t.replace(/\n+/g," ")];return{type:"doc",content:(n.length?n:[""]).map(r=>{const s=$a(r).map(i=>({type:"text",text:i.text,marks:[...i.marks.map(o=>({type:o})),...i.href?[{type:"link",attrs:{href:i.href}}]:[]]}));return s.length?{type:"paragraph",content:s}:{type:"paragraph"}})}}function bJ(t){return(t.content??[]).map(e=>yP((e.content??[]).map(n=>{var i,o,a;const r=(n.marks??[]).map(l=>l.type).filter(l=>l==="bold"||l==="italic"||l==="code"),s=(a=(o=(i=n.marks)==null?void 0:i.find(l=>l.type==="link"))==null?void 0:o.attrs)==null?void 0:a.href;return{text:n.text??"",marks:r,...s?{href:s}:{}}})).trim()).filter(Boolean).join(`
885
-
886
- `)}function SJ({block:t,onEditNote:e}){var m,g;const n=YV(t),r=T(Od),s=t.hunks.flatMap(p=>p.lines),i=s.filter(p=>p.kind==="add").length,o=s.filter(p=>p.kind==="del").length,a=i===0&&o===0&&s.every(p=>p.old===void 0),l=(m=s[0])==null?void 0:m.new,c=(g=s[s.length-1])==null?void 0:g.new,u=new Map;t.notes.forEach((p,x)=>u.set(p.line,[...u.get(p.line)??[],{text:p.text,index:x}]));const f=t.path.split("/").slice(-2).join("/"),h=(p,x)=>lT(t.path,p,x);return d.jsxs("figure",{className:"overflow-hidden rounded-xl border border-rule bg-raised",children:[d.jsxs("figcaption",{className:"flex min-w-0 items-center gap-2 border-b border-rule px-3.5 py-2.5 text-[12.5px]",children:[d.jsx(yp,{size:14,className:"shrink-0 text-ink-3","aria-hidden":!0}),d.jsx("code",{className:"min-w-0 truncate font-mono text-[12px] text-ink",title:t.path,children:f}),t.title&&d.jsx("span",{className:"shrink-0 text-ink-3",children:t.title}),d.jsx("span",{className:"flex-1"}),a?l!==void 0&&d.jsx("span",{className:"font-tabular shrink-0 font-mono text-[11.5px] text-ink-3",children:l===c?`line ${l}`:`lines ${l}–${c}`}):d.jsxs("span",{className:"font-tabular shrink-0 font-mono text-[11.5px]",children:[d.jsxs("span",{className:"text-new",children:["+",i]})," ",d.jsxs("span",{className:"text-removed",children:["−",o]})]})]}),d.jsx("div",{className:"scrollbar-quiet overflow-x-auto",children:d.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-[21px] [font-variant-ligatures:none]",children:d.jsx("tbody",{children:t.hunks.map((p,x)=>d.jsxs(b.Fragment,{children:[p.header&&d.jsx("tr",{children:d.jsx("td",{colSpan:a?2:4,className:"bg-sunken/60 px-3.5 py-1 text-[11px] text-ink-3",children:p.header})}),p.lines.map((y,v)=>{var C;const k=y.kind==="add"?"bg-new-wash":y.kind==="del"?"bg-removed-wash":"",w=y.kind==="add"?"+":y.kind==="del"?"−":"",j=y.kind!=="del"&&y.new?u.get(y.new):void 0;return d.jsxs(b.Fragment,{children:[d.jsxs("tr",{className:`group/line ${k}`,onContextMenu:y.new!==void 0?Cb(t.path,y.new,y.text):void 0,children:[!a&&d.jsx("td",{className:"w-10 select-none pr-1 text-right align-top text-ink-4",children:y.old??""}),d.jsxs("td",{className:`relative w-10 select-none text-right align-top text-ink-4 ${a?"pr-4":"pr-2"}`,children:[d.jsx("span",{className:r&&y.new?"group-hover/line:invisible":"",children:y.new??""}),r&&y.new!==void 0&&d.jsx("button",{type:"button",title:"Ask the agent about this line","aria-label":`Ask the agent about line ${y.new}`,onClick:()=>Qi(h(y.new,y.text)),className:`absolute inset-y-0 grid place-items-center text-poney opacity-0 focus-visible:opacity-100 group-hover/line:opacity-100 ${a?"right-3":"right-1"}`,children:d.jsx(TD,{size:14})})]}),!a&&d.jsx("td",{className:`w-4 select-none align-top ${y.kind==="add"?"text-new":"text-removed"}`,children:w}),d.jsx("td",{className:"whitespace-pre pr-4 text-ink",children:((C=n==null?void 0:n.get(`${x}:${v}`))==null?void 0:C.map((E,S)=>d.jsx("span",{className:"code-token",style:E.style,children:E.content},S)))??(y.text||" ")})]}),j==null?void 0:j.map(E=>d.jsxs("tr",{onContextMenu:y.new!==void 0?Cb(t.path,y.new,y.text,E.text):void 0,children:[d.jsx("td",{colSpan:a?1:3}),d.jsx("td",{className:"py-1.5 pr-4",children:d.jsxs("span",{className:"inline-flex max-w-[56ch] items-start gap-2 whitespace-normal rounded-lg border border-rule bg-paper px-2.5 py-1.5 font-sans text-[12.5px] leading-snug text-ink-2",children:[d.jsx(OD,{size:13,className:"mt-0.5 shrink-0 text-ink-3","aria-hidden":!0}),e?d.jsx(Ln,{label:"Note on the code",value:E.text,onSave:S=>e(E.index,S),className:"min-w-[8ch]"}):E.text]})})]},`n${E.index}`))]},v)})]},x))})})})]})}function yg(t,e){const[n,r]=b.useState(()=>{try{const i=localStorage.getItem(t);return i?JSON.parse(i):e}catch{return e}}),s=b.useCallback(i=>{r(i);try{localStorage.setItem(t,JSON.stringify(i))}catch{}window.dispatchEvent(new Event("poney:local"))},[t]);return[n,s]}function qx({risk:t}){return t==="look"?d.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-changed/40 bg-changed-wash px-2.5 py-0.5 text-[12px] font-semibold text-changed",children:[d.jsx(Nd,{size:12,strokeWidth:2.4})," Look closely"]}):d.jsx("span",{className:"inline-flex items-center rounded-full border border-rule bg-sunken/70 px-2.5 py-0.5 text-[12px] font-semibold text-ink-2",children:"Routine"})}function mS({mode:t,onChange:e}){const n=[{id:"before",label:"Before"},{id:"change",label:"Change"},{id:"after",label:"After"}];return d.jsx("div",{role:"radiogroup","aria-label":"Show the system",className:"inline-flex rounded-lg border border-rule bg-sunken/60 p-0.5",children:n.map(r=>d.jsx("button",{role:"radio","aria-checked":t===r.id,type:"button",onClick:()=>e(r.id),className:`h-7 rounded-md px-3 text-[12.5px] font-medium transition-colors ${t===r.id?"bg-raised text-ink shadow-[0_1px_2px_#0000001a]":"text-ink-3 hover:text-ink"}`,children:r.label},r.id))})}function gS(){return d.jsx("div",{className:"flex items-center gap-3 text-[12px] text-ink-3","aria-label":"Key",children:["new","changed","removed"].map(t=>d.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[d.jsx("span",{className:"h-2.5 w-2.5 rounded-full border-[1.5px]",style:{borderColor:`var(--${t})`,background:`var(--${t}-wash)`}}),Yv[t]]},t))})}function yS({walkthrough:t}){var o;const e=ze(),n=T(a=>a.selection),r=T(a=>a.select);if(!n||!e.exists(n))return null;const s=e.describe(n),i=t==null?void 0:t.marks.find(a=>{const l=an(a.ref);return l&&de(l)===de(n)});return d.jsxs("div",{className:"fade-in absolute bottom-4 left-4 z-10 w-[300px] rounded-xl border border-rule bg-raised p-3.5 shadow-float",children:[d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("div",{className:"text-[11.5px] text-ink-3",children:s.kind}),d.jsx("div",{className:"text-[14px] font-semibold leading-snug",children:s.title})]}),d.jsx("button",{type:"button","aria-label":"Close",className:"rounded p-0.5 text-ink-3 hover:bg-sunken hover:text-ink",onClick:()=>r(null),children:d.jsx(zo,{size:14})})]}),s.summary&&d.jsx("p",{className:"mt-1.5 text-[12.5px] leading-snug text-ink-2",children:s.summary}),n.kind==="entity"&&(((o=e.entities.get(n.id))==null?void 0:o.sourceRefs.length)??0)>0&&d.jsx("ul",{className:"mt-2 space-y-0.5",children:e.entities.get(n.id).sourceRefs.map((a,l)=>d.jsxs("li",{className:"flex min-w-0 items-center gap-1.5 text-ink-3",children:[d.jsx(yp,{size:12,className:"shrink-0","aria-hidden":!0}),d.jsxs("code",{className:"truncate font-mono text-[11.5px]",title:a.path,children:[a.path,a.line?`:${a.line}`:"",a.symbol?` › ${a.symbol}`:""]})]},l))}),i&&d.jsxs("p",{className:"mt-2 text-[12.5px] leading-snug",children:[d.jsx("span",{className:"font-semibold",style:{color:`var(--${i.state})`},children:Yv[i.state]}),i.note?d.jsxs("span",{className:"text-ink-2",children:[": ",i.note]}):" in this change"]}),d.jsxs("button",{type:"button",onClick:()=>Ad(n),className:"mt-3 inline-flex items-center gap-1.5 text-[12.5px] font-semibold text-poney hover:underline",children:[d.jsx(n1,{size:13})," Explore it in the whole system"]})]})}function xS({title:t,onClose:e,children:n}){return b.useEffect(()=>{const r=s=>s.key==="Escape"&&e();return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e]),d.jsx("div",{className:"fade-in fixed inset-0 z-40 bg-ink/30 p-4 backdrop-blur-[2px] sm:p-8",onClick:e,children:d.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":t,className:"flex h-full flex-col overflow-hidden rounded-2xl border border-rule bg-raised shadow-float",onClick:r=>r.stopPropagation(),children:[d.jsxs("div",{className:"flex items-center gap-3 border-b border-rule px-4 py-3",children:[d.jsx("span",{className:"flex-1 text-[14px] font-semibold",children:t}),d.jsx("button",{type:"button",autoFocus:!0,onClick:e,"aria-label":"Close",className:"rounded-md p-1.5 text-ink-3 hover:bg-sunken hover:text-ink",children:d.jsx(zo,{size:16})})]}),d.jsx("div",{className:"relative min-h-0 flex-1",children:n})]})})}function vS({onClick:t}){return d.jsx("button",{type:"button",onClick:t,"aria-label":"Expand the diagram",title:"Expand",className:"rounded-md p-1.5 text-ink-3 hover:bg-sunken hover:text-ink",children:d.jsx(MD,{size:15})})}function jJ({walkthrough:t}){const e=ze(),n=t.kind==="tour",r=b.useMemo(()=>j_(t),[t]),s=b.useCallback((z,B)=>T.getState().dispatch({type:"walkthrough.setText",walkthroughId:t.id,path:z,value:B}),[t.id]),[i,o]=b.useState(n?"after":"change"),[a,l]=b.useState(n?"after":"change"),[c,u]=b.useState(null),[f,h]=b.useState(0),[m,g]=b.useState(null),[p,x]=yg(`poney:read:${e.doc.project.id}:${t.id}`,[]),[y,v]=yg(`poney:answers:${e.doc.project.id}:${t.id}`,{}),[k,w]=yg(`poney:notes:${e.doc.project.id}:${t.id}`,{}),j=T(z=>z.live.state==="on"),C=T(z=>z.setActiveScene),E=b.useRef(null),S=b.useRef([]),_=t.overview?e.views.get(t.overview):void 0,N=t.scenes[Math.min(f,t.scenes.length-1)];b.useEffect(()=>C(N.id),[N.id,C]);const M=N.view?e.views.get(N.view):void 0,[P,V]=b.useState(null),[Z,Y]=b.useState(!1);b.useEffect(()=>{V(null),Y(!1)},[N.id]),b.useEffect(()=>{if(!Z)return;const z=window.setTimeout(()=>{const B=(P??-1)+1;B>=N.trace.length?Y(!1):V(B)},P===null?60:1900);return()=>clearTimeout(z)},[Z,P,N.trace.length]);const O=P!==null&&N.trace[P]&&an(N.trace[P].ref)?de(an(N.trace[P].ref)):null,R=z=>{Y(!1),V(z===null?null:Math.max(0,Math.min(N.trace.length-1,z)))};b.useEffect(()=>{const z=E.current;if(!z)return;const B=new IntersectionObserver(H=>{for(const $ of H)$.isIntersecting&&h(Number($.target.dataset.index))},{root:z,rootMargin:"-38% 0px -58% 0px"});return S.current.forEach(H=>H&&B.observe(H)),()=>B.disconnect()},[t]);const I=T(z=>z.jump);b.useEffect(()=>{var B;const z=I?t.scenes.findIndex(H=>H.id===I.scene):-1;z>=0&&((B=S.current[z])==null||B.scrollIntoView({behavior:"smooth",block:"start"}))},[I,t]);const L=z=>{var B;return(B=S.current[z])==null?void 0:B.scrollIntoView({behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth",block:"start"})},K=z=>x(p.includes(z)?p.filter(B=>B!==z):[...p,z]),ne=z=>{const B=an(z);return B?de(B):z},D=t.source;return d.jsxs("div",{ref:E,className:"scrollbar-quiet relative h-full overflow-y-auto bg-paper",children:[d.jsxs("header",{className:"mx-auto max-w-[1320px] px-6 pt-10 sm:px-10 sm:pt-14",children:[D&&d.jsxs("p",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[13px] text-ink-3",children:[d.jsxs("span",{className:"inline-flex items-center gap-1.5 font-medium text-ink-2",children:[n?d.jsx(s1,{size:14}):d.jsx(gD,{size:14})," ",D.kind," ",D.ref??(n?D.repository:void 0)]}),D.head&&d.jsxs("span",{children:["head ",d.jsx("code",{className:"font-mono text-[12px] text-ink-2",children:D.head.slice(0,7)})]}),D.files!==void 0&&d.jsxs("span",{children:[D.files," files"]}),D.added!==void 0&&d.jsxs("span",{className:"font-tabular font-mono text-[12px]",children:[d.jsxs("span",{className:"text-new",children:["+",D.added]})," ",d.jsxs("span",{className:"text-removed",children:["−",D.removed??0]})]}),D.author&&d.jsxs("span",{children:["Walkthrough by ",D.author.charAt(0).toLowerCase()+D.author.slice(1)]})]}),d.jsx(Ln,{as:"h1",label:"Title",value:t.title,onSave:z=>s(["title"],z),className:"mt-4 block max-w-[24ch] text-[34px] font-semibold leading-[1.08] tracking-[-0.025em] sm:text-[44px]"}),d.jsx(Ln,{as:"p",label:"Summary",value:t.summary,onSave:z=>s(["summary"],z),className:"mt-5 block max-w-[60ch] text-[18px] leading-relaxed text-ink-2"})]}),d.jsxs("section",{"aria-labelledby":"story",className:"mx-auto mt-14 max-w-[1320px] px-6 sm:px-10",children:[d.jsxs("div",{className:`grid gap-x-12 gap-y-6 ${t.story.before||t.story.after?"lg:grid-cols-[minmax(0,7fr)_minmax(0,5fr)]":""}`,children:[d.jsxs("div",{children:[d.jsx("h2",{id:"story",className:"text-[22px] font-semibold tracking-[-0.01em]",children:n?"What this code is for":"What changes for a person"}),d.jsx(Ln,{as:"p",multiline:!0,label:"Story",value:t.story.text,onSave:z=>s(["story","text"],z),className:"mt-4 block max-w-[66ch] text-[16.5px] leading-[1.7] text-ink-2"})]}),(t.story.before||t.story.after)&&d.jsxs("dl",{className:"space-y-3 lg:pt-11",children:[d.jsxs("div",{className:"rounded-xl border border-rule bg-raised px-4 py-3.5",children:[d.jsx("dt",{className:"text-[12.5px] font-semibold text-ink-3",children:"Before"}),d.jsx(Ln,{as:"dd",label:"Before",value:t.story.before??"",onSave:z=>s(["story","before"],z),className:"mt-1 block text-[15px] leading-snug"})]}),d.jsxs("div",{className:"rounded-xl border border-new/40 bg-new-wash px-4 py-3.5",children:[d.jsx("dt",{className:"text-[12.5px] font-semibold text-new",children:"After"}),d.jsx(Ln,{as:"dd",label:"After",value:t.story.after??"",onSave:z=>s(["story","after"],z),className:"mt-1 block text-[15px] leading-snug"})]})]})]}),_&&d.jsxs("figure",{className:"relative mt-8 flex h-[min(620px,72vh)] flex-col overflow-hidden rounded-2xl border border-rule bg-raised",children:[d.jsxs("figcaption",{className:"flex flex-wrap items-center gap-3 border-b border-rule px-4 py-3",children:[d.jsx("span",{className:"text-[13px] font-semibold",children:_.title}),d.jsx("span",{className:"hidden text-[12.5px] text-ink-3 md:inline",children:n?"Open a group to see what is inside it.":"Switch between before and after to see what moves."}),d.jsx("span",{className:"flex-1"}),!n&&d.jsx(gS,{}),!n&&d.jsx(mS,{mode:i,onChange:o}),d.jsx(vS,{onClick:()=>g("hero")})]}),d.jsxs("div",{className:"relative min-h-0 flex-1",children:[d.jsx(yu,{view:_,walkthrough:t,marks:r,mode:i,focus:[],callouts:[],hot:c,setHot:u,maxScale:1.1}),d.jsx(yS,{walkthrough:t})]})]})]}),t.verdict&&d.jsx("section",{"aria-labelledby":"verdict",className:"mx-auto mt-10 max-w-[1320px] px-6 sm:px-10",children:d.jsxs("div",{className:"rounded-2xl border border-rule bg-raised px-5 py-5 sm:px-6",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("h2",{id:"verdict",className:"text-[16px] font-semibold",children:n?"At a glance":"Verdict"}),(!n||t.verdict.risk==="look")&&d.jsx(qx,{risk:t.verdict.risk})]}),d.jsx("dl",{className:"mt-4 grid gap-x-8 gap-y-4 sm:grid-cols-2 lg:grid-cols-5",children:t.verdict.facts.map(z=>d.jsxs("div",{children:[d.jsx("dt",{className:"text-[12.5px] text-ink-3",children:z.label}),d.jsx("dd",{className:"mt-1 text-[14px] leading-snug",children:z.value})]},z.label))}),t.verdict.findings.length>0&&d.jsxs("div",{className:"mt-5 border-t border-rule pt-4",children:[d.jsx("h3",{className:"text-[13px] font-semibold text-ink-3",children:n?"Good to know":"Findings"}),d.jsx("ul",{className:"mt-2 space-y-1.5",children:t.verdict.findings.map((z,B)=>{const H=z.scene?t.scenes.findIndex($=>$.id===z.scene):-1;return d.jsxs("li",{className:"flex items-start gap-2.5 text-[14px] leading-snug",children:[z.severity==="risk"?d.jsx(Nd,{size:15,className:"mt-0.5 shrink-0 text-changed"}):d.jsx(kD,{size:15,className:"mt-0.5 shrink-0 text-ink-3"}),d.jsxs("span",{children:[d.jsx(Ln,{label:"Finding",value:z.text,onSave:$=>s(["verdict","findings",B,"text"],$)}),H>=0&&d.jsxs("button",{type:"button",onClick:()=>L(H),className:"ml-2 text-[12.5px] font-semibold text-poney hover:underline",children:["See scene ",H+1]})]})]},B)})})]})]})}),d.jsxs("section",{"aria-labelledby":"path",className:"mx-auto mt-14 max-w-[1320px] px-6 sm:px-10",children:[d.jsxs("div",{className:"flex items-end gap-4",children:[d.jsx("h2",{id:"path",className:"text-[22px] font-semibold tracking-[-0.01em]",children:"Read in this order"}),d.jsxs("span",{className:"font-tabular pb-1 text-[13px] text-ink-3",children:[p.length," of ",t.scenes.length," read"]})]}),d.jsx("div",{className:"mt-3 h-1 overflow-hidden rounded-full bg-sunken","aria-hidden":!0,children:d.jsx("div",{className:"h-full rounded-full bg-new transition-[width] duration-500",style:{width:`${p.length/t.scenes.length*100}%`}})}),d.jsx("ol",{className:"mt-5 grid gap-2 md:grid-cols-2 xl:grid-cols-3",children:t.scenes.map((z,B)=>d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>L(B),className:"group flex h-full w-full items-start gap-3 rounded-xl border border-rule bg-raised px-4 py-3.5 text-left transition-colors hover:border-rule-strong",children:[d.jsx("span",{className:`font-tabular mt-0.5 grid h-6 w-6 shrink-0 place-items-center rounded-full text-[12px] font-semibold ${p.includes(z.id)?"bg-new text-paper":"bg-sunken text-ink-2"}`,children:p.includes(z.id)?d.jsx(bs,{size:13,strokeWidth:3}):B+1}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block text-[14.5px] font-semibold leading-snug",children:d.jsx(el,{text:z.title})}),d.jsxs("span",{className:"mt-1.5 flex flex-wrap items-center gap-2 text-[12px] text-ink-3",children:[(!n||z.risk==="look")&&d.jsx(qx,{risk:z.risk}),z.code.map(H=>d.jsx("code",{className:"font-mono text-[11.5px]",children:H.path.split("/").pop()},H.path))]})]})]})},z.id))})]}),d.jsxs("section",{"aria-label":"Scenes",className:"mx-auto mt-16 grid max-w-[1480px] gap-10 px-6 pb-[30vh] sm:px-10 lg:grid-cols-[minmax(360px,500px)_minmax(0,1fr)]",children:[d.jsx("div",{className:"order-2 lg:order-1",children:t.scenes.map((z,B)=>d.jsx(CJ,{edit:s,s:z,i:B,count:t.scenes.length,refCb:H=>S.current[B]=H,active:B===f,hot:c,setHot:u,keyOf:ne,read:p.includes(z.id),onRead:()=>{K(z.id),!p.includes(z.id)&&B+1<t.scenes.length&&L(B+1)},answers:y,onAnswer:(H,$)=>v({...y,[H]:$}),note:k[z.id]??"",onNote:H=>w({...k,[z.id]:H}),live:j,tour:n,traceStep:B===f?P:null,onTraceStep:H=>B===f?R(H):L(B)},z.id))}),d.jsx("div",{className:"order-1 lg:order-2",children:d.jsxs("figure",{className:"sticky top-4 flex h-[46vh] flex-col overflow-hidden rounded-2xl border border-rule bg-raised lg:top-8 lg:h-[calc(100vh-8rem)]",children:[d.jsxs("figcaption",{className:"flex flex-wrap items-center gap-3 border-b border-rule px-4 py-3",children:[d.jsxs("span",{className:"font-tabular text-[12.5px] text-ink-3",children:[f+1," / ",t.scenes.length]}),d.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-semibold",children:(M==null?void 0:M.title)??"Code only"}),N.trace.length>0&&M&&d.jsx(NJ,{count:N.trace.length,step:P,playing:Z,onPlay:()=>{P!==null&&P>=N.trace.length-1&&V(null),Y(!0)},onPause:()=>Y(!1),onStep:R}),!n&&d.jsx(gS,{}),!n&&d.jsx(mS,{mode:a,onChange:l}),M&&d.jsx(vS,{onClick:()=>g("scene")})]}),d.jsxs("div",{className:"relative min-h-0 flex-1",children:[M?d.jsx(yu,{view:M,walkthrough:t,marks:r,mode:a,focus:N.focus,callouts:N.callouts.map(z=>z.target),hot:O??c,setHot:u,sceneData:N,traceStep:P},M.id):d.jsx("div",{className:"grid h-full place-items-center px-8 text-center text-ink-3",children:"This scene is about code only. Read it on the left."}),P!==null&&N.trace[P]&&d.jsxs("p",{className:"fade-in pointer-events-none absolute left-1/2 top-3 z-10 max-w-[80%] -translate-x-1/2 rounded-full border border-rule bg-raised/95 px-3.5 py-1.5 text-center text-[13px] leading-snug shadow-float backdrop-blur","aria-live":"polite",children:[d.jsxs("span",{className:"font-tabular mr-2 font-semibold text-poney",children:[c1(P)," · ",P+1," of ",N.trace.length]}),N.trace[P].caption?d.jsx(el,{text:N.trace[P].caption}):e.exists(an(N.trace[P].ref))?e.describe(an(N.trace[P].ref)).title:N.trace[P].ref]}),d.jsx(yS,{walkthrough:t})]})]})})]}),m==="hero"&&_&&d.jsx(xS,{title:_.title,onClose:()=>g(null),children:d.jsx(yu,{view:_,walkthrough:t,marks:r,mode:i,focus:[],callouts:[],hot:c,setHot:u,maxScale:1.4})}),m==="scene"&&M&&d.jsx(xS,{title:`${f+1}. ${Nr(N.title)}`,onClose:()=>g(null),children:d.jsx(yu,{view:M,walkthrough:t,marks:r,mode:a,focus:N.focus,callouts:N.callouts.map(z=>z.target),hot:O??c,setHot:u,maxScale:1.4,sceneData:N,traceStep:P})}),d.jsx("footer",{className:"mx-auto max-w-[1320px] border-t border-rule px-6 py-10 sm:px-10",children:d.jsxs("button",{type:"button",onClick:()=>T.getState().navigate(xt),className:"inline-flex items-center gap-2 text-[14px] font-semibold text-poney hover:underline",children:[d.jsx(n1,{size:15})," Explore the whole system"]})})]})}function CJ({s:t,i:e,count:n,refCb:r,active:s,hot:i,setHot:o,keyOf:a,read:l,onRead:c,answers:u,onAnswer:f,note:h,onNote:m,live:g,tour:p,traceStep:x,onTraceStep:y,edit:v}){const k=(...C)=>E=>v(["scenes",e,...C],E),[w,j]=b.useState(!!h);return d.jsxs("article",{ref:r,"data-index":e,"aria-labelledby":`scene-${t.id}`,className:`scroll-mt-6 border-t border-rule pb-16 pt-10 transition-opacity duration-300 first:border-t-0 first:pt-0 lg:min-h-[85vh] ${s?"":"lg:opacity-55"}`,children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("span",{className:"font-tabular text-[13px] text-ink-3",children:[e+1," of ",n]}),(!p||t.risk==="look")&&d.jsx(qx,{risk:t.risk})]}),d.jsx(Ln,{as:"h3",id:`scene-${t.id}`,label:"Scene title",value:t.title,onSave:k("title"),className:"mt-3 block text-[26px] font-semibold leading-tight tracking-[-0.015em]"}),d.jsx(Ln,{as:"p",multiline:!0,label:"Scene text",value:t.text,onSave:k("text"),className:"mt-4 block text-[16px] leading-[1.7] text-ink-2"}),t.callouts.length>0&&d.jsx("ol",{className:"mt-6 space-y-1","aria-label":"Notes on the diagram",children:t.callouts.map((C,E)=>{const S=a(C.target);return d.jsxs("li",{onMouseEnter:()=>o(S),onMouseLeave:()=>o(null),onFocus:()=>o(S),onBlur:()=>o(null),tabIndex:0,className:`-mx-2 flex cursor-default gap-3 rounded-lg px-2 py-2 outline-none transition-colors ${i===S?"bg-poney-wash":""}`,children:[d.jsx("span",{className:`font-tabular grid h-[22px] w-[22px] shrink-0 place-items-center rounded-full text-[11.5px] font-bold text-paper ${i===S?"bg-poney":"bg-ink"}`,children:E+1}),d.jsx(Ln,{label:`Note ${E+1}`,value:C.text,onSave:k("callouts",E,"text"),className:"text-[14.5px] leading-snug"})]},E)})}),t.trace.length>0&&d.jsxs("div",{className:"mt-8",children:[d.jsx("h4",{className:"text-[13px] font-semibold text-ink-3",children:"Follow the path"}),d.jsx("ol",{className:"mt-2 space-y-0.5",children:t.trace.map((C,E)=>d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>y(E),"aria-current":x===E?"step":void 0,className:`-mx-2 flex w-full items-start gap-3 rounded-lg px-2 py-1.5 text-left transition-colors hover:bg-sunken/70 ${x===E?"bg-poney-wash":""}`,children:[d.jsx("span",{className:`font-tabular mt-px grid h-[19px] w-[19px] shrink-0 place-items-center rounded-[5px] text-[11px] font-bold ${x===E?"bg-poney text-paper":"bg-sunken text-ink-2"}`,children:c1(E)}),d.jsx("span",{className:"text-[14px] leading-snug",children:C.caption?d.jsx(el,{text:C.caption}):C.ref})]})},E))})]}),t.cases.length>0&&d.jsxs("div",{className:"mt-8",children:[d.jsx("h4",{className:"text-[13px] font-semibold text-ink-3",children:"In each case"}),d.jsxs("table",{className:"mt-2 w-full text-left text-[13.5px]",children:[d.jsx("thead",{className:"sr-only",children:d.jsxs("tr",{children:[d.jsx("th",{children:"When"}),d.jsx("th",{children:"Then"})]})}),d.jsx("tbody",{children:t.cases.map((C,E)=>d.jsxs("tr",{className:"border-b border-rule last:border-b-0",children:[d.jsx("td",{className:"py-2.5 pr-4 align-top text-ink-2",children:d.jsx(Ln,{label:"When",value:C.when,onSave:k("cases",E,"when")})}),d.jsxs("td",{className:"py-2.5 align-top",children:[d.jsx(Ln,{label:"Then",value:C.then,onSave:k("cases",E,"then"),className:"font-medium"}),C.note&&d.jsx("span",{className:"block text-[12.5px] text-ink-3",children:C.note})]})]},E))})]})]}),t.proof.length>0&&d.jsxs("div",{className:"mt-8",children:[d.jsx("h4",{className:"text-[13px] font-semibold text-ink-3",children:p?"Tests that show it":"Proof"}),d.jsx("ul",{className:"mt-2 space-y-1.5",children:t.proof.map((C,E)=>d.jsxs("li",{className:"flex items-start gap-2.5 text-[13.5px] leading-snug",children:[C.missing?d.jsx(Nd,{size:15,className:"mt-0.5 shrink-0 text-changed"}):d.jsx(bs,{size:15,strokeWidth:2.6,className:"mt-0.5 shrink-0 text-new"}),d.jsxs("span",{children:[d.jsx("span",{className:C.missing?"text-changed":"",children:C.missing?`No test yet: ${C.text.charAt(0).toLowerCase()}${C.text.slice(1)}`:C.text}),(C.source||C.test)&&d.jsx("code",{className:"block font-mono text-[11.5px] text-ink-3",children:[C.source,C.test].filter(Boolean).join(" › ")})]})]},E))})]}),[...t.question?[t.question]:[],...t.questions].map((C,E)=>{const S=E===0&&t.question?t.id:`${t.id}#${E}`,_=E===0&&t.question?k("question"):k("questions",t.question?E-1:E),N=u[S];return p?d.jsx(_J,{question:C,answer:N??"",onAnswer:M=>f(S,M),live:g},S):d.jsxs("div",{className:"mt-8 rounded-xl border border-changed/40 bg-changed-wash px-4 py-4",children:[d.jsxs("p",{className:"flex items-start gap-2.5 text-[14.5px] leading-snug",children:[d.jsx(aE,{size:17,className:"mt-0.5 shrink-0 text-changed"}),d.jsx(Ln,{label:"Question",value:C,onSave:_})]}),N?d.jsxs("p",{className:"mt-3 flex items-center gap-2 pl-7 text-[13px] text-ink-2",children:[d.jsx(bs,{size:14,className:"text-new"})," You answered: ",d.jsx("strong",{className:"font-semibold text-ink",children:N}),d.jsx("button",{type:"button",className:"text-ink-3 underline-offset-2 hover:underline",onClick:()=>f(S,""),children:"Change"})]}):d.jsxs("div",{className:"mt-3 flex gap-2 pl-7",children:[d.jsx("button",{type:"button",onClick:()=>f(S,"Keep it"),className:"h-8 rounded-lg bg-ink px-3 text-[13px] font-semibold text-paper hover:opacity-90",children:"Keep it"}),d.jsx("button",{type:"button",onClick:()=>f(S,"Ask for a change"),className:"h-8 rounded-lg border border-rule-strong bg-raised px-3 text-[13px] font-semibold hover:bg-sunken",children:"Ask for a change"})]})]},S)}),t.code.length>0&&d.jsxs("div",{className:"mt-8 space-y-4",children:[d.jsx("h4",{className:"text-[13px] font-semibold text-ink-3",children:"The code"}),t.code.map((C,E)=>d.jsx(SJ,{block:C,onEditNote:(S,_)=>k("code",E,"notes",S,"text")(_)},`${E}:${C.path}`))]}),d.jsx("div",{className:"mt-8",children:w?d.jsxs("label",{className:"block",children:[d.jsx("span",{className:"text-[13px] font-semibold text-ink-3",children:g?"Note for the agent":"Your note"}),d.jsx("textarea",{value:h,onChange:C=>m(C.target.value),rows:3,placeholder:g?"What should change here? The agent reads this.":"What should change here?",className:"mt-1.5 w-full resize-y rounded-xl border border-rule bg-raised px-3 py-2.5 text-[14px] leading-snug outline-none placeholder:text-ink-4 focus:border-rule-strong"})]}):d.jsxs("button",{type:"button",onClick:()=>j(!0),className:"text-[13px] font-semibold text-ink-3 hover:text-ink",children:["+ ",g?"Add a note for the agent":"Add a note"]})}),d.jsxs("button",{type:"button",onClick:c,"aria-pressed":l,className:`mt-8 inline-flex h-9 items-center gap-2 rounded-lg px-3.5 text-[13.5px] font-semibold transition-colors ${l?"bg-new-wash text-new":"border border-rule-strong bg-raised hover:bg-sunken"}`,children:[d.jsx(bs,{size:15,strokeWidth:2.6})," ",l?"Read":e+1<n?"Mark as read, then next":"Mark as read"]})]})}function _J({question:t,answer:e,onAnswer:n,live:r}){const[s,i]=b.useState(e),o=e.trim()!==""&&s===e;return d.jsxs("div",{className:"mt-8 rounded-xl border border-rule bg-raised px-4 py-4",children:[d.jsxs("p",{className:"flex items-start gap-2.5 text-[14.5px] font-medium leading-snug",children:[d.jsx(aE,{size:17,className:"mt-0.5 shrink-0 text-poney"}),t]}),d.jsxs("form",{className:"mt-3 pl-7",onSubmit:a=>{a.preventDefault(),n(s.trim())},children:[d.jsx("textarea",{value:s,onChange:a=>i(a.target.value),rows:2,"aria-label":"Your answer",placeholder:"Your answer",className:"w-full resize-y rounded-lg border border-rule bg-paper px-3 py-2 text-[14px] leading-snug outline-none placeholder:text-ink-4 focus:border-rule-strong"}),d.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[d.jsx("button",{type:"submit",disabled:!s.trim()||o,className:"h-8 rounded-lg bg-ink px-3 text-[13px] font-semibold text-paper disabled:opacity-35",children:o?"Saved":"Save answer"}),o&&d.jsx("span",{className:"text-[12.5px] text-ink-3",children:r?"The agent can read it. Ask it whether you are right.":"Kept in this browser."})]})]})]})}function NJ({count:t,step:e,playing:n,onPlay:r,onPause:s,onStep:i}){const o="grid h-7 w-7 place-items-center rounded-md text-ink-2 hover:bg-sunken disabled:opacity-30";return d.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border border-rule bg-sunken/60 p-0.5",role:"group","aria-label":"Play the path",children:[d.jsx("button",{type:"button",className:o,"aria-label":"Previous step",disabled:e===null||e===0,onClick:()=>i((e??0)-1),children:d.jsx(nN,{size:15})}),n?d.jsxs("button",{type:"button",onClick:s,className:"inline-flex h-7 items-center gap-1.5 rounded-md bg-raised px-2.5 text-[12.5px] font-semibold text-ink shadow-[0_1px_2px_#0000001a]",children:[d.jsx(PD,{size:13})," Pause"]}):d.jsxs("button",{type:"button",onClick:r,className:"inline-flex h-7 items-center gap-1.5 rounded-md bg-raised px-2.5 text-[12.5px] font-semibold text-ink shadow-[0_1px_2px_#0000001a]",children:[d.jsx(LD,{size:13})," ",e===null?"Play the path":e>=t-1?"Again":"Play"]}),d.jsx("button",{type:"button",className:o,"aria-label":"Next step",disabled:e!==null&&e>=t-1,onClick:()=>i(e===null?0:e+1),children:d.jsx(_d,{size:15})})]})}function EJ(){const t=T(o=>o.theme),e=T(o=>o.viewId),n=T(o=>o.selection),r=ze(),s=e===xt?void 0:r.views.get(e),i=r.doc.walkthroughs.find(o=>o.id===bp(e));return b.useEffect(()=>{document.documentElement.dataset.theme=t,document.documentElement.dataset.poneyTheme=t},[t]),b.useEffect(()=>QF(e,n,n?de(n):null),[e,n]),b.useEffect(()=>{const o=r.doc.project.name,a=(i?Nr(i.title):void 0)??(s==null?void 0:s.title);document.title=a&&a!==o?`${a} · ${o} · Poney`:`${o} · Poney`},[s,i,r.doc.project.name]),b.useEffect(()=>KF(),[]),b.useEffect(()=>{const o=a=>{const l=T.getState(),c=a.metaKey||a.ctrlKey;if(c&&a.key.toLowerCase()==="k"){a.preventDefault(),l.setPaletteOpen(!l.paletteOpen);return}if(c&&a.shiftKey&&a.key.toLowerCase()==="c"){a.preventDefault(),T1();return}if(!(O1(a.target)||l.paletteOpen||l.importOpen||l.shortcutsOpen)){if(a.key==="F2"&&l.selection){const u=document.querySelector(`[data-ref="${CSS.escape(de(l.selection))}"]`);if(u&&A1(l.selection,u))return void a.preventDefault()}if(c&&a.key.toLowerCase()==="z")return a.preventDefault(),void(a.shiftKey?l.redo():l.undo());if(c&&a.key.toLowerCase()==="y")return a.preventDefault(),void l.redo();if(a.altKey&&a.key==="ArrowLeft")return a.preventDefault(),void l.goBack();if(a.altKey&&a.key==="ArrowRight")return a.preventDefault(),void l.goForward();if(!(c||a.altKey))switch(a.key){case"/":a.preventDefault(),l.setPaletteOpen(!0);break;case"[":l.toggleSidebar();break;case"]":l.toggleInspector();break;case"Escape":l.selection&&l.select(null);break;case"f":case"F":l.selection&&l.requestFocus("zoom",l.selection);break;case"!":l.requestFocus("fit");break;case")":l.requestFocus("reset");break;case"?":l.setShortcutsOpen(!0);break;case"o":l.navigate(xt);break;default:return}}};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[]),d.jsxs(PM,{children:[d.jsxs("div",{className:"flex h-full flex-col bg-plaster text-ink",children:[d.jsx("a",{href:"#main",className:"sr-only focus:not-sr-only focus:absolute focus:left-2 focus:top-2 focus:z-50 focus:rounded focus:bg-raised focus:px-3 focus:py-2",children:"Skip to diagram"}),d.jsx(y9,{}),d.jsxs("div",{className:"flex min-h-0 flex-1",children:[d.jsx(w9,{}),d.jsx("main",{id:"main",className:"relative min-w-0 flex-1","aria-label":i?`Walkthrough: ${Nr(i.title)}`:s?`${s.title} diagram`:"Project overview",children:i?d.jsx(jJ,{walkthrough:i},i.id):s?d.jsx(cB,{view:s},s.id):d.jsx(hB,{})}),!i&&d.jsx(U9,{})]})]}),d.jsx(DV,{}),d.jsx(LT,{}),d.jsx(BV,{}),d.jsx(VV,{})]})}const $A="poney:recent",MA="poney:last",$J=8;function fl(){try{const t=localStorage.getItem($A);return t?JSON.parse(t):[]}catch{return[]}}function TA(t){try{localStorage.setItem($A,JSON.stringify(t.slice(0,$J)))}catch{}}function MJ(t,e,n){const r={id:t.project.id,name:t.project.name,description:t.project.description,origin:e,at:new Date().toISOString(),json:qv(t),...n?{path:n}:{}};TA([r,...fl().filter(s=>s.id!==t.project.id)]);try{sessionStorage.setItem(MA,t.project.id)}catch{}}function TJ(t){TA(fl().filter(e=>e.id!==t))}async function OA(t){if(t.path&&T.getState().live.state==="on")try{return await QM(t.path),!0}catch{}const e=yl(JSON.parse(t.json),{extensions:Td()});return!e.ok||!e.document?!1:(T.getState().loadDocument(e.document,t.origin),!0)}function OJ(){let t=new URLSearchParams(window.location.search).get("doc");try{t??(t=sessionStorage.getItem(MA))}catch{if(!t)return!1}const e=fl().find(n=>n.id===t&&n.origin!=="example");return e?(OA(e),!0):!1}function AJ(){let t=0,e;T.subscribe(n=>{var r;RJ(n.history&&!n.startOpen&&((r=n.projects.find(s=>s.id===n.projectId))==null?void 0:r.origin)!=="example"?n.projectId:null),!(!n.history||n.startOpen||n.history.present===e)&&(e=n.history.present,clearTimeout(t),t=window.setTimeout(()=>{const s=T.getState(),i=s.projects.find(o=>o.id===s.projectId);s.history&&(i==null?void 0:i.origin)!=="example"&&MJ(s.history.present,(i==null?void 0:i.origin)??"imported",s.live.state==="on"?s.liveFile??void 0:void 0)},600))})}function RJ(t){const e=new URL(window.location.href);(e.searchParams.get("doc")??null)!==t&&(t?e.searchParams.set("doc",t):e.searchParams.delete("doc"),window.history.replaceState(window.history.state,"",e))}async function AA(){var n,r;const{commerce:t}=await Uv(async()=>{const{commerce:s}=await import("./src-Br__iChL.js");return{commerce:s}},[]),e=yl(t,{extensions:Td()});if(!e.ok||!e.document)throw new Error(`The example is invalid: ${(n=e.issues[0])==null?void 0:n.path} ${(r=e.issues[0])==null?void 0:r.message}`);T.getState().loadDocument(e.document,"example")}const IJ={command:"npx",args:["-y","--package=@hattoriai/poney","poney-mcp"]},kS=t=>[t.command,...t.args].map(e=>/\s/.test(e)?`"${e}"`:e).join(" "),xg=[{id:"claude",name:"Claude Code",how:"Run in a terminal:",text:t=>`claude mcp add poney -- ${kS(t)}`},{id:"codex",name:"Codex",how:"Run in a terminal:",text:t=>`codex mcp add poney -- ${kS(t)}`},{id:"opencode",name:"OpenCode",how:"Add to opencode.json:",text:t=>JSON.stringify({mcp:{poney:{type:"local",command:[t.command,...t.args],enabled:!0}}},null,2)},{id:"copilot",name:"Copilot",how:"Add to ~/.copilot/mcp-config.json:",text:t=>JSON.stringify({mcpServers:{poney:{type:"local",command:t.command,args:t.args,tools:["*"]}}},null,2)},{id:"other",name:"Other",how:"Add to its MCP settings:",text:t=>JSON.stringify({mcpServers:{poney:{command:t.command,args:t.args}}},null,2)}];function wS(){const t=T(c=>c.live.state==="on"),[e,n]=b.useState(IJ),[r,s]=b.useState(xg[0].id),[i,o]=b.useState(!1);b.useEffect(()=>{t&&R1().then(c=>c.mcpServer&&n(c.mcpServer),()=>{})},[t]);const a=xg.find(c=>c.id===r),l=a.text(e);return d.jsxs("div",{children:[d.jsx("div",{role:"tablist","aria-label":"Your agent",className:"flex flex-wrap gap-1",children:xg.map(c=>d.jsx("button",{type:"button",role:"tab","aria-selected":c.id===r,onClick:()=>(s(c.id),o(!1)),className:`h-7 rounded-md px-2 text-[12.5px] font-medium ${c.id===r?"bg-sunken text-ink":"text-ink-3 hover:text-ink"}`,children:c.name},c.id))}),d.jsx("p",{className:"mt-2 text-[12.5px] text-ink-3",children:a.how}),d.jsxs("div",{className:"relative mt-1",children:[d.jsx("pre",{className:"scrollbar-quiet overflow-x-auto whitespace-pre-wrap break-all rounded-lg bg-sunken py-2 pl-2.5 pr-9 font-mono text-[11.5px] text-ink",children:l}),d.jsx("button",{type:"button","aria-label":"Copy",title:"Copy",onClick:()=>{var c;return void((c=navigator.clipboard)==null?void 0:c.writeText(l).then(()=>o(!0)))},className:"absolute right-1.5 top-1.5 grid h-6 w-6 place-items-center rounded-md text-ink-3 hover:bg-raised hover:text-ink",children:i?d.jsx(bs,{size:13}):d.jsx(Qo,{size:13})})]})]})}const _c="#/start";function PJ(){const t=T(S=>S.theme),e=T(S=>S.live),n=T(S=>!!S.history),r=T(S=>S.projects),s=T(S=>S.sidebarOpen),[i,o]=b.useState(()=>fl()),[a,l]=b.useState(null),[c,u]=b.useState(!1),[f,h]=b.useState(!1),m=b.useRef(null);b.useEffect(()=>{document.documentElement.dataset.theme=t,document.documentElement.dataset.poneyTheme=t,document.title="Poney Studio"},[t]),b.useEffect(()=>{window.location.hash!==_c&&window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}${_c}`)},[]);const g=(S,_,N)=>{const M=M1(S);if(!M.ok)return l({title:`${N} is not a Poney document`,lines:M.issues.slice(0,6).map(P=>P.path?`${P.path}: ${P.message}`:P.message)});l(null),T.getState().loadDocument(M.doc,_)};b.useEffect(()=>{const S=_=>{var M;if(O1(_.target)||T.getState().importOpen)return;const N=((M=_.clipboardData)==null?void 0:M.getData("text/plain"))??"";if(N.trim()){if(_.preventDefault(),Mp(N).kind==="unknown")return l({title:"The clipboard has no Poney document",lines:['Copy Poney JSON (it has "poneyVersion") or a Mermaid diagram, then paste again.']});g(N,"pasted","The pasted text")}};return window.addEventListener("paste",S),()=>window.removeEventListener("paste",S)},[]);const p=async S=>g(await S.text(),"imported",`“${S.name}”`),x=async()=>{h(!0);try{await AA()}catch(S){l({title:"The example did not open",lines:[S instanceof Error?S.message:String(S)]})}finally{h(!1)}},y=/Mac|iPhone|iPad/.test(navigator.platform)?"⌘":"Ctrl+",v=()=>{var S;return e.state==="on"?T.getState().setFileOpen(!0):(S=m.current)==null?void 0:S.click()},k="group flex w-full items-start gap-4 rounded-xl px-4 py-3.5 text-left transition-colors hover:bg-sunken/70 focus-visible:bg-sunken/70 outline-none",w=S=>{const _=T.getState();if(_.history&&_.projectId===S.id)return _.showStart(!1);OA(S).then(N=>N||l({title:`“${S.name}” no longer opens`,lines:["It may come from an older version of Poney, or its file moved. Remove it from the list."]}))},j=r.filter(S=>S.origin!=="example"),C=i.filter(S=>S.origin!=="example"&&!r.some(_=>_.id===S.id)),E="flex w-full min-w-0 items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-[13.5px] hover:bg-sunken";return d.jsxs(PM,{children:[d.jsxs("div",{className:"flex h-full flex-col bg-plaster text-ink",children:[d.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-1 border-b border-rule bg-paper px-2",children:[d.jsx(rt,{label:s?"Hide sidebar":"Show sidebar",onClick:()=>T.getState().toggleSidebar(),side:"bottom",children:d.jsx(gE,{size:16})}),d.jsx("span",{className:"ml-2 text-[13px] font-semibold",children:"Start"}),d.jsx("span",{className:"flex-1"}),d.jsx(rt,{label:t==="light"?"Dark theme":"Light theme",onClick:()=>T.getState().toggleTheme(),side:"bottom",children:t==="light"?d.jsx(o1,{size:16}):d.jsx(HE,{size:16})})]}),d.jsxs("div",{className:"flex min-h-0 flex-1",children:[d.jsxs("aside",{"aria-label":"Documents",className:`scrollbar-quiet flex w-[264px] shrink-0 flex-col overflow-y-auto border-r border-rule bg-paper transition-[margin] duration-200 max-lg:hidden ${s?"ml-0":"-ml-[264px]"}`,children:[d.jsxs("div",{className:"flex items-center gap-2.5 p-3.5",children:[d.jsx(sT,{}),d.jsxs("span",{className:"min-w-0",children:[d.jsx("span",{className:"block truncate text-[13.5px] font-semibold",children:"Poney Studio"}),d.jsx("span",{className:"block truncate text-[11.5px] text-ink-3",children:j.length?`${j.length} open`:"Nothing open"})]})]}),d.jsx("div",{className:"px-2",children:d.jsxs("button",{type:"button",className:`${E} text-ink-2`,onClick:v,children:[d.jsx(mw,{size:14,className:"shrink-0 text-ink-3"})," Open a file…"]})}),j.length>0&&d.jsxs("nav",{"aria-label":"Open documents",className:"mt-4 px-2",children:[d.jsx("h2",{className:"px-2 pb-1 text-[11.5px] font-medium text-ink-3",children:"Open"}),j.map(S=>d.jsxs("button",{type:"button",className:E,onClick:()=>S.id===T.getState().projectId?T.getState().showStart(!1):T.getState().switchProject(S.id),children:[d.jsx(Bf,{size:14,className:"shrink-0 text-ink-3"}),d.jsx("span",{className:"truncate",children:S.doc.project.name})]},S.id))]}),C.length>0&&d.jsxs("nav",{"aria-label":"Recent documents",className:"mt-4 px-2 pb-4",children:[d.jsx("h2",{className:"px-2 pb-1 text-[11.5px] font-medium text-ink-3",children:"Recent"}),C.map(S=>d.jsxs("div",{className:"group relative",children:[d.jsxs("button",{type:"button",className:`${E} pr-8`,onClick:()=>w(S),title:`${S.name}, ${bS(S.at)}`,children:[d.jsx(Bf,{size:14,className:"shrink-0 text-ink-3"}),d.jsxs("span",{className:"min-w-0",children:[d.jsx("span",{className:"block truncate",children:S.name}),d.jsxs("span",{className:"block truncate text-[11.5px] text-ink-3",children:[S.origin==="example"?"Example":S.origin==="live"?"From an agent":S.origin==="pasted"?"Pasted":"File",", ",bS(S.at)]})]})]}),d.jsx("button",{type:"button","aria-label":`Remove ${S.name} from the list`,title:"Remove from the list",onClick:()=>{TJ(S.id),o(fl())},className:"absolute right-1 top-1/2 -translate-y-1/2 rounded p-1 text-ink-4 opacity-0 hover:bg-raised hover:text-ink focus-visible:opacity-100 group-hover:opacity-100",children:d.jsx(zo,{size:13})})]},S.id))]})]}),d.jsxs("div",{className:"scrollbar-quiet relative min-w-0 flex-1 overflow-y-auto bg-paper text-ink",onDragOver:S=>{S.preventDefault(),u(!0)},onDragLeave:S=>{S.currentTarget===S.target&&u(!1)},onDrop:S=>{S.preventDefault(),u(!1);const _=S.dataTransfer.files[0];_&&p(_)},children:[d.jsxs("main",{className:"mx-auto grid max-w-[1080px] gap-x-14 gap-y-12 px-6 pb-20 pt-14 sm:px-10 sm:pt-20 xl:grid-cols-[minmax(0,7fr)_minmax(0,5fr)]",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-[14px] font-semibold text-poney",children:"Poney Studio"}),d.jsx("h1",{className:"mt-3 max-w-[18ch] text-[36px] font-semibold leading-[1.08] tracking-[-0.025em] sm:text-[44px]",children:"Software, explained in diagrams."}),d.jsx("p",{className:"mt-5 max-w-[52ch] text-[17px] leading-relaxed text-ink-2",children:"An agent writes walkthroughs of a change, or tours of a codebase. You read them here, explore the system, and ask the agent questions."}),n&&d.jsxs("button",{type:"button",onClick:()=>T.getState().showStart(!1),className:"mt-6 text-[14px] font-semibold text-poney hover:underline",children:["Back to “",T.getState().history.present.project.name,"”"]}),d.jsxs("section",{"aria-labelledby":"open",className:"mt-12",children:[d.jsx("h2",{id:"open",className:"px-4 text-[13px] font-semibold text-ink-3",children:"Open"}),d.jsxs("div",{className:"mt-2",children:[e.state==="on"&&d.jsxs("button",{type:"button",className:k,onClick:()=>T.getState().setProjectOpen(!0),children:[d.jsx(s1,{size:19,className:"mt-0.5 shrink-0 text-ink-2"}),d.jsxs("span",{children:[d.jsx("span",{className:"block text-[15.5px] font-semibold",children:"Open a project"}),d.jsx("span",{className:"mt-0.5 block text-[13.5px] text-ink-3",children:"A folder or a Git repository. Its Poney document opens."})]})]}),d.jsxs("button",{type:"button",className:k,onClick:v,children:[d.jsx(mw,{size:19,className:"mt-0.5 shrink-0 text-ink-2"}),d.jsxs("span",{children:[d.jsx("span",{className:"block text-[15.5px] font-semibold",children:"Open a file"}),d.jsx("span",{className:"mt-0.5 block text-[13.5px] text-ink-3",children:"A .poney or Mermaid file. You can also drop it here."})]})]}),d.jsxs("button",{type:"button",className:k,onClick:()=>T.getState().setImportOpen(!0),children:[d.jsx(mN,{size:19,className:"mt-0.5 shrink-0 text-ink-2"}),d.jsxs("span",{children:[d.jsx("span",{className:"block text-[15.5px] font-semibold",children:"Paste a document"}),d.jsxs("span",{className:"mt-0.5 block text-[13.5px] text-ink-3",children:["Poney JSON or Mermaid. Or press ",d.jsxs("kbd",{className:"rounded border border-rule bg-raised px-1 font-sans text-[12px]",children:[y,"V"]})," anywhere on this page."]})]})]}),d.jsxs("button",{type:"button",className:k,onClick:()=>void x(),disabled:f,children:[d.jsx(K_,{size:19,className:"mt-0.5 shrink-0 text-ink-2"}),d.jsxs("span",{children:[d.jsx("span",{className:"block text-[15.5px] font-semibold",children:f?"Opening the example…":"Try the example"}),d.jsx("span",{className:"mt-0.5 block text-[13.5px] text-ink-3",children:"Kestrel Commerce, an online store: a walkthrough of one change, and a tour of the code."})]})]})]}),d.jsx("input",{ref:m,type:"file",accept:".poney,.json,.mmd,.mermaid,.txt,application/json",className:"hidden",onChange:S=>{var N;const _=(N=S.target.files)==null?void 0:N[0];_&&p(_),S.target.value=""}}),a&&d.jsxs("div",{role:"alert",className:"mx-4 mt-4 rounded-xl border border-removed/40 bg-removed-wash px-4 py-3",children:[d.jsx("p",{className:"text-[14px] font-semibold text-removed",children:a.title}),d.jsx("ul",{className:"mt-1.5 space-y-0.5 font-mono text-[12px] text-ink-2",children:a.lines.map((S,_)=>d.jsx("li",{children:S},_))})]})]})]}),d.jsx("aside",{"aria-labelledby":"agent",className:"xl:pt-[164px]",children:d.jsxs("div",{className:"rounded-2xl border border-rule bg-raised px-5 py-5",children:[d.jsx("h2",{id:"agent",className:"text-[15.5px] font-semibold",children:"Agent"}),d.jsx(DJ,{})]})})]}),c&&d.jsx("div",{className:"pointer-events-none fixed inset-3 z-50 grid place-items-center rounded-3xl border-2 border-dashed border-poney bg-poney-wash/80",children:d.jsx("p",{className:"text-[18px] font-semibold text-poney",children:"Drop to open"})})]})]})]}),d.jsx(LT,{})]})}function bS(t){const e=new Date(t),n=Math.floor((Date.now()-e.getTime())/864e5);return n<=0?"today":n===1?"yesterday":n<7?`${n} days ago`:e.toLocaleDateString(void 0,{day:"numeric",month:"short"})}function DJ(){const t=T(i=>i.live.state==="on"),{session:e,listening:n}=T(i=>i.agent),r="mt-3 inline-flex h-9 items-center gap-2 rounded-lg bg-ink px-3.5 text-[13.5px] font-semibold text-paper hover:opacity-90",s="mt-1.5 block break-all rounded-lg bg-sunken px-2.5 py-2 font-mono text-[11.5px] text-ink";return e||n?d.jsxs("div",{className:"mt-3 text-[14px] leading-snug text-ink-2",children:[d.jsxs("p",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-new","aria-hidden":!0}),e?d.jsxs("span",{children:[d.jsx("span",{className:"font-semibold text-ink",children:e.name})," is ready in ",e.cwd.split("/").pop(),"."]}):"Linked from your terminal."]}),d.jsxs("button",{type:"button",onClick:()=>T.getState().setAgentPanelOpen(!0),className:r,children:[d.jsx(Yi,{size:15})," Ask the agent"]})]}):t?d.jsxs("div",{className:"mt-3 text-[14px] leading-snug text-ink-2",children:[d.jsxs("button",{type:"button",onClick:()=>T.getState().setConnectOpen(!0),className:r,children:[d.jsx(xp,{size:15})," Connect an agent"]}),d.jsx("p",{className:"mt-4 border-t border-rule pt-4 text-[13px] font-semibold text-ink",children:"Or use the one in your terminal"}),d.jsx("div",{className:"mt-2",children:d.jsx(wS,{})})]}):d.jsxs("div",{className:"mt-3 text-[14px] leading-snug text-ink-2",children:[d.jsx("p",{children:"Agents need Poney running on this computer. In the Poney folder, run:"}),d.jsx("code",{className:s,children:"npm run studio"}),d.jsx("p",{className:"mt-4 border-t border-rule pt-4 text-[13px] font-semibold text-ink",children:"Or use the one in your terminal"}),d.jsx("div",{className:"mt-2",children:d.jsx(wS,{})})]})}const zJ=Hp.create({name:"chip",group:"inline",inline:!0,atom:!0,selectable:!1,addAttributes:()=>({ref:{default:null},title:{default:""},kind:{default:""},quote:{default:null}}),parseHTML:()=>[{tag:"span[data-chip]"}],renderHTML:({node:t,HTMLAttributes:e})=>["span",Ii(e,{"data-chip":"",title:t.attrs.quote??t.attrs.ref??"",class:"mx-px inline-flex max-w-[16rem] items-baseline gap-1 truncate rounded-md border border-poney/30 bg-poney-wash px-1.5 align-baseline text-[12.5px] leading-[1.45]"}),["span",{class:"text-ink-3"},t.attrs.kind==="text"?"“":t.attrs.kind],["span",{class:"font-medium text-ink"},`${t.attrs.title}${t.attrs.kind==="text"?"”":""}`]],renderText:({node:t})=>`“${t.attrs.title}”`});function LJ(t){const e=[];return{text:(t.content??[]).map(r=>(r.content??[]).map(s=>{if(s.type!=="chip")return s.text??"";const i=s.attrs;return e.some(o=>i.ref?o.ref===i.ref:o.quote===i.quote)||e.push({...i.ref?{ref:i.ref}:{},title:i.title,kind:i.kind,...i.quote?{quote:i.quote}:{}}),`“${i.title}”`}).join("")).join(`
887
- `).trim(),context:e}}function FJ({placeholder:t,onSend:e,actions:n}){const[r,s]=b.useState(!0),i=b.useRef(()=>{}),o=cA({extensions:[hA,pA,mA,zJ],immediatelyRender:!0,autofocus:"end",editorProps:{attributes:{class:"min-h-[112px] max-h-[45vh] overflow-y-auto px-3 py-2.5 text-[14px] leading-snug outline-none",role:"textbox","aria-multiline":"true","aria-label":"Your question"},handleKeyDown:(l,c)=>c.key==="Enter"&&!c.shiftKey&&!c.isComposing?(i.current(),!0):!1},onUpdate:({editor:l})=>s(l.isEmpty)}),a=T(l=>l.chips.length);return b.useEffect(()=>{if(!o)return;const l=T.getState().takeChips();l.length&&(BJ(o,l),s(!1))},[a,o]),i.current=()=>{if(!o)return;const l=LJ(o.getJSON());l.text&&e(l).then(c=>{c&&(o.commands.clearContent(),s(!0))})},d.jsxs("div",{className:"flex items-end gap-2",children:[d.jsxs("div",{className:"relative min-w-0 flex-1 rounded-xl border border-rule bg-paper focus-within:border-rule-strong [&_p]:m-0",children:[r&&d.jsx("span",{className:"pointer-events-none absolute left-3 top-2.5 text-[14px] text-ink-4",children:t}),d.jsx(g0,{editor:o})]}),n(()=>i.current(),r)]})}function BJ(t,e){const n=e.flatMap(r=>[{type:"chip",attrs:{ref:r.ref??null,title:r.title,kind:r.kind,quote:r.quote??null}},{type:"text",text:" "}]);t.chain().focus().insertContent(n).run()}function VJ(){const t=T(a=>a.agent.session),[e,n]=b.useState(null);if(!t)return null;const r=a=>a.then(()=>n(null)).catch(l=>n(l instanceof Error?l.message:String(l))),s=t.settings.find(a=>a.category==="model"),i=t.settings.find(a=>a.category==="effort"),o=t.settings.filter(a=>a.category==="speed");return d.jsxs("div",{className:"mt-1.5",children:[d.jsxs("div",{className:"flex items-center gap-1 text-[12.5px]",children:[d.jsx(WJ,{session:t,model:s,onError:n,run:r}),d.jsx("span",{className:"flex-1"}),(i||o.length>0)&&d.jsx(IA,{label:i?RA(i):"Options",title:"Effort and options",children:a=>d.jsxs(d.Fragment,{children:[o.map(l=>d.jsx(Kx,{title:l.name,children:pd(l).map(c=>d.jsx(qi,{on:l.current===c.value,label:c.name,hint:c.description,onClick:()=>(a(),r(ux(l.id,c.value)))},String(c.value)))},l.id)),i&&d.jsx(Kx,{title:i.name,children:pd(i).map(l=>d.jsx(qi,{on:i.current===l.value,label:l.name,hint:l.description,onClick:()=>(a(),r(ux(i.id,l.value)))},String(l.value)))})]})})]}),e&&d.jsx("p",{className:"mt-1 text-[12px] text-removed",children:e})]})}function WJ({session:t,model:e,run:n,onError:r}){const[s,i]=b.useState(e?"models":"agents"),[o,a]=b.useState([]),[l,c]=b.useState(""),u=e?`${t.name} · ${RA(e)}`:t.name;return d.jsx(IA,{label:u,title:"Agent and model",align:"left",onOpen:()=>{i(e?"models":"agents"),c(""),R1().then(f=>a(f.providers.filter(h=>h.available)),()=>r("The list of agents is not available."))},children:f=>s==="agents"?d.jsxs(d.Fragment,{children:[d.jsxs(Kx,{title:"Agent",children:[o.map(h=>d.jsx(qi,{on:h.id===t.providerId,label:h.name,trailing:h.id===t.providerId&&e?d.jsx(_d,{size:13}):void 0,onClick:()=>{if(h.id===t.providerId)return e?i("models"):f();f(),n(bb(t.cwd,{providerId:h.id}))}},h.id)),fx().map(h=>{const m=`custom:${h.name}`;return d.jsx(qi,{on:m===t.providerId,label:h.name,onClick:()=>{f(),m!==t.providerId&&n(bb(t.cwd,{custom:h}))}},m)})]}),d.jsx("div",{className:"my-1 h-px bg-rule"}),d.jsx(qi,{label:"Configure…",icon:d.jsx(qD,{size:13}),onClick:()=>(f(),T.getState().setConnectOpen(!0))})]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"px-2.5 pb-1 pt-1.5 text-[11.5px] font-semibold text-ink-3",children:t.name}),d.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:pd(e).filter(h=>!l||h.name.toLowerCase().includes(l.toLowerCase())).map(h=>d.jsx(qi,{on:e.current===h.value,label:h.name,hint:h.description,tags:[...h.recommended?["Recommended"]:[],...e.initial===h.value&&!h.recommended?["Your setting"]:[]],onClick:()=>(f(),n(ux(e.id,h.value)))},String(h.value)))}),pd(e).length>8&&d.jsx("input",{autoFocus:!0,value:l,onChange:h=>c(h.target.value),placeholder:"Search models…","aria-label":"Search models",className:"mx-1 my-1 h-8 w-[calc(100%-8px)] rounded-md border border-rule bg-paper px-2 text-[12.5px] focus:border-rule-strong",style:{outline:"none"}}),d.jsx("div",{className:"my-1 h-px bg-rule"}),d.jsx(qi,{label:"Other agents",icon:d.jsx(L_,{size:13}),onClick:()=>i("agents")})]})})}const pd=t=>t.kind==="boolean"?[{value:!0,name:"On"},{value:!1,name:"Off"}]:t.options,RA=t=>{var e;return((e=pd(t).find(n=>n.value===t.current))==null?void 0:e.name)??String(t.current)};function IA({label:t,title:e,align:n="right",onOpen:r,children:s}){const[i,o]=b.useState(!1),[a,l]=b.useState(null),c=b.useRef(null),u=b.useRef(null);return b.useEffect(()=>{if(!i)return;const f=m=>{var g;return!((g=c.current)!=null&&g.contains(m.target))&&o(!1)},h=m=>m.key==="Escape"&&o(!1);return window.addEventListener("pointerdown",f,!0),window.addEventListener("keydown",h),()=>{window.removeEventListener("pointerdown",f,!0),window.removeEventListener("keydown",h)}},[i]),d.jsxs("div",{ref:c,className:"relative min-w-0",children:[d.jsxs("button",{ref:u,type:"button","aria-haspopup":"menu","aria-expanded":i,title:e,onClick:()=>{if(!i){r==null||r();const f=u.current.getBoundingClientRect();l({...n==="left"?{left:f.left}:{right:window.innerWidth-f.right},bottom:window.innerHeight-f.top+6,maxHeight:f.top-16})}o(!i)},className:`inline-flex h-7 max-w-full items-center gap-1 rounded-md px-2 font-medium text-ink-2 hover:bg-sunken hover:text-ink ${i?"bg-sunken text-ink":""}`,children:[d.jsx("span",{className:"truncate",children:t}),d.jsx(eN,{size:12,className:"shrink-0"})]}),i&&a&&d.jsx("div",{role:"menu","aria-label":e,className:"fade-in fixed z-50 flex w-72 flex-col overflow-y-auto rounded-xl border border-rule bg-raised p-1 shadow-float",style:a,children:s(()=>o(!1))})]})}function Kx({title:t,children:e}){return d.jsxs("div",{className:"[&+&]:mt-1 [&+&]:border-t [&+&]:border-rule [&+&]:pt-1",children:[d.jsx("div",{className:"px-2.5 pb-0.5 pt-1.5 text-[11.5px] font-semibold text-ink-3",children:t}),e]})}function qi({label:t,hint:e,tags:n=[],on:r,icon:s,trailing:i,onClick:o}){return d.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":!!r,onClick:o,title:e,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-[13px] hover:bg-sunken",children:[s&&d.jsx("span",{className:"shrink-0 text-ink-3",children:s}),d.jsx("span",{className:"min-w-0 flex-1",children:d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx("span",{className:"truncate",children:t}),n.map(a=>d.jsx("span",{className:`shrink-0 rounded-full px-1.5 text-[10.5px] font-semibold ${a==="Recommended"?"bg-new-wash text-new":"bg-sunken text-ink-3"}`,children:a},a))]})}),r&&d.jsx(bs,{size:13,className:"shrink-0 text-poney"}),i&&d.jsx("span",{className:"shrink-0 text-ink-3",children:i})]})}function UJ(){const t=T(g=>g.live.state==="on"),e=T(g=>g.agentPanelOpen),n=T(g=>g.setAgentPanelOpen),r=T(g=>g.conversation),{session:s,listening:i}=T(g=>g.agent),[o,a]=b.useState(0),l=b.useRef(null),c=r.filter(g=>g.from==="agent"||g.from==="permission").length,u=e?0:Math.max(0,c-o);b.useEffect(()=>{e&&a(c)},[e,c]),b.useEffect(()=>{var g,p;e&&((p=(g=l.current)==null?void 0:g.lastElementChild)==null||p.scrollIntoView({block:"end"}))},[e,r]);const f=T(g=>{var p;return(p=g.history)==null?void 0:p.present});if(!t)return null;if(!e)return d.jsxs("button",{type:"button",onClick:()=>n(!0),className:"fixed bottom-5 right-5 z-30 inline-flex h-11 items-center gap-2 rounded-full bg-ink pl-4 pr-5 text-[14px] font-semibold text-paper shadow-float hover:opacity-95",children:[s!=null&&s.busy?d.jsx(So,{size:17,className:"animate-spin"}):d.jsx(Yi,{size:17}),"Agent",u>0&&d.jsx("span",{className:"font-tabular ml-1 grid h-5 min-w-5 place-items-center rounded-full bg-poney px-1.5 text-[11.5px] text-paper",children:u})]});const h=p9(f),m=!s&&r.length>0&&r[r.length-1].from==="person";return d.jsxs("section",{"aria-label":"Agent",className:"fade-in fixed bottom-5 right-5 z-30 flex max-h-[min(680px,80vh)] w-[min(420px,calc(100vw-2.5rem))] flex-col overflow-hidden rounded-2xl border border-rule bg-raised shadow-float",children:[d.jsxs("header",{className:"flex items-start gap-3 border-b border-rule px-4 py-3",children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("h2",{className:"text-[14px] font-semibold",children:s?s.name:"Agent"}),d.jsxs("p",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 text-[12px] text-ink-3",children:[d.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${s||i?"bg-new":"bg-ink-4"}`,"aria-hidden":!0}),s?d.jsxs("span",{className:"truncate",title:s.cwd,children:[s.busy?"Working":"Ready"," in ",s.cwd.split("/").slice(-2).join("/")]}):i?"Linked from another session":m?"Waiting for an agent":"Not connected"]})]}),s&&d.jsx("button",{type:"button",onClick:()=>void r9(),title:"Stop the agent",className:"rounded-md px-2 py-1 text-[12px] font-medium text-ink-3 hover:bg-sunken hover:text-ink",children:"Disconnect"}),d.jsx("button",{type:"button","aria-label":"Close",onClick:()=>n(!1),className:"rounded-md p-1 text-ink-3 hover:bg-sunken hover:text-ink",children:d.jsx(zo,{size:16})})]}),d.jsxs("ol",{ref:l,className:"scrollbar-quiet min-h-0 flex-1 space-y-3 overflow-y-auto px-4 py-4","aria-live":"polite",children:[r.length===0&&d.jsx(ZJ,{}),r.map(g=>d.jsx(HJ,{m:g},g.id)),(s==null?void 0:s.busy)&&d.jsxs("li",{className:"flex items-center gap-2 text-[12.5px] text-ink-3",children:[d.jsx(So,{size:13,className:"animate-spin"})," Working…"]})]}),s&&r.filter(g=>g.from==="person").length===0&&d.jsx("div",{className:"flex flex-wrap gap-1.5 border-t border-rule px-3 py-3",children:h.map(g=>d.jsx("button",{type:"button",onClick:()=>void Tp(g.prompt),className:"rounded-full border border-rule bg-paper px-3 py-1.5 text-[12.5px] font-medium hover:border-rule-strong",children:g.label},g.label))}),d.jsx(qJ,{busy:!!(s!=null&&s.busy)})]})}function ZJ(){const{session:t,listening:e}=T(n=>n.agent);return t||e?d.jsx("li",{className:"text-[13.5px] leading-snug text-ink-3",children:"It sees the scene you are on and what you select."}):d.jsx("li",{className:"space-y-2.5 text-[13.5px] leading-snug",children:d.jsxs("button",{type:"button",onClick:()=>T.getState().setConnectOpen(!0),className:"inline-flex h-9 items-center gap-2 rounded-lg bg-ink px-3.5 text-[13.5px] font-semibold text-paper hover:opacity-90",children:[d.jsx(xp,{size:15})," Connect an agent"]})})}function HJ({m:t}){var e;switch(t.from){case"person":return d.jsxs("li",{className:"ml-8 rounded-xl bg-sunken px-3 py-2.5",children:[d.jsx("p",{className:"whitespace-pre-wrap text-[13.5px] leading-snug",children:d.jsx(KJ,{text:t.text,context:t.context??[]})}),d.jsx(SS,{walkthrough:t.walkthrough,scene:t.scene,prefix:"On"})]});case"agent":return d.jsxs("li",{className:"mr-4",children:[d.jsx("div",{className:"space-y-2 text-[13.5px] leading-relaxed text-ink",children:t.text.split(/\n{2,}/).map((n,r)=>d.jsx("p",{className:"whitespace-pre-wrap",children:n},r))}),d.jsx(SS,{walkthrough:t.walkthrough,scene:t.scene,prefix:"Show",link:!0})]});case"tool":return d.jsxs("li",{className:"flex items-center gap-2 text-[12.5px] text-ink-3",children:[t.status==="completed"?d.jsx(bs,{size:13,className:"shrink-0 text-new"}):t.status==="failed"?d.jsx(Nd,{size:13,className:"shrink-0 text-removed"}):d.jsx(oz,{size:13,className:"shrink-0"}),d.jsx("span",{className:"truncate",title:t.title,children:t.title})]});case"permission":return d.jsxs("li",{className:"rounded-xl border border-changed/40 bg-changed-wash px-3 py-2.5",children:[d.jsxs("p",{className:"text-[13px] font-medium leading-snug",children:["The agent asks: ",t.title]}),t.chosen?d.jsx("p",{className:"mt-1.5 text-[12px] text-ink-3",children:t.chosen==="cancelled"?"Cancelled":`You chose: ${((e=t.options.find(n=>n.id===t.chosen))==null?void 0:e.name)??t.chosen}`}):d.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:t.options.map(n=>d.jsx("button",{type:"button",onClick:()=>void i9(t.id,n.id),className:`h-7 rounded-lg px-2.5 text-[12.5px] font-semibold ${n.kind.startsWith("allow")?"bg-ink text-paper hover:opacity-90":"border border-rule-strong bg-raised hover:bg-sunken"}`,children:n.name},n.id))})]});case"notice":return d.jsx("li",{className:`text-center text-[12px] ${t.tone==="error"?"text-removed":"text-ink-3"}`,children:t.text})}}function SS({walkthrough:t,scene:e,prefix:n,link:r}){const s=T(l=>{var c;return(c=l.history)==null?void 0:c.present});if(!s||!e)return null;const i=t?s.walkthroughs.find(l=>l.id===t):s.walkthroughs.find(l=>l.scenes.some(c=>c.id===e)),o=i?i.scenes.findIndex(l=>l.id===e):-1;if(!i||o<0)return null;const a=`${n} scene ${o+1}: ${Nr(i.scenes[o].title)}`;return r?d.jsx("button",{type:"button",onClick:()=>{const l=T.getState();l.showStart(!1),l.viewId!==`${Fr}${i.id}`&&l.navigate(`${Fr}${i.id}`),setTimeout(()=>T.getState().jumpTo(e),60)},className:"mt-2 text-[12.5px] font-semibold text-poney hover:underline",children:a}):d.jsx("p",{className:"mt-1 text-[11.5px] text-ink-3",children:a})}function qJ({busy:t}){const[e,n]=b.useState(null),r=async({text:s,context:i})=>{try{return await Tp(s,i),n(null),!0}catch(o){return n(o instanceof Error?o.message:String(o)),!1}};return d.jsxs("div",{className:"border-t border-rule p-3",children:[d.jsx(FJ,{placeholder:t?"Ask next; it waits its turn":"Ask about the code",onSend:r,actions:(s,i)=>d.jsxs(d.Fragment,{children:[t&&d.jsx("button",{type:"button","aria-label":"Stop",title:"Stop this request",onClick:()=>void s9(),className:"grid h-10 w-10 shrink-0 place-items-center rounded-full border border-rule-strong bg-raised text-ink hover:bg-sunken",children:d.jsx(BE,{size:13,fill:"currentColor"})}),d.jsx("button",{type:"button","aria-label":"Send",disabled:i,onClick:s,className:"grid h-10 w-10 shrink-0 place-items-center rounded-full bg-ink text-paper disabled:opacity-35",children:d.jsx(U_,{size:17,strokeWidth:2.4})})]})}),d.jsx(VJ,{}),e&&d.jsx("p",{className:"mt-1.5 text-[12px] text-removed",children:e})]})}function KJ({text:t,context:e}){if(!e.length)return d.jsx(d.Fragment,{children:t});const n=e.map(s=>`“${s.title}”`),r=t.split(new RegExp(`(${n.map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|")})`));return d.jsx(d.Fragment,{children:r.map((s,i)=>{const o=e[n.indexOf(s)];return o?d.jsxs("span",{title:o.quote??o.ref,className:"mx-px inline-flex items-baseline gap-1 rounded-md bg-raised px-1.5 text-[12.5px]",children:[d.jsx("span",{className:"text-ink-3",children:o.kind==="text"?"“":o.kind}),d.jsxs("span",{className:"font-medium",children:[o.title,o.kind==="text"?"”":""]})]},i):d.jsx("span",{children:s},i)})})}function N0({start:t,onPickFolder:e,onOpenFile:n}){const[r,s]=b.useState(null),[i,o]=b.useState(null),a=c=>o9(c).then(u=>{s(u),o(null)}).catch(u=>o(u instanceof Error?u.message:String(u)));if(b.useEffect(()=>{a(t)},[]),i)return d.jsx("p",{className:"text-[12.5px] text-removed",children:i});if(!r)return d.jsx("p",{className:"text-[12.5px] text-ink-3",children:"Reading folders…"});const l=n?r.files:[];return d.jsxs("div",{className:"overflow-hidden rounded-xl border border-rule",children:[d.jsxs("div",{className:"flex items-center gap-2 border-b border-rule bg-sunken/50 px-2 py-1.5",children:[d.jsx("button",{type:"button","aria-label":"Up one folder",disabled:!r.parent,onClick:()=>void a(r.parent),className:"grid h-7 w-7 place-items-center rounded-md text-ink-2 hover:bg-raised disabled:opacity-30",children:d.jsx(U_,{size:14})}),d.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-ink-2",title:r.path,children:r.path}),e&&d.jsx("button",{type:"button",onClick:()=>e(r.path),className:"h-7 shrink-0 rounded-md bg-ink px-2.5 text-[12.5px] font-semibold text-paper hover:opacity-90",children:"Use this folder"})]}),d.jsxs("ul",{className:"scrollbar-quiet max-h-[260px] overflow-y-auto py-1",children:[r.folders.length===0&&l.length===0&&d.jsx("li",{className:"px-3 py-2 text-[12.5px] text-ink-3",children:n?"No folders or Poney files here.":"No folders inside."}),l.map(c=>d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>n(c.path),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-[13px] font-medium hover:bg-sunken",children:[d.jsx(Bf,{size:14,className:"shrink-0 text-poney"}),d.jsx("span",{className:"truncate",children:c.name})]})},c.path)),r.folders.map(c=>d.jsx("li",{children:d.jsxs("button",{type:"button",onDoubleClick:()=>e==null?void 0:e(c.path),onClick:()=>void a(c.path),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-[13px] hover:bg-sunken",children:[c.git?d.jsx(RN,{size:14,className:"shrink-0 text-poney"}):d.jsx(ON,{size:14,className:"shrink-0 text-ink-3"}),d.jsx("span",{className:"truncate",children:c.name}),c.git&&d.jsx("span",{className:"ml-auto shrink-0 text-[11.5px] text-ink-3",children:"Git repository"})]})},c.path))]})]})}const vg=t=>t.kind==="provider"?t.id:`custom:${t.name}`,kg=t=>t.kind==="provider"?{providerId:t.id}:{custom:{name:t.name,command:t.command}};function JJ(){var C,E;const t=T(S=>S.connectOpen),e=T(S=>S.setConnectOpen),n=m9(),[r,s]=b.useState([]),[i,o]=b.useState(()=>fx()),[a,l]=b.useState(null),[c,u]=b.useState(null),[f,h]=b.useState(null),[m,g]=b.useState({}),[p,x]=b.useState(null),[y,v]=b.useState(!1),k=(S,_=!1)=>(g(N=>({...N,[vg(S)]:"checking"})),n9(kg(S),_).catch(N=>({state:"error",detail:N instanceof Error?N.message:String(N)})).then(N=>(g(M=>({...M,[vg(S)]:N})),N.state==="ready"&&l(M=>M??S),N)));b.useEffect(()=>{var N,M;if(!t)return;h(null);const S=(N=T.getState().history)==null?void 0:N.present.project.id,_=(n==null?void 0:n.root)??((M=ih(S))==null?void 0:M.folder)??oh()??null;x(_),v(!_),R1().then(P=>{s(P.providers);for(const V of P.providers)V.available&&k({kind:"provider",id:V.id});for(const V of fx())k({kind:"custom",...V})}).catch(P=>h(P instanceof Error?P.message:String(P)))},[t]);const w=async()=>{var S;if(!(!p||!a)){u("Starting the agent…"),h(null);try{await GM(kg(a),p),rT(p);const _=(S=T.getState().history)==null?void 0:S.present.project.id;_&&l9(_,{folder:p,agent:kg(a)}),e(!1),T.getState().setAgentPanelOpen(!0)}catch(_){h(_ instanceof Error?_.message:String(_))}finally{u(null)}}},j=!!p&&!!a&&jS(m[vg(a)]);return d.jsxs(Lo,{open:t,onOpenChange:e,title:"Connect an agent",description:"It reads the code in the folder below and writes to this document.",width:640,children:[d.jsxs("div",{className:"scrollbar-quiet min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-5",children:[d.jsxs("section",{"aria-labelledby":"code-folder",children:[d.jsx("h3",{id:"code-folder",className:"text-[13px] font-semibold",children:"Code"}),d.jsxs("div",{className:"mt-2 flex items-center gap-3 rounded-xl bg-sunken px-3.5 py-2.5 text-[13px]",children:[d.jsx(ON,{size:15,className:"shrink-0 text-ink-3"}),d.jsx("span",{className:`min-w-0 flex-1 truncate ${p?"":"text-ink-3"}`,title:p??void 0,children:p?d.jsx("code",{className:"font-mono text-[12px]",children:p}):"Choose a folder"}),!y&&d.jsx("button",{type:"button",onClick:()=>v(!0),className:"shrink-0 font-semibold text-poney hover:underline",children:"Change"})]}),y&&d.jsx("div",{className:"mt-2",children:d.jsx(N0,{start:p??((E=ih((C=T.getState().history)==null?void 0:C.present.project.id))==null?void 0:E.folder)??oh(),onPickFolder:S=>{x(S),v(!1)}})})]}),d.jsxs("section",{"aria-labelledby":"ag",children:[d.jsx("h3",{id:"ag",className:"text-[13px] font-semibold",children:"Agent"}),d.jsxs("ul",{className:"mt-2 divide-y divide-rule rounded-xl border border-rule",children:[r.map(S=>{const _={kind:"provider",id:S.id},N=(a==null?void 0:a.kind)==="provider"&&a.id===S.id,M=m[S.id],P=S.available&&jS(M);return d.jsx("li",{children:d.jsxs("label",{className:`flex items-start gap-3 px-3.5 py-3 ${P?"cursor-pointer":"cursor-default"}`,children:[d.jsx("input",{type:"radio",name:"agent",className:"mt-1 accent-[var(--accent)]",checked:N,disabled:!P,onChange:()=>l(_)}),d.jsxs("span",{className:`min-w-0 flex-1 ${S.available?"":"opacity-70"}`,children:[d.jsx("span",{className:"block text-[14px] font-medium",children:S.name}),S.available?d.jsx(CS,{status:M,signIn:S.signIn,onRetry:()=>void k(_,!0)}):d.jsx("span",{className:"block text-[12.5px] text-ink-3",children:S.install})]})]})},S.id)}),i.map(S=>{const _=(a==null?void 0:a.kind)==="custom"&&a.name===S.name;return d.jsxs("li",{className:"flex items-start gap-3 px-3.5 py-3",children:[d.jsx("input",{type:"radio",name:"agent","aria-label":S.name,className:"mt-1 accent-[var(--accent)]",checked:_,onChange:()=>l({kind:"custom",...S})}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block text-[14px] font-medium",children:S.name}),d.jsx("code",{className:"block truncate font-mono text-[11.5px] text-ink-3",children:S.command}),d.jsx(CS,{status:m[`custom:${S.name}`],signIn:"Sign in as the agent's documentation says.",onRetry:()=>void k({kind:"custom",...S},!0)})]}),d.jsx("button",{type:"button","aria-label":`Remove ${S.name}`,onClick:()=>{const N=i.filter(M=>M.name!==S.name);o(N),Sb(N),_&&l(null)},className:"rounded p-1 text-ink-4 hover:bg-sunken hover:text-ink",children:d.jsx(XD,{size:14})})]},S.name)})]}),d.jsx(GJ,{onAdd:S=>{const _=[...i.filter(N=>N.name!==S.name),S];o(_),Sb(_),l({kind:"custom",...S}),k({kind:"custom",...S},!0)}})]})]}),d.jsxs("div",{className:"flex items-center gap-3 border-t border-rule px-5 py-3.5",children:[d.jsx("p",{role:f?"alert":void 0,className:`min-w-0 flex-1 text-[12.5px] ${f?"text-removed":"text-ink-3"}`,children:f??c??(p?"":"Choose the folder with the code.")}),d.jsxs("button",{type:"button",disabled:!j||!!c,onClick:()=>void w(),className:"inline-flex h-9 items-center gap-2 rounded-lg bg-ink px-4 text-[13.5px] font-semibold text-paper disabled:opacity-35",children:[c&&d.jsx(So,{size:14,className:"animate-spin"})," Connect"]})]})]})}function GJ({onAdd:t}){const[e,n]=b.useState(!1),[r,s]=b.useState(""),[i,o]=b.useState("");return e?d.jsxs("form",{className:"mt-3 space-y-2 rounded-xl border border-rule p-3",onSubmit:a=>{a.preventDefault(),t({name:r.trim(),command:i.trim()}),n(!1),s(""),o("")},children:[d.jsxs("label",{className:"block text-[12.5px] font-medium",children:["Name",d.jsx("input",{value:r,onChange:a=>s(a.target.value),placeholder:"My agent",className:"mt-1 h-8 w-full rounded-lg border border-rule bg-paper px-2.5 text-[13px] outline-none focus:border-rule-strong"})]}),d.jsxs("label",{className:"block text-[12.5px] font-medium",children:["Command",d.jsx("input",{value:i,onChange:a=>o(a.target.value),placeholder:"my-agent --acp",className:"mt-1 h-8 w-full rounded-lg border border-rule bg-paper px-2.5 font-mono text-[12.5px] outline-none focus:border-rule-strong"}),d.jsx("span",{className:"mt-1 block font-normal text-ink-3",children:"The command that starts the agent in ACP mode."})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("button",{type:"submit",disabled:!r.trim()||!i.trim(),className:"h-8 rounded-lg bg-ink px-3 text-[12.5px] font-semibold text-paper disabled:opacity-35",children:"Add agent"}),d.jsx("button",{type:"button",onClick:()=>n(!1),className:"h-8 rounded-lg px-3 text-[12.5px] font-semibold text-ink-3 hover:bg-sunken",children:"Cancel"})]})]}):d.jsxs("button",{type:"button",onClick:()=>n(!0),className:"mt-2 inline-flex items-center gap-1.5 text-[12.5px] font-semibold text-ink-3 hover:text-ink",children:[d.jsx(a1,{size:13})," Add another ACP agent"]})}const jS=t=>!!t&&t!=="checking"&&(t.state==="ready"||t.state==="unsure");function CS({status:t,signIn:e,onRetry:n}){if(!t||t==="checking")return d.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 text-[12.5px] text-ink-3",children:[d.jsx(So,{size:12,className:"animate-spin"})," Checking the sign-in…"]});const r=t.state==="ready"?"text-new":t.state==="unsure"?"text-changed":"text-removed",s=t.state==="ready"?"Ready":t.state==="unsure"?"Maybe not signed in":t.state==="sign-in"?"Not signed in":"Cannot start";return d.jsxs("span",{className:"mt-0.5 block text-[12.5px] leading-snug text-ink-3",children:[d.jsxs("span",{className:`font-semibold ${r}`,children:[s,"."]})," ",t.detail,(t.state==="sign-in"||t.state==="unsure")&&d.jsx("span",{className:"block",children:e}),t.state!=="ready"&&d.jsxs("button",{type:"button",onClick:i=>{i.preventDefault(),n()},className:"mt-1 inline-flex items-center gap-1 font-semibold text-ink-2 hover:text-ink",children:[d.jsx(WD,{size:11})," Check again"]})]})}function YJ(){const t=T(s=>s.fileOpen),e=T(s=>s.setFileOpen),[n,r]=b.useState(null);return d.jsx(Lo,{open:t,onOpenChange:e,title:"Open a Poney file",description:"A .poney file on this computer. Changes are saved to it, and changes made to it elsewhere show here.",width:600,children:d.jsxs("div",{className:"space-y-3 px-5 py-5",children:[d.jsx(N0,{start:oh(),onOpenFile:async s=>{try{await QM(s),r(null),e(!1)}catch(i){r(i instanceof Error?i.message:String(i))}}}),n&&d.jsx("p",{role:"alert",className:"whitespace-pre-wrap text-[12.5px] text-removed",children:n})]})})}function QJ(){const t=T(c=>c.projectOpen),e=T(c=>c.setProjectOpen),[n,r]=b.useState("local"),[s,i]=b.useState(null),[o,a]=b.useState(null),l=async c=>{a(null);try{await a9(c),rT(c),e(!1)}catch(u){a(u instanceof Error?u.message:String(u))}};return d.jsx(Lo,{open:t,onOpenChange:e,title:"Open a project",description:"A folder on this computer, usually a Git repository. Its Poney document is saved in docs/poney/, and agents work there.",width:620,children:d.jsxs("div",{className:"space-y-3 px-5 py-5",children:[d.jsx("div",{role:"tablist",className:"inline-flex rounded-lg border border-rule bg-sunken/60 p-0.5 text-[12.5px]",children:["local","git"].map(c=>d.jsx("button",{role:"tab",type:"button","aria-selected":n===c,onClick:()=>r(c),className:`h-7 rounded-md px-3 font-medium ${n===c?"bg-raised text-ink shadow-[0_1px_2px_#0000001a]":"text-ink-3 hover:text-ink"}`,children:c==="local"?"On this computer":"From a Git address"},c))}),n==="local"?d.jsx(N0,{start:oh(),onPickFolder:c=>void l(c)}):d.jsx(XJ,{onCloned:c=>void l(c),setBusy:i,setError:a}),(o||s)&&d.jsx("p",{role:o?"alert":"status",className:`text-[12.5px] ${o?"text-removed":"text-ink-3"}`,children:o??s})]})})}function XJ({onCloned:t,setBusy:e,setError:n}){const[r,s]=b.useState("");return d.jsxs("form",{className:"flex gap-2",onSubmit:async i=>{i.preventDefault(),e("Cloning the repository…"),n(null);try{t((await c9(r)).path)}catch(o){n(o instanceof Error?o.message:String(o))}finally{e(null)}},children:[d.jsx("input",{value:r,onChange:i=>s(i.target.value),"aria-label":"Git address",placeholder:"https://github.com/owner/repository",className:"h-9 min-w-0 flex-1 rounded-lg border border-rule bg-paper px-3 font-mono text-[12.5px] outline-none placeholder:text-ink-4 focus:border-rule-strong"}),d.jsx("button",{type:"submit",disabled:!r.trim(),className:"h-9 shrink-0 rounded-lg border border-rule-strong bg-raised px-3 text-[13px] font-semibold hover:bg-sunken disabled:opacity-35",children:"Clone"})]})}function eG({children:t}){const e=ze(),n=iB(),r=T(l=>l.selection),s=T(l=>l.hover),i=T(l=>l.viewUi),o=T(l=>l.updateViewUi),a=b.useMemo(()=>({idx:e,bind:n,selection:r,hover:s,viewState:l=>i[l],setViewState:o}),[e,n,r,s,i,o]);return d.jsx(LP,{value:a,children:t})}function tG(){const t=T(f=>f.importCodeOpen),e=T(f=>f.setImportCodeOpen),[n,r]=b.useState([]),[s,i]=b.useState(null),[o,a]=b.useState(null),[l,c]=b.useState(null);b.useEffect(()=>{t&&(c(null),XM().then(f=>{r(f.importers),i(f.root)},f=>c(f instanceof Error?f.message:String(f))))},[t]);const u=async f=>{a(f),c(null);try{const{summary:h}=await d9(f);e(!1),T.getState().notify(h.split(`
888
- `)[0])}catch(h){c(h instanceof Error?h.message:String(h))}finally{a(null)}};return d.jsxs(Lo,{open:t,onOpenChange:e,title:"Import from the code",description:s?`Adds to this document what it reads in ${s.split("/").pop()}. What the document has stays.`:"Connect an agent or open a project first.",children:[d.jsx("ul",{className:"divide-y divide-rule px-5 py-3",children:n.map(f=>d.jsxs("li",{className:"flex items-center gap-4 py-3",children:[d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block text-[14px] font-semibold",children:f.name}),d.jsx("span",{className:"mt-0.5 block text-[12.5px] text-ink-3",children:f.files.length?`Reads ${f.files.join(", ")}`:"Nothing to read in this folder."})]}),d.jsxs("button",{type:"button",disabled:!f.files.length||!!o,onClick:()=>void u(f.id),className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-rule-strong px-3 text-[13px] font-semibold hover:bg-sunken disabled:opacity-40",children:[o===f.id&&d.jsx(So,{size:13,className:"animate-spin"})," Import"]})]},f.id))}),l&&d.jsx("p",{className:"px-5 pb-4 text-[12.5px] text-removed",children:l})]})}function nG(){const t=T(g=>g.renaming),[e,n]=b.useState(""),r=b.useRef(null),s=b.useRef(null),[i,o]=b.useState(0);if(b.useEffect(()=>{if(!t)return;n(t.value);const g=t.text;g&&(g.style.visibility="hidden"),requestAnimationFrame(()=>{var x;return(x=r.current)==null?void 0:x.select()});const p=()=>{var x;return uu(((x=r.current)==null?void 0:x.value)??null)};return window.addEventListener("resize",p),window.addEventListener("wheel",p,{passive:!0}),()=>{g&&(g.style.visibility=""),window.removeEventListener("resize",p),window.removeEventListener("wheel",p)}},[t]),b.useLayoutEffect(()=>{t&&s.current&&o(Math.min(Math.max(s.current.offsetWidth+6,t.rect.w+6,40),Math.max(t.room,t.rect.w+6)))},[e,t]),!t)return null;const{rect:a,font:l,align:c}=t,u=Math.round(l.size*1.35),f=c==="center"?a.x+a.w/2-i/2:a.x-2,h=a.y+a.h/2-u/2,m={fontSize:l.size,fontWeight:Number(l.weight)||600,lineHeight:`${u}px`};return d.jsxs(d.Fragment,{children:[d.jsx("span",{ref:s,"aria-hidden":!0,className:"pointer-events-none invisible fixed left-0 top-0 whitespace-pre font-sans",style:m,children:e||" "}),d.jsx("input",{ref:r,value:e,"aria-label":`New name for ${t.value}`,title:"Enter to save, Esc to cancel. The name changes in every diagram.",onChange:g=>n(g.target.value),onKeyDown:g=>{g.key==="Enter"&&uu(e),g.key==="Escape"&&uu(null)},onBlur:()=>uu(e),className:`fixed z-50 rounded-sm border-0 border-b-2 border-poney p-0 px-[2px] font-sans text-ink caret-[var(--accent)] ${c==="center"?"text-center":""}`,style:{...m,left:f,top:h,width:i,height:u+2,outline:"none",boxShadow:"none",background:"var(--story-node)"}})]})}function rG(){const t=T(u=>u.contextMenu),e=()=>T.getState().openContextMenu(null),n=b.useRef(null),[r,s]=b.useState({x:0,y:0}),[i,o]=b.useState(0),a=t?sG(t):[];if(b.useLayoutEffect(()=>{if(!t||!n.current)return;const u=n.current.getBoundingClientRect();s({x:Math.min(t.x,window.innerWidth-u.width-8),y:Math.min(t.y,window.innerHeight-u.height-8)}),o(0),n.current.focus()},[t]),b.useEffect(()=>{if(!t)return;const u=f=>{var h;return!((h=n.current)!=null&&h.contains(f.target))&&e()};return window.addEventListener("pointerdown",u,!0),window.addEventListener("resize",e),window.addEventListener("blur",e),()=>{window.removeEventListener("pointerdown",u,!0),window.removeEventListener("resize",e),window.removeEventListener("blur",e)}},[t]),!t||!a.length)return null;const l=u=>{const f=a[u];!f||f.label==="-"||(e(),f.run())},c=u=>{let f=i;do f=(f+u+a.length)%a.length;while(a[f].label==="-");o(f)};return d.jsx("div",{ref:n,role:"menu",tabIndex:-1,"aria-label":"Actions",className:"fade-in fixed z-50 min-w-[230px] rounded-xl border border-rule bg-raised p-1 shadow-float outline-none",style:{left:r.x,top:r.y},onContextMenu:u=>u.preventDefault(),onKeyDown:u=>{if(u.key==="Escape")e();else if(u.key==="ArrowDown")c(1);else if(u.key==="ArrowUp")c(-1);else if(u.key==="Enter")l(i);else return;u.preventDefault()},children:a.map((u,f)=>u.label==="-"?d.jsx("div",{className:"my-1 h-px bg-rule",role:"separator"},f):d.jsxs("button",{type:"button",role:"menuitem",onMouseEnter:()=>o(f),onClick:()=>l(f),className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-left text-[13px] ${f===i?"bg-sunken":""}`,children:[d.jsx("span",{className:"shrink-0 text-ink-3",children:u.icon}),d.jsx("span",{className:"flex-1",children:u.label}),u.hint&&d.jsx("kbd",{className:"font-sans text-[11.5px] text-ink-4",children:u.hint})]},f))})}const _S={label:"-",icon:null,run:()=>{}};function sG(t){const e=Od(T.getState()),n=(s,i)=>{i&&(T.getState().setAgentPanelOpen(!0),Tp(s,[i]))};if(t.on==="element"){const s=oT(t.ref),i=(s==null?void 0:s.kind)??"element";return[...e?[{label:"Ask the agent about this",icon:d.jsx(Yi,{size:14}),run:()=>Qi(s)},{label:"Explain this",icon:d.jsx(Cm,{size:14}),run:()=>n(`Explain this ${i}: what it does, why it is here, and where its code is.`,s)},{label:"Show its code in a scene",icon:d.jsx(yp,{size:14}),run:()=>n(`Add a scene to the open document that shows the code of this ${i}, with short excerpts and notes, and open it.`,s)},_S]:[],...qM(t.ref)?[{label:"Rename",icon:d.jsx(DD,{size:14}),hint:"F2",run:()=>{var l;const a=((l=document.elementFromPoint(t.x,t.y))==null?void 0:l.closest("[data-ref]"))??document.querySelector(`[data-ref="${CSS.escape(de(t.ref))}"]`);a&&A1(t.ref,a)}}]:[],{label:"Explore in the whole system",icon:d.jsx(n1,{size:14}),run:()=>Ad(t.ref)},{label:"Copy reference",icon:d.jsx(Qo,{size:14}),hint:de(t.ref),run:()=>{var a;return void((a=navigator.clipboard)==null?void 0:a.writeText(de(t.ref)))}}]}if(t.on==="code"){const s=lT(t.path,t.line,t.text),i=`${t.path}:${t.line}`;return[...e?[{label:t.note?"Ask the agent about this note":"Ask the agent about this line",icon:d.jsx(Yi,{size:14}),run:()=>Qi(t.note?{...s,quote:`${s.quote}
889
- Note: ${t.note}`}:s)},{label:"Explain this line",icon:d.jsx(Cm,{size:14}),run:()=>n("Explain this line of code: what it does and why it is here.",s)},_S]:[],...t.note?[{label:"Copy note",icon:d.jsx(Qo,{size:14}),run:()=>{var o;return void((o=navigator.clipboard)==null?void 0:o.writeText(t.note))}}]:[],{label:"Copy line",icon:d.jsx(Qo,{size:14}),run:()=>{var o;return void((o=navigator.clipboard)==null?void 0:o.writeText(t.text.trim()))}},{label:"Copy location",icon:d.jsx(Qo,{size:14}),hint:i.split("/").pop(),run:()=>{var o;return void((o=navigator.clipboard)==null?void 0:o.writeText(i))}}]}if(t.on==="text")return[...e?[{label:"Ask the agent about this text",icon:d.jsx(Yi,{size:14}),run:()=>Qi(aT(t.text))}]:[],{label:"Copy",icon:d.jsx(Qo,{size:14}),run:()=>{var s;return void((s=navigator.clipboard)==null?void 0:s.writeText(t.text))}}];const r=K9(t.viewId);return e?[{label:"Ask the agent about this diagram",icon:d.jsx(Yi,{size:14}),run:()=>Qi(r)},{label:"Explain this diagram",icon:d.jsx(Cm,{size:14}),run:()=>n("Explain what this diagram shows, in a few sentences, and what to look at first.",r)}]:[]}function iG(){const t=T(n=>n.pointing),e=T(Od);return b.useEffect(()=>{!e&&t&&T.getState().setPointing(!1)},[e,t]),b.useEffect(()=>{if(document.documentElement.classList.toggle("pointing",t),!t)return;const n=r=>r.key==="Escape"&&T.getState().setPointing(!1);return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),t?d.jsxs("div",{role:"status",className:"fade-in fixed left-1/2 top-3 z-50 flex -translate-x-1/2 items-center gap-2 rounded-full bg-ink px-4 py-2 text-[13px] font-medium text-paper shadow-float",children:[d.jsx(wN,{size:14})," Click a part, a line, a message or a state to add it to your message.",d.jsx("button",{type:"button",onClick:()=>T.getState().setPointing(!1),className:"ml-1 rounded-full px-2 py-0.5 text-[12px] text-paper/70 hover:bg-paper/15 hover:text-paper",children:"Esc"})]}):null}function oG(){const t=T(Od),[e,n]=b.useState(null);return b.useEffect(()=>{if(!t)return;const r=()=>{var u;const i=window.getSelection(),o=i==null?void 0:i.toString().trim(),a=(i==null?void 0:i.anchorNode)instanceof Element?i.anchorNode:(u=i==null?void 0:i.anchorNode)==null?void 0:u.parentElement;if(!i||!o||i.rangeCount===0||!(a!=null&&a.closest("main"))||a.closest('input, textarea, [contenteditable="true"], svg'))return n(null);const l=i.getRangeAt(0),c=l.getClientRects()[0]??l.getBoundingClientRect();if(!c.width)return n(null);n({x:c.left+c.width/2,y:c.top,text:o})},s=()=>n(null);return document.addEventListener("selectionchange",r),window.addEventListener("scroll",s,!0),()=>{document.removeEventListener("selectionchange",r),window.removeEventListener("scroll",s,!0)}},[t]),e?d.jsxs("button",{type:"button",onMouseDown:r=>r.preventDefault(),onClick:()=>{var r;Qi(aT(e.text)),(r=window.getSelection())==null||r.removeAllRanges(),n(null)},className:"fade-in fixed z-50 inline-flex -translate-x-1/2 -translate-y-full items-center gap-1.5 rounded-full bg-ink px-3 py-1.5 text-[12.5px] font-semibold text-paper shadow-float hover:opacity-95",style:{left:e.x,top:e.y-8},children:[d.jsx(Yi,{size:13})," Ask the agent"]}):null}const aG=new URLSearchParams(window.location.search).get("doc"),wg=window.location.hash;function lG(){const t=new URLSearchParams(window.location.search).get("live"),e=t??window.location.origin;fetch(`${e}/api/live`).then(n=>n.ok?n.json():Promise.reject(new Error("no hub"))).then(()=>cG(e)).catch(()=>{t&&T.getState().setLive({state:"lost",url:e})})}function cG(t){T.getState().setLive({state:"connecting",url:t});const n=new EventSource(`${t}/api/live/events`);n.onopen=()=>{T.getState().setLive({...T.getState().live,state:"on",url:t}),uG(t).then(()=>dG(t))},n.onerror=()=>T.getState().setLive({...T.getState().live,state:"lost"});let r=!0;n.addEventListener("document",i=>{var g,p;const{revision:o,document:a,source:l}=JSON.parse(i.data),c=yl(a,{extensions:Td()}),u=T.getState();if(!c.ok||!c.document)return u.notify("The agent sent a document with errors. It was not opened.");const f=r;if(r=!1,f&&u.history&&!u.startOpen&&u.projectId!==c.document.project.id)return u.keepProject(c.document,"live"),u.setLive({state:"on",url:t,revision:o}),u.notify(`“${c.document.project.name}” from Poney on this computer is in the project menu.`);const h=aG===c.document.project.id;if(f&&u.startOpen&&!h)return u.keepProject(c.document,"live"),u.setLive({state:"on",url:t,revision:o});const m=(g=u.projects.find(x=>x.id===c.document.project.id))==null?void 0:g.doc;if(jg(c.document)&&m&&!jg(m)){u.reviseDocument(m,"live"),u.setLive({state:"on",url:t,revision:o}),fetch(`${t}/api/live/open`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({document:m})}).catch(()=>{});return}u.reviseDocument(c.document,"live"),f&&h&&wg.startsWith("#/")&&wg!=="#/start"&&(window.history.replaceState(window.history.state,"",wg),KM()),u.setLive({state:"on",url:t,revision:o}),u.notify(jg(c.document)?`Opened the project “${c.document.project.name}”. Ask the agent for a tour to fill it.`:l==="file"?`Opened “${c.document.project.name}” from its file.`:`The agent opened “${Nr(((p=c.document.walkthroughs[0])==null?void 0:p.title)??c.document.project.name)}” (revision ${o}).`),Jx="",Sg(t)}),n.addEventListener("thread",i=>T.getState().setConversation(JSON.parse(i.data).messages)),n.addEventListener("message",i=>T.getState().putMessage(JSON.parse(i.data))),n.addEventListener("agent",i=>T.getState().setAgent(JSON.parse(i.data))),n.addEventListener("project",i=>{const o=JSON.parse(i.data);T.getState().setProject(o.root?{root:o.root,name:o.name??o.root}:null)}),n.addEventListener("overlays",i=>T.getState().setOverlays(JSON.parse(i.data))),n.addEventListener("file",i=>T.getState().setLiveFile(JSON.parse(i.data).path));let s=0;T.subscribe(()=>{clearTimeout(s),s=window.setTimeout(()=>Sg(t),400)}),window.addEventListener("poney:local",()=>{clearTimeout(s),s=window.setTimeout(()=>Sg(t),400)})}let Jx="";function bg(t){try{const e=localStorage.getItem(t);return e?JSON.parse(e):void 0}catch{return}}function Sg(t){const e=T.getState();if(!e.history)return;const n=e.history.present,r=bp(e.viewId),s=c=>`poney:${c}:${n.project.id}:${r??""}`,i=ft(n),o=e.selection&&i.exists(e.selection)?i.describe(e.selection):void 0,a={projectId:n.project.id,viewId:e.viewId,walkthrough:r,scene:r?e.activeScene??void 0:void 0,selection:e.selection?{ref:de(e.selection),title:(o==null?void 0:o.title)??"",kind:(o==null?void 0:o.kind)??e.selection.kind}:void 0,answers:r?bg(s("answers")):void 0,notes:r?bg(s("notes")):void 0,read:r?bg(s("read")):void 0,document:e.history.past.length||e.history.future.length?n:void 0},l=JSON.stringify(a);l!==Jx&&(Jx=l,fetch(`${t}/api/live/state`,{method:"POST",headers:{"content-type":"application/json"},body:l}).catch(()=>{}))}const jg=t=>t.views.length===0&&t.walkthroughs.length===0;async function dG(t){var o,a,l,c;const e=T.getState(),n=(o=e.history)==null?void 0:o.present,r=(a=e.projects.find(u=>u.id===e.projectId))==null?void 0:a.origin,s=ih(n==null?void 0:n.project.id);if(!n||!s||r==="example"||e.startOpen)return;const i=await fetch(`${t}/api/agent`).then(u=>u.json()).catch(()=>({}));!i.canStart||(l=i.status)!=null&&l.session||(c=i.status)!=null&&c.listening||await GM(s.agent,s.folder).catch(u=>e.notify(`The agent did not start again: ${u instanceof Error?u.message:String(u)}`))}async function uG(t){var l,c,u;const e=T.getState(),n=(l=e.history)==null?void 0:l.present,r=(c=e.projects.find(f=>f.id===e.projectId))==null?void 0:c.origin;if(!n||r==="example"||e.startOpen||(await fetch(`${t}/api/live`).then(f=>f.json()).catch(()=>({}))).revision!==0)return;const i=e.liveFile??((u=fl().find(f=>f.id===n.project.id))==null?void 0:u.path),o=(f,h)=>fetch(`${t}${f}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(h)});(i?await o("/api/files/open",{path:i}).then(f=>f.ok).catch(()=>!1):!1)||await o("/api/live/open",{document:n}).catch(()=>{})}x$(YL);x$(I6);async function fG(){new URLSearchParams(window.location.search).get("example")==="kestrel"?await AA():OJ();const t=T.getState();!t.history&&window.location.hash!==_c&&window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}${_c}`),window.location.hash===_c?t.showStart(!0):t.history&&(t.viewId.startsWith("walk:")&&window.innerWidth<1700&&t.toggleSidebar(!1),KM()),AJ(),lG(),J9()}function hG(){const t=T(e=>!e.history||e.startOpen);return d.jsxs(d.Fragment,{children:[t?d.jsx(PJ,{}):d.jsx(eG,{children:d.jsx(EJ,{})}),d.jsx(UJ,{}),d.jsx(JJ,{}),d.jsx(YJ,{}),d.jsx(QJ,{}),d.jsx(tG,{}),d.jsx(nG,{}),d.jsx(rG,{}),d.jsx(iG,{}),d.jsx(oG,{})]})}window.__poneyStarted?window.location.reload():(window.__poneyStarted=!0,fG().finally(()=>FC(document.getElementById("root")).render(d.jsx(b.StrictMode,{children:d.jsx(hG,{})}))));export{b_ as P,Uv as _,mG as c,NS as g};