@valbuild/ui 0.43.0 → 0.43.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/valbuild-ui.cjs.js +1 -1
- package/dist/valbuild-ui.esm.js +1 -1
- package/package.json +3 -3
- package/server/.tmp/assets/{index-3OuTk_rp.js → index-ytYjbYsf.js} +1 -1
- package/server/.tmp/index.html +1 -1
- package/server/dist/valbuild-ui-main.cjs.js +1 -1
- package/server/dist/valbuild-ui-main.esm.js +1 -1
- package/server/dist/valbuild-ui-server.cjs.js +1 -1
- package/server/dist/valbuild-ui-server.esm.js +1 -1
|
@@ -126,7 +126,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
126
126
|
|
|
127
127
|
`),i=s.length,!ae.$isTextNode(r)||n>=i)s=r.getParent(),r.remove(),s==null||s.getChildrenSize()!==0||ae.$isRootNode(s)||s.remove(),n-=i+l,r=o;else{let a=r.getKey();l=t.getEditorState().read(()=>{const c=ae.$getNodeByKey(a);return ae.$isTextNode(c)&&c.isSimpleText()?c.getTextContent():null}),o=i-n;let u=s.slice(0,o);l!==null&&l!==s?(n=ae.$getPreviousSelection(),i=r,r.isSimpleText()?r.setTextContent(l):(i=ae.$createTextNode(l),r.replace(i)),ae.$isRangeSelection(n)&&n.isCollapsed()&&(n=n.anchor.offset,i.select(n,n))):r.isSimpleText()?(l=e.key===a,s=e.offset,s<n&&(s=i),n=l?s-n:0,i=l?s:o,l&&n===0?([n]=r.splitText(n,i),n.remove()):([,n]=r.splitText(n,i),n.remove())):(n=ae.$createTextNode(u),r.replace(n)),n=0}}};const MO=Ut;var lo=MO,LO=lo,Et=_e;function IO(t){let e=new URLSearchParams;e.append("code",t);for(let n=1;n<arguments.length;n++)e.append("v",arguments[n]);throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function jE(t,e){for(let n of e)if(t.type.startsWith(n))return!0;return!1}function zE(t,e){for(;t!==Et.$getRoot()&&t!=null;){if(e(t))return t;t=t.getParent()}return null}$t.$splitNode=Et.$splitNode;$t.isHTMLAnchorElement=Et.isHTMLAnchorElement;$t.isHTMLElement=Et.isHTMLElement;$t.$dfs=function(t,e){let n=[];t=(t||Et.$getRoot()).getLatest(),e=e||(Et.$isElementNode(t)?t.getLastDescendant():t);for(var r=t,i=0;(r=r.getParent())!==null;)i++;for(r=i;t!==null&&!t.is(e);)if(n.push({depth:r,node:t}),Et.$isElementNode(t)&&0<t.getChildrenSize())t=t.getFirstChild(),r++;else for(i=null;i===null&&t!==null;)i=t.getNextSibling(),i===null?(t=t.getParent(),r--):t=i;return t!==null&&t.is(e)&&n.push({depth:r,node:t}),n};$t.$filter=function(t,e){let n=[];for(let r=0;r<t.length;r++){let i=e(t[r]);i!==null&&n.push(i)}return n};$t.$findMatchingParent=zE;$t.$getNearestBlockElementAncestorOrThrow=function(t){let e=zE(t,n=>Et.$isElementNode(n)&&!n.isInline());return Et.$isElementNode(e)||IO(4,t.__key),e};$t.$getNearestNodeOfType=function(t,e){for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null};$t.$insertFirst=function(t,e){let n=t.getFirstChild();n!==null?n.insertBefore(e):t.append(e)};$t.$insertNodeToNearestRoot=function(t){var e=Et.$getSelection()||Et.$getPreviousSelection();if(Et.$isRangeSelection(e)){var{focus:n}=e;if(e=n.getNode(),n=n.offset,Et.$isRootOrShadowRoot(e))n=e.getChildAtIndex(n),n==null?e.append(t):n.insertBefore(t),t.selectNext();else{let r,i;Et.$isTextNode(e)?(r=e.getParentOrThrow(),i=e.getIndexWithinParent(),0<n&&(i+=1,e.splitText(n))):(r=e,i=n),[,e]=Et.$splitNode(r,i),e.insertBefore(t),e.selectStart()}}else Et.$isNodeSelection(e)||Et.DEPRECATED_$isGridSelection(e)?(e=e.getNodes(),e[e.length-1].getTopLevelElementOrThrow().insertAfter(t)):Et.$getRoot().append(t),e=Et.$createParagraphNode(),t.insertAfter(e),e.select();return t.getLatest()};$t.$restoreEditorState=function(t,e){let n=new Map,r=t._pendingEditorState;for(let[i,o]of e._nodeMap){let l=LO.$cloneWithProperties(o);Et.$isTextNode(l)&&(l.__text=o.__text),n.set(i,l)}r&&(r._nodeMap=n),t._dirtyType=2,t=e._selection,Et.$setSelection(t===null?null:t.clone())};$t.$wrapNodeInElement=function(t,e){return e=e(),t.replace(e),e.append(t),e};$t.addClassNamesToElement=function(t,...e){e.forEach(n=>{typeof n=="string"&&(n=n.split(" ").filter(r=>r!==""),t.classList.add(...n))})};$t.isMimeType=jE;$t.mediaFileReader=function(t,e){let n=t[Symbol.iterator]();return new Promise((r,i)=>{let o=[],l=()=>{const{done:s,value:a}=n.next();if(s)return r(o);const u=new FileReader;u.addEventListener("error",i),u.addEventListener("load",()=>{const c=u.result;typeof c=="string"&&o.push({file:a,result:c}),l()}),jE(a,e)?u.readAsDataURL(a):l()};l()})};$t.mergeRegister=function(...t){return()=>{t.forEach(e=>e())}};$t.objectKlassEquals=function(t,e){return t!==null?Object.getPrototypeOf(t).constructor.name===e.name:!1};$t.registerNestedElementResolver=function(t,e,n,r){return t.registerNodeTransform(e,i=>{e:{for(var o=i.getChildren(),l=0;l<o.length;l++)if(o[l]instanceof e){o=null;break e}for(o=i;o!==null;)if(l=o,o=o.getParent(),o instanceof e){o={child:l,parent:o};break e}o=null}if(o!==null){const{child:s,parent:a}=o;if(s.is(i)){if(r(a,i),i=s.getNextSiblings(),o=i.length,a.insertAfter(s),o!==0){l=n(a),s.insertAfter(l);for(let u=0;u<o;u++)l.append(i[u])}a.canBeEmpty()||a.getChildrenSize()!==0||a.remove()}}})};$t.removeClassNamesFromElement=function(t,...e){e.forEach(n=>{typeof n=="string"&&t.classList.remove(...n.split(" "))})};const DO=$t;var Ft=DO,Fe=_e,so=Ft;function ds(t){let e=new URLSearchParams;e.append("code",t);for(let n=1;n<arguments.length;n++)e.append("v",arguments[n]);throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function FE(t){let e=1;for(t=t.getParent();t!=null;){if(ft(t)){if(t=t.getParent(),Te(t)){e++,t=t.getParent();continue}ds(40)}break}return e}function bg(t){t=t.getParent(),Te(t)||ds(40);let e=t;for(;e!==null;)e=e.getParent(),Te(e)&&(t=e);return t}function BE(t){let e=[];t=t.getChildren().filter(ft);for(let n=0;n<t.length;n++){let r=t[n],i=r.getFirstChild();Te(i)?e=e.concat(BE(i)):e.push(r)}return e}function Ar(t){return ft(t)&&Te(t.getFirstChild())}function jO(t){for(;t.getNextSibling()==null&&t.getPreviousSibling()==null;){let e=t.getParent();if(e==null||!ft(t)&&!Te(t))break;t=e}t.remove()}function ax(t){return zn().append(t)}function UE(t,e){return ft(t)&&(e.length===0||e.length===1&&t.is(e[0])&&t.getChildrenSize()===0)}function Go(t,e){t.splice(t.getChildrenSize(),0,e)}function ux(t,e){if(Te(t))return t;let n=t.getPreviousSibling(),r=t.getNextSibling(),i=zn();return i.setFormat(t.getFormatType()),i.setIndent(t.getIndent()),Go(i,t.getChildren()),Te(n)&&e===n.getListType()?(n.append(i),t.remove(),Te(r)&&e===r.getListType()&&(Go(n,r.getChildren()),r.remove()),n):Te(r)&&e===r.getListType()?(r.getFirstChildOrThrow().insertBefore(i),t.remove(),r):(e=mn(e),e.append(i),t.replace(e),cn(e),e)}function WE(t,e){var n=t.getLastChild();let r=e.getFirstChild();n&&r&&Ar(n)&&Ar(r)&&(WE(n.getFirstChild(),r.getFirstChild()),r.remove()),n=e.getChildren(),0<n.length&&(t.append(...n),cn(t)),e.remove()}function cn(t,e){if(t=e||t.getChildren(),t!==void 0)for(e=0;e<t.length;e++){let o=t[e];if(ft(o)){let l=o.getValue();var n=o,r=n.getParent(),i=1;for(r!=null&&(Te(r)?i=r.getStart():ds(44)),n=n.getPreviousSiblings(),r=0;r<n.length;r++){let s=n[r];ft(s)&&!Te(s.getFirstChild())&&i++}l!==i&&o.setValue(i)}}}function zO(t){if(!Ar(t)){var e=t.getParent(),n=e?e.getParent():void 0,r=n?n.getParent():void 0;if(Te(r)&&ft(n)&&Te(e)){var i=e?e.getFirstChild():void 0,o=e?e.getLastChild():void 0;if(t.is(i))n.insertBefore(t),e.isEmpty()&&n.remove();else if(t.is(o))n.insertAfter(t),e.isEmpty()&&n.remove();else{var l=e.getListType();i=zn();let s=mn(l);i.append(s),t.getPreviousSiblings().forEach(a=>s.append(a)),o=zn(),l=mn(l),o.append(l),Go(l,t.getNextSiblings()),n.insertBefore(i),n.insertAfter(o),n.replace(t)}cn(e),cn(r)}}}let Mf=class VE extends Fe.ElementNode{static getType(){return"listitem"}static clone(e){return new VE(e.__value,e.__checked,e.__key)}constructor(e,n,r){super(r),this.__value=e===void 0?1:e,this.__checked=n}createDOM(e){let n=document.createElement("li"),r=this.getParent();return Te(r)&&r.getListType()==="check"&&dx(n,this,null),n.value=this.__value,cx(n,e.theme,this),n}updateDOM(e,n,r){let i=this.getParent();return Te(i)&&i.getListType()==="check"&&dx(n,this,e),n.value=this.__value,cx(n,r.theme,this),!1}static transform(){return e=>{let n=e.getParent();Te(n)&&(cn(n),n.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0))}}static importDOM(){return{li:()=>({conversion:FO,priority:0})}}static importJSON(e){let n=zn();return n.setChecked(e.checked),n.setValue(e.value),n.setFormat(e.format),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let n=0;n<e.length;n++){let r=e[n];if(Fe.$isElementNode(r)&&this.canMergeWith(r)){let i=r.getChildren();this.append(...i),r.remove()}else super.append(r)}return this}replace(e,n){if(ft(e))return super.replace(e);this.setIndent(0);let r=this.getParentOrThrow();if(!Te(r))return e;if(r.__first===this.getKey())r.insertBefore(e);else if(r.__last===this.getKey())r.insertAfter(e);else{let i=mn(r.getListType()),o=this.getNextSibling();for(;o;){let l=o;o=o.getNextSibling(),i.append(l)}r.insertAfter(e),e.insertAfter(i)}return n&&this.getChildren().forEach(i=>{e.append(i)}),this.remove(),r.getChildrenSize()===0&&r.remove(),e}insertAfter(e,n=!0){var r=this.getParentOrThrow();Te(r)||ds(39);var i=this.getNextSiblings();if(ft(e))return n=super.insertAfter(e,n),e=e.getParentOrThrow(),Te(e)&&cn(e),n;if(Te(e)){for(r=e,e=e.getChildren(),i=e.length-1;0<=i;i--)r=e[i],this.insertAfter(r,n);return r}if(r.insertAfter(e,n),i.length!==0){let o=mn(r.getListType());i.forEach(l=>o.append(l)),e.insertAfter(o,n)}return e}remove(e){let n=this.getPreviousSibling(),r=this.getNextSibling();super.remove(e),n&&r&&Ar(n)&&Ar(r)?(WE(n.getFirstChild(),r.getFirstChild()),r.remove()):r&&(e=r.getParent(),Te(e)&&cn(e))}insertNewAfter(e,n=!0){return e=zn(this.__checked==null?void 0:!1),this.insertAfter(e,n),e}collapseAtStart(e){let n=Fe.$createParagraphNode();this.getChildren().forEach(l=>n.append(l));var r=this.getParentOrThrow(),i=r.getParentOrThrow();let o=ft(i);return r.getChildrenSize()===1?o?(r.remove(),i.select()):(r.insertBefore(n),r.remove(),r=e.anchor,e=e.focus,i=n.getKey(),r.type==="element"&&r.getNode().is(this)&&r.set(i,r.offset,"element"),e.type==="element"&&e.getNode().is(this)&&e.set(i,e.offset,"element")):(r.insertBefore(n),this.remove()),!0}getValue(){return this.getLatest().__value}setValue(e){this.getWritable().__value=e}getChecked(){return this.getLatest().__checked}setChecked(e){this.getWritable().__checked=e}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){var e=this.getParent();if(e===null)return this.getLatest().__indent;e=e.getParentOrThrow();let n=0;for(;ft(e);)e=e.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e=="number"&&-1<e||ds(117);let n=this.getIndent();for(;n!==e;)if(n<e){e:{var r=new Set;if(Ar(this)||r.has(this.getKey()))break e;let s=this.getParent();var i=this.getNextSibling(),o=this.getPreviousSibling();if(Ar(i)&&Ar(o)){if(o=o.getFirstChild(),Te(o)){o.append(this);var l=i.getFirstChild();Te(l)&&(l=l.getChildren(),Go(o,l),i.remove(),r.add(i.getKey())),cn(o)}}else Ar(i)?(i=i.getFirstChild(),Te(i)&&(r=i.getFirstChild(),r!==null&&r.insertBefore(this),cn(i))):Ar(o)?(i=o.getFirstChild(),Te(i)&&(i.append(this),cn(i))):Te(s)&&(r=zn(),l=mn(s.getListType()),r.append(l),l.append(this),o?o.insertAfter(r):i?i.insertBefore(r):s.append(r),cn(l));Te(s)&&cn(s)}n++}else zO(this),n--;return this}insertBefore(e){if(ft(e)){let n=this.getParentOrThrow();if(Te(n)){let r=this.getNextSiblings();cn(n,r)}}return super.insertBefore(e)}canInsertAfter(e){return ft(e)}canReplaceWith(e){return ft(e)}canMergeWith(e){return Fe.$isParagraphNode(e)||ft(e)}extractWithChild(e,n){if(!Fe.$isRangeSelection(n))return!1;e=n.anchor.getNode();let r=n.focus.getNode();return this.isParentOf(e)&&this.isParentOf(r)&&this.getTextContent().length===n.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return mn("bullet")}};function cx(t,e,n){let r=[],i=[];var o=(e=e.list)?e.listitem:void 0;if(e&&e.nested)var l=e.nested.listitem;if(o!==void 0&&(o=o.split(" "),r.push(...o)),e){o=n.getParent(),o=Te(o)&&o.getListType()==="check";let s=n.getChecked();o&&!s||i.push(e.listitemUnchecked),o&&s||i.push(e.listitemChecked),o&&r.push(s?e.listitemChecked:e.listitemUnchecked)}l!==void 0&&(l=l.split(" "),n.getChildren().some(s=>Te(s))?r.push(...l):i.push(...l)),0<i.length&&so.removeClassNamesFromElement(t,...i),0<r.length&&so.addClassNamesToElement(t,...r)}function dx(t,e,n){Te(e.getFirstChild())?(t.removeAttribute("role"),t.removeAttribute("tabIndex"),t.removeAttribute("aria-checked")):(t.setAttribute("role","checkbox"),t.setAttribute("tabIndex","-1"),n&&e.__checked===n.__checked||t.setAttribute("aria-checked",e.getChecked()?"true":"false"))}function FO(t){return t=so.isHTMLElement(t)&&t.getAttribute("aria-checked")==="true",{node:zn(t)}}function zn(t){return Fe.$applyNodeReplacement(new Mf(void 0,t))}function ft(t){return t instanceof Mf}let bv=class HE extends Fe.ElementNode{static getType(){return"list"}static clone(e){return new HE(e.__listType||px[e.__tag],e.__start,e.__key)}constructor(e,n,r){super(r),this.__listType=e=px[e]||e,this.__tag=e==="number"?"ol":"ul",this.__start=n}getTag(){return this.__tag}setListType(e){let n=this.getWritable();n.__listType=e,n.__tag=e==="number"?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(e){let n=document.createElement(this.__tag);return this.__start!==1&&n.setAttribute("start",String(this.__start)),n.__lexicalListType=this.__listType,fx(n,e.theme,this),n}updateDOM(e,n,r){return e.__tag!==this.__tag?!0:(fx(n,r.theme,this),!1)}static importDOM(){return{ol:()=>({conversion:hx,priority:0}),ul:()=>({conversion:hx,priority:0})}}static importJSON(e){let n=mn(e.listType,e.start);return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportDOM(e){return{element:e}=super.exportDOM(e),e&&so.isHTMLElement(e)&&(this.__start!==1&&e.setAttribute("start",String(this.__start)),this.__listType==="check"&&e.setAttribute("__lexicalListType","check")),{element:e}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...e){for(let r=0;r<e.length;r++){var n=e[r];if(ft(n))super.append(n);else{let i=zn();Te(n)||Fe.$isElementNode(n)&&(n=Fe.$createTextNode(n.getTextContent())),i.append(n),super.append(i)}}return cn(this),this}extractWithChild(e){return ft(e)}};function fx(t,e,n){let r=[],i=[];var o=e.list;if(o!==void 0){let s=o[`${n.__tag}Depth`]||[];e=FE(n)-1;let a=e%s.length;var l=s[a];let u=o[n.__tag],c;if(o=o.nested,o!==void 0&&o.list&&(c=o.list),u!==void 0&&r.push(u),l!==void 0)for(l=l.split(" "),r.push(...l),l=0;l<s.length;l++)l!==a&&i.push(n.__tag+l);c!==void 0&&(n=c.split(" "),1<e?r.push(...n):i.push(...n))}0<i.length&&so.removeClassNamesFromElement(t,...i),0<r.length&&so.addClassNamesToElement(t,...r)}function BO(t){let e=[];for(let r=0;r<t.length;r++){var n=t[r];ft(n)?(e.push(n),n=n.getChildren(),1<n.length&&n.forEach(i=>{Te(i)&&e.push(ax(i))})):e.push(ax(n))}return e}function hx(t){let e=t.nodeName.toLowerCase(),n=null;return e==="ol"?n=mn("number",t.start):e==="ul"&&(n=so.isHTMLElement(t)&&t.getAttribute("__lexicallisttype")==="check"?mn("check"):mn("bullet")),{after:BO,node:n}}let px={ol:"number",ul:"bullet"};function mn(t,e=1){return Fe.$applyNodeReplacement(new bv(t,e))}function Te(t){return t instanceof bv}let UO=Fe.createCommand("INSERT_UNORDERED_LIST_COMMAND"),WO=Fe.createCommand("INSERT_ORDERED_LIST_COMMAND"),VO=Fe.createCommand("INSERT_CHECK_LIST_COMMAND"),HO=Fe.createCommand("REMOVE_LIST_COMMAND");wn.$createListItemNode=zn;wn.$createListNode=mn;wn.$getListDepth=FE;wn.$handleListInsertParagraph=function(){var t=Fe.$getSelection();if(!Fe.$isRangeSelection(t)||!t.isCollapsed()||(t=t.anchor.getNode(),!ft(t)||t.getChildrenSize()!==0))return!1;var e=bg(t),n=t.getParent();Te(n)||ds(40);let r=n.getParent(),i;if(Fe.$isRootOrShadowRoot(r))i=Fe.$createParagraphNode(),e.insertAfter(i);else if(ft(r))i=zn(),r.insertAfter(i);else return!1;if(i.select(),e=t.getNextSiblings(),0<e.length){let o=mn(n.getListType());Fe.$isParagraphNode(i)?i.insertAfter(o):(n=zn(),n.append(o),i.insertAfter(n)),e.forEach(l=>{l.remove(),o.append(l)})}return jO(t),!0};wn.$isListItemNode=ft;wn.$isListNode=Te;wn.INSERT_CHECK_LIST_COMMAND=VO;wn.INSERT_ORDERED_LIST_COMMAND=WO;wn.INSERT_UNORDERED_LIST_COMMAND=UO;wn.ListItemNode=Mf;wn.ListNode=bv;wn.REMOVE_LIST_COMMAND=HO;wn.insertList=function(t,e){t.update(()=>{var n=Fe.$getSelection();if(Fe.$isRangeSelection(n)||Fe.DEPRECATED_$isGridSelection(n)){var r=n.getNodes();n=n.anchor.getNode();var i=n.getParent();if(UE(n,r))r=mn(e),Fe.$isRootOrShadowRoot(i)?(n.replace(r),i=zn(),Fe.$isElementNode(n)&&(i.setFormat(n.getFormatType()),i.setIndent(n.getIndent())),r.append(i)):ft(n)&&(n=n.getParentOrThrow(),Go(r,n.getChildren()),n.replace(r));else for(n=new Set,i=0;i<r.length;i++){var o=r[i];if(Fe.$isElementNode(o)&&o.isEmpty()&&!n.has(o.getKey()))ux(o,e);else if(Fe.$isLeafNode(o))for(o=o.getParent();o!=null;){let s=o.getKey();if(Te(o)){if(!n.has(s)){var l=mn(e);Go(l,o.getChildren()),o.replace(l),cn(l),n.add(s)}break}else{if(l=o.getParent(),Fe.$isRootOrShadowRoot(l)&&!n.has(s)){n.add(s),ux(o,e);break}o=l}}}}})};wn.removeList=function(t){t.update(()=>{let e=Fe.$getSelection();if(Fe.$isRangeSelection(e)){var n=new Set,r=e.getNodes(),i=e.anchor.getNode();if(UE(i,r))n.add(bg(i));else for(i=0;i<r.length;i++){var o=r[i];Fe.$isLeafNode(o)&&(o=so.$getNearestNodeOfType(o,Mf),o!=null&&n.add(bg(o)))}for(let l of n){n=l,r=BE(l);for(let s of r)r=Fe.$createParagraphNode(),Go(r,s.getChildren()),n.insertAfter(r),n=r,s.__key===e.anchor.key&&e.anchor.set(r.getKey(),0,"element"),s.__key===e.focus.key&&e.focus.set(r.getKey(),0,"element"),s.remove();l.remove()}}})};const KO=wn;var ji=KO,KE={},Lf={},ZE=p;function ZO(t){let e=new URLSearchParams;e.append("code",t);for(let n=1;n<arguments.length;n++)e.append("v",arguments[n]);throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let GE=ZE.createContext(null);Lf.LexicalComposerContext=GE;Lf.createLexicalComposerContext=function(t,e){let n=null;return t!=null&&(n=t[1]),{getTheme:function(){return e??(n!=null?n.getTheme():null)}}};Lf.useLexicalComposerContext=function(){let t=ZE.useContext(GE);return t==null&&ZO(8),t};const GO=Lf;var Tr=GO,gx=Tr,da=_e,jd=p;let YE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var YO=YE?jd.useLayoutEffect:jd.useEffect;let vc={tag:"history-merge"};function XO(t,e){if(e!==null){if(e===void 0)t.update(()=>{var n=da.$getRoot();if(n.isEmpty()){let r=da.$createParagraphNode();n.append(r),n=YE?document.activeElement:null,(da.$getSelection()!==null||n!==null&&n===t.getRootElement())&&r.select()}},vc);else if(e!==null)switch(typeof e){case"string":let n=t.parseEditorState(e);t.setEditorState(n,vc);break;case"object":t.setEditorState(e,vc);break;case"function":t.update(()=>{da.$getRoot().isEmpty()&&e(t)},vc)}}}KE.LexicalComposer=function({initialConfig:t,children:e}){let n=jd.useMemo(()=>{const{theme:r,namespace:i,editor__DEPRECATED:o,nodes:l,onError:s,editorState:a}=t,u=gx.createLexicalComposerContext(null,r);let c=o||null;if(c===null){const d=da.createEditor({editable:t.editable,namespace:i,nodes:l,onError:f=>s(f,d),theme:r});XO(d,a),c=d}return[c,u]},[]);return YO(()=>{let r=t.editable,[i]=n;i.setEditable(r!==void 0?r:!0)},[]),jd.createElement(gx.LexicalComposerContext.Provider,{value:n},e)};const QO=KE;var JO=QO,Ra=p;function $g(t,e){return $g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},$g(t,e)}function qO(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,$g(t,e)}function eP(t,e){return t===void 0&&(t=[]),e===void 0&&(e=[]),t.length!==e.length||t.some(function(n,r){return!Object.is(n,e[r])})}var mx={error:null},tP=function(t){function e(){for(var r,i=arguments.length,o=Array(i),l=0;l<i;l++)o[l]=arguments[l];return r=t.call.apply(t,[this].concat(o))||this,r.state=mx,r.resetErrorBoundary=function(){for(var s,a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];r.props.onReset==null||(s=r.props).onReset.apply(s,u),r.reset()},r}qO(e,t),e.getDerivedStateFromError=function(r){return{error:r}};var n=e.prototype;return n.reset=function(){this.setState(mx)},n.componentDidCatch=function(r,i){var o,l;(o=(l=this.props).onError)==null||o.call(l,r,i)},n.componentDidUpdate=function(r,i){var o=this.props.resetKeys;if(this.state.error!==null&&i.error!==null&&eP(r.resetKeys,o)){var l,s;(l=(s=this.props).onResetKeysChange)==null||l.call(s,r.resetKeys,o),this.reset()}},n.render=function(){var r=this.state.error,i=this.props,o=i.fallbackRender,l=i.FallbackComponent;if(i=i.fallback,r!==null){if(r={error:r,resetErrorBoundary:this.resetErrorBoundary},Ra.isValidElement(i))return i;if(typeof o=="function")return o(r);if(l)return Ra.createElement(l,r);throw Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},e}(Ra.Component),nP=function({children:t,onError:e}){return Ra.createElement(tP,{fallback:Ra.createElement("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"}},"An error was thrown."),onError:e},t)};const rP=nP;var iP=rP;const oP=Tu(iP);var $v={},Tv={},lP=Ft,Ye=_e;function sP(t,e,n,r,i){if(t===null||n.size===0&&r.size===0&&!i)return 0;var o=e._selection,l=t._selection;if(i)return 1;if(!(Ye.$isRangeSelection(o)&&Ye.$isRangeSelection(l)&&l.isCollapsed()&&o.isCollapsed()))return 0;i=e._nodeMap;let s=[];for(let a of n)n=i.get(a),n!==void 0&&s.push(n);for(let[a,u]of r)u&&(r=i.get(a),r===void 0||Ye.$isRootNode(r)||s.push(r));return s.length===0?0:1<s.length?(r=e._nodeMap,e=r.get(o.anchor.key),l=r.get(l.anchor.key),e&&l&&!t._nodeMap.has(e.__key)&&Ye.$isTextNode(e)&&e.__text.length===1&&o.anchor.offset===1?2:0):(e=s[0],t=t._nodeMap.get(e.__key),!Ye.$isTextNode(t)||!Ye.$isTextNode(e)||t.__mode!==e.__mode||(t=t.__text,e=e.__text,t===e)||(o=o.anchor,l=l.anchor,o.key!==l.key||o.type!=="text")?0:(o=o.offset,l=l.offset,t=e.length-t.length,t===1&&l===o-1?2:t===-1&&l===o+1?3:t===-1&&l===o?4:0))}function aP(t,e){let n=Date.now(),r=0;return(i,o,l,s,a,u)=>{let c=Date.now();if(u.has("historic"))return r=0,n=c,2;let d=sP(i,o,s,a,t.isComposing()),f=(()=>{var h=l===null||l.editor===t,m=u.has("history-push");if(!m&&h&&u.has("history-merge"))return 0;if(i===null)return 1;var g=o._selection;if(!(0<s.size||0<a.size))return g!==null?0:2;if(m===!1&&d!==0&&d===r&&c<n+e&&h)return 0;if(s.size===1){{m=Array.from(s)[0],h=i._nodeMap.get(m),m=o._nodeMap.get(m),g=i._selection;let w=o._selection,v=!1;Ye.$isRangeSelection(g)&&Ye.$isRangeSelection(w)&&(v=g.anchor.type==="element"&&g.focus.type==="element"&&w.anchor.type==="text"&&w.focus.type==="text"),h=!v&&Ye.$isTextNode(h)&&Ye.$isTextNode(m)?h.__type===m.__type&&h.__text===m.__text&&h.__mode===m.__mode&&h.__detail===m.__detail&&h.__style===m.__style&&h.__format===m.__format&&h.__parent===m.__parent:!1}if(h)return 0}return 1})();return n=c,r=d,f}}Tv.createEmptyHistoryState=function(){return{current:null,redoStack:[],undoStack:[]}};Tv.registerHistory=function(t,e,n){let r=aP(t,n);n=({editorState:l,prevEditorState:s,dirtyLeaves:a,dirtyElements:u,tags:c})=>{const d=e.current,f=e.redoStack,h=e.undoStack,m=d===null?null:d.editorState;if(d===null||l!==m){if(s=r(s,l,d,a,u,c),s===1)f.length!==0&&(e.redoStack=[],t.dispatchCommand(Ye.CAN_REDO_COMMAND,!1)),d!==null&&(h.push({...d}),t.dispatchCommand(Ye.CAN_UNDO_COMMAND,!0));else if(s===2)return;e.current={editor:t,editorState:l}}};let i=lP.mergeRegister(t.registerCommand(Ye.UNDO_COMMAND,()=>{let l=e.redoStack,s=e.undoStack;if(s.length!==0){let a=e.current,u=s.pop();a!==null&&(l.push(a),t.dispatchCommand(Ye.CAN_REDO_COMMAND,!0)),s.length===0&&t.dispatchCommand(Ye.CAN_UNDO_COMMAND,!1),e.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:"historic"})}return!0},Ye.COMMAND_PRIORITY_EDITOR),t.registerCommand(Ye.REDO_COMMAND,()=>{let l=e.redoStack;var s=e.undoStack;if(l.length!==0){let a=e.current;a!==null&&(s.push(a),t.dispatchCommand(Ye.CAN_UNDO_COMMAND,!0)),s=l.pop(),l.length===0&&t.dispatchCommand(Ye.CAN_REDO_COMMAND,!1),e.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:"historic"})}return!0},Ye.COMMAND_PRIORITY_EDITOR),t.registerCommand(Ye.CLEAR_EDITOR_COMMAND,()=>(e.undoStack=[],e.redoStack=[],e.current=null,!1),Ye.COMMAND_PRIORITY_EDITOR),t.registerCommand(Ye.CLEAR_HISTORY_COMMAND,()=>(e.undoStack=[],e.redoStack=[],e.current=null,t.dispatchCommand(Ye.CAN_REDO_COMMAND,!1),t.dispatchCommand(Ye.CAN_UNDO_COMMAND,!1),!0),Ye.COMMAND_PRIORITY_EDITOR),t.registerUpdateListener(n)),o=t.registerUpdateListener(n);return()=>{i(),o()}};const uP=Tv;var cP=uP,dP=Tr,Tg=cP,vx=p;function fP(t,e,n=1e3){let r=vx.useMemo(()=>e||Tg.createEmptyHistoryState(),[e]);vx.useEffect(()=>Tg.registerHistory(t,r,n),[n,t,r])}$v.createEmptyHistoryState=Tg.createEmptyHistoryState;$v.HistoryPlugin=function({externalHistoryState:t}){let[e]=dP.useLexicalComposerContext();return fP(e,t),null};const hP=$v;var pP=hP,XE={},gP=Tr,Oa=p,mP=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Oa.useLayoutEffect:Oa.useEffect;function vP(t){let[e]=gP.useLexicalComposerContext(),n=Oa.useMemo(()=>t(e),[e,t]),r=Oa.useRef(n.initialValueFn()),[i,o]=Oa.useState(r.current);return mP(()=>{let{initialValueFn:l,subscribe:s}=n,a=l();return r.current!==a&&(r.current=a,o(a)),s(u=>{r.current=u,o(u)})},[n,t]),i}function yP(t){return{initialValueFn:()=>t.isEditable(),subscribe:e=>t.registerEditableListener(e)}}var xP=function(){return vP(yP)};const _P=xP;var wP=_P,yo={},dn=_e;function Nv(t,e=!0){return t?!1:(t=QE(),e&&(t=t.trim()),t==="")}function QE(){return dn.$getRoot().getTextContent()}function JE(t){if(!Nv(t,!1))return!1;t=dn.$getRoot().getChildren();let e=t.length;if(1<e)return!1;for(let r=0;r<e;r++){var n=t[r];if(dn.$isDecoratorNode(n))return!1;if(dn.$isElementNode(n)){if(!dn.$isParagraphNode(n)||n.__indent!==0)return!1;n=n.getChildren();let i=n.length;for(let o=0;o<i;o++)if(!dn.$isTextNode(n[r]))return!1}}return!0}yo.$canShowPlaceholder=JE;yo.$canShowPlaceholderCurry=function(t){return()=>JE(t)};yo.$findTextIntersectionFromCharacters=function(t,e){var n=t.getFirstChild();t=0;e:for(;n!==null;){if(dn.$isElementNode(n)){var r=n.getFirstChild();if(r!==null){n=r;continue}}else if(dn.$isTextNode(n)){if(r=n.getTextContentSize(),t+r>e)return{node:n,offset:e-t};t+=r}if(r=n.getNextSibling(),r!==null)n=r;else{for(n=n.getParent();n!==null;){if(r=n.getNextSibling(),r!==null){n=r;continue e}n=n.getParent()}break}}return null};yo.$isRootTextContentEmpty=Nv;yo.$isRootTextContentEmptyCurry=function(t,e){return()=>Nv(t,e)};yo.$rootTextContent=QE;yo.registerLexicalTextEntity=function(t,e,n,r){let i=l=>{const s=dn.$createTextNode(l.getTextContent());s.setFormat(l.getFormat()),l.replace(s)},o=t.registerNodeTransform(dn.TextNode,l=>{if(l.isSimpleText()){var s=l.getPreviousSibling(),a=l.getTextContent(),u=l;if(dn.$isTextNode(s)){var c=s.getTextContent(),d=e(c+a);if(s instanceof n){if(d===null||s.getLatest().__mode!==0){i(s);return}if(d=d.end-c.length,0<d){u=a.slice(0,d),u=c+u,s.select(),s.setTextContent(u),d===a.length?l.remove():(s=a.slice(d),l.setTextContent(s));return}}else if(d===null||d.start<c.length)return}for(;;){if(l=e(a),a=d=l===null?"":a.slice(l.end),d===""){if(c=u.getNextSibling(),dn.$isTextNode(c)){if(d=u.getTextContent()+c.getTextContent(),d=e(d),d===null){c instanceof n?i(c):c.markDirty();break}else if(d.start!==0)break}}else if(c=e(d),c!==null&&c.start===0)break;if(l===null)break;if(l.start===0&&dn.$isTextNode(s)&&s.isTextEntity())continue;let f;if(l.start===0?[f,u]=u.splitText(l.end):[,f,u]=u.splitText(l.start,l.end),l=r(f),l.setFormat(f.getFormat()),f.replace(l),u==null)break}}});return t=t.registerNodeTransform(n,l=>{var s=l.getTextContent();const a=e(s);a===null||a.start!==0?i(l):s.length>a.end?l.splitText(a.end):(s=l.getPreviousSibling(),dn.$isTextNode(s)&&s.isTextEntity()&&(i(s),i(l)),s=l.getNextSibling(),dn.$isTextNode(s)&&s.isTextEntity()&&(i(s),l instanceof n&&i(l)))}),[o,t]};const SP=yo;var EP=SP,qE={},yc=_e;qE.registerDragonSupport=function(t){let e=window.location.origin,n=r=>{if(r.origin===e){var i=t.getRootElement();if(document.activeElement===i&&(i=r.data,typeof i=="string")){try{var o=JSON.parse(i)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"&&(o=o.payload)&&o.functionId==="makeChanges"&&(o=o.args)){const[l,s,a,u,c]=o;t.update(()=>{const d=yc.$getSelection();if(yc.$isRangeSelection(d)){var f=d.anchor;let h=f.getNode(),m=0,g=0;yc.$isTextNode(h)&&0<=l&&0<=s&&(m=l,g=l+s,d.setTextNodeRange(h,m,h,g)),(m!==g||a!=="")&&(d.insertRawText(a),h=f.getNode()),yc.$isTextNode(h)&&(m=u,g=u+c,f=h.getTextContentSize(),m=m>f?f:m,g=g>f?f:g,d.setTextNodeRange(h,m,h,g)),r.stopImmediatePropagation()}})}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}};const CP=qE;var kP=CP,Jr={},Si={},Rv={},yx=lo,bP=Ft,zl=_e;function eC(t,e,n,r=null){let i=r!=null?e.isSelected(r):!0,o=zl.$isElementNode(e)&&e.excludeFromCopy("html");var l=e;r!==null&&(l=yx.$cloneWithProperties(e),l=zl.$isTextNode(l)&&r!=null?yx.$sliceSelectedTextNodeContent(r,l):l);let s=zl.$isElementNode(l)?l.getChildren():[],{element:a,after:u}=l.exportDOM(t);if(!a)return!1;let c=document.createDocumentFragment();for(let d=0;d<s.length;d++){let f=s[d],h=eC(t,f,c,r);!i&&zl.$isElementNode(e)&&h&&e.extractWithChild(f,r,"html")&&(i=!0)}return i&&!o?(bP.isHTMLElement(a)&&a.append(c),n.append(a),u&&(t=u.call(l,a))&&a.replaceWith(t)):n.append(c),i}let tC=new Set(["STYLE","SCRIPT"]);function nC(t,e,n=new Map,r){let i=[];if(tC.has(t.nodeName))return i;let o=null;var l,{nodeName:s}=t,a=e._htmlConversions.get(s.toLowerCase());if(s=null,a!==void 0)for(l of a)a=l(t),a!==null&&(s===null||s.priority<a.priority)&&(s=a);if(s=(l=s!==null?s.conversion:null)?l(t):null,l=null,s!==null){if(l=s.after,a=s.node,o=Array.isArray(a)?a[a.length-1]:a,o!==null){for(var[,u]of n)if(o=u(o,r),!o)break;o&&i.push(...Array.isArray(a)?a:[o])}s.forChild!=null&&n.set(t.nodeName,s.forChild)}for(t=t.childNodes,r=[],u=0;u<t.length;u++)r.push(...nC(t[u],e,new Map(n),o));return l!=null&&(r=l(r)),o==null?i=i.concat(r):zl.$isElementNode(o)&&o.append(...r),i}Rv.$generateHtmlFromNodes=function(t,e){if(typeof document>"u"||typeof window>"u")throw Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),r=zl.$getRoot().getChildren();for(let i=0;i<r.length;i++)eC(t,r[i],n,e);return n.innerHTML};Rv.$generateNodesFromDOM=function(t,e){e=e.body?e.body.childNodes:[];let n=[];for(let i=0;i<e.length;i++){var r=e[i];tC.has(r.nodeName)||(r=nC(r,t),r!==null&&(n=n.concat(r)))}return n};const $P=Rv;var TP=$P,rC=TP,Ng=lo,Xl=Ft,me=_e;function li(t){let e=new URLSearchParams;e.append("code",t);for(let n=1;n<arguments.length;n++)e.append("v",arguments[n]);throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let iC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function oC(t){let e=me.$getSelection();if(e==null)throw Error("Expected valid LexicalSelection");return me.$isRangeSelection(e)&&e.isCollapsed()||e.getNodes().length===0?"":rC.$generateHtmlFromNodes(t,e)}function lC(t){let e=me.$getSelection();if(e==null)throw Error("Expected valid LexicalSelection");return me.$isRangeSelection(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(aC(t,e))}function Rg(t,e,n){(me.DEPRECATED_$isGridSelection(n)||Xl.$findMatchingParent(n.anchor.getNode(),r=>me.DEPRECATED_$isGridCellNode(r))!==null&&Xl.$findMatchingParent(n.focus.getNode(),r=>me.DEPRECATED_$isGridCellNode(r))!==null)&&e.length===1&&me.DEPRECATED_$isGridNode(e[0])?RP(e,n,!1,t):NP(e,n)}function NP(t,e){let n=[],r=null;for(let i=0;i<t.length;i++){let o=t[i],l=me.$isLineBreakNode(o);if(l||me.$isDecoratorNode(o)&&o.isInline()||me.$isElementNode(o)&&o.isInline()||me.$isTextNode(o)||o.isParentRequired()){if(r===null&&(r=o.createParentElementNode(),n.push(r),l))continue;r!==null&&r.append(o)}else n.push(o),r=null}me.$isRangeSelection(e)?e.insertNodes(n):me.DEPRECATED_$isGridSelection(e)&&(t=e.anchor.getNode(),me.DEPRECATED_$isGridCellNode(t)||li(41),t.append(...n))}function RP(t,e,n,r){t.length===1&&me.DEPRECATED_$isGridNode(t[0])||li(42);var i=t[0];t=i.getChildren(),n=i.getFirstChildOrThrow().getChildrenSize();var o=i.getChildrenSize(),l=Xl.$findMatchingParent(e.anchor.getNode(),h=>me.DEPRECATED_$isGridCellNode(h));e=(i=l&&Xl.$findMatchingParent(l,h=>me.DEPRECATED_$isGridRowNode(h)))&&Xl.$findMatchingParent(i,h=>me.DEPRECATED_$isGridNode(h)),me.DEPRECATED_$isGridCellNode(l)&&me.DEPRECATED_$isGridRowNode(i)&&me.DEPRECATED_$isGridNode(e)||li(43);var s=i.getIndexWithinParent(),a=Math.min(e.getChildrenSize()-1,s+o-1);o=l.getIndexWithinParent(),l=Math.min(i.getChildrenSize()-1,o+n-1),n=Math.min(o,l),i=Math.min(s,a),o=Math.max(o,l),s=Math.max(s,a),a=e.getChildren(),l=0;let u,c;for(let h=i;h<=s;h++){var d=a[h];me.DEPRECATED_$isGridRowNode(d)||li(24);var f=t[l];me.DEPRECATED_$isGridRowNode(f)||li(24),d=d.getChildren(),f=f.getChildren();let m=0;for(let g=n;g<=o;g++){let w=d[g];me.DEPRECATED_$isGridCellNode(w)||li(25);let v=f[m];me.DEPRECATED_$isGridCellNode(v)||li(25),h===i&&g===n?u=w.getKey():h===s&&g===o&&(c=w.getKey());let y=w.getChildren();v.getChildren().forEach(x=>{me.$isTextNode(x)&&me.$createParagraphNode().append(x),w.append(x)}),y.forEach(x=>x.remove()),m++}l++}u&&c&&(t=me.DEPRECATED_$createGridSelection(),t.set(e.getKey(),u,c),me.$setSelection(t),r.dispatchCommand(me.SELECTION_CHANGE_COMMAND,void 0))}function sC(t,e,n,r=[]){let i=e!=null?n.isSelected(e):!0,o=me.$isElementNode(n)&&n.excludeFromCopy("html");var l=n;if(e!==null){var s=Ng.$cloneWithProperties(n);l=s=me.$isTextNode(s)&&e!=null?Ng.$sliceSelectedTextNodeContent(e,s):s}let a=me.$isElementNode(l)?l.getChildren():[];var u=l;s=u.exportJSON();var c=u.constructor;s.type!==c.getType()&&li(58,c.name);let d=s.children;for(me.$isElementNode(u)&&(Array.isArray(d)||li(59,c.name)),me.$isTextNode(l)&&(l=l.__text,0<l.length?s.text=l:i=!1),l=0;l<a.length;l++)u=a[l],c=sC(t,e,u,s.children),!i&&me.$isElementNode(n)&&c&&n.extractWithChild(u,e,"clone")&&(i=!0);if(i&&!o)r.push(s);else if(Array.isArray(s.children))for(t=0;t<s.children.length;t++)r.push(s.children[t]);return i}function aC(t,e){let n=[],r=me.$getRoot().getChildren();for(let i=0;i<r.length;i++)sC(t,e,r[i],n);return{namespace:t._config.namespace,nodes:n}}function uC(t){let e=[];for(let n=0;n<t.length;n++){let r=me.$parseSerializedNode(t[n]);me.$isTextNode(r)&&Ng.$addNodeStyle(r),e.push(r)}return e}let vl=null;function xx(t,e){var n=iC?(t._window||window).getSelection():null;if(!n)return!1;var r=n.anchorNode;if(n=n.focusNode,r!==null&&n!==null&&!me.isSelectionWithinEditor(t,r,n)||(e.preventDefault(),e=e.clipboardData,r=me.$getSelection(),e===null||r===null))return!1;n=oC(t),t=lC(t);let i="";return r!==null&&(i=r.getTextContent()),n!==null&&e.setData("text/html",n),t!==null&&e.setData("application/x-lexical-editor",t),e.setData("text/plain",i),!0}Si.$generateJSONFromSelectedNodes=aC;Si.$generateNodesFromSerializedNodes=uC;Si.$getHtmlContent=oC;Si.$getLexicalContent=lC;Si.$insertDataTransferForPlainText=function(t,e){t=t.getData("text/plain")||t.getData("text/uri-list"),t!=null&&e.insertRawText(t)};Si.$insertDataTransferForRichText=function(t,e,n){var r=t.getData("application/x-lexical-editor");if(r)try{let l=JSON.parse(r);if(l.namespace===n._config.namespace&&Array.isArray(l.nodes)){let s=uC(l.nodes);return Rg(n,s,e)}}catch{}if(r=t.getData("text/html"))try{var i=new DOMParser().parseFromString(r,"text/html"),o=rC.$generateNodesFromDOM(n,i);return Rg(n,o,e)}catch{}if(t=t.getData("text/plain")||t.getData("text/uri-list"),t!=null)if(me.$isRangeSelection(e))for(t=t.split(/(\r?\n|\t)/),n=t.length,i=0;i<n;i++)o=t[i],o===`
|
|
128
128
|
`||o===`\r
|
|
129
|
-
`?e.insertParagraph():o===" "?e.insertNodes([me.$createTabNode()]):e.insertText(o);else e.insertRawText(t)};Si.$insertGeneratedNodes=Rg;Si.copyToClipboard=async function(t,e){if(vl!==null)return!1;if(e!==null)return new Promise(l=>{t.update(()=>{l(xx(t,e))})});var n=t.getRootElement();let r=t._window==null?window.document:t._window.document,i=iC?(t._window||window).getSelection():null;if(n===null||i===null)return!1;let o=r.createElement("span");return o.style.cssText="position: fixed; top: -1000px;",o.append(r.createTextNode("#")),n.append(o),n=new Range,n.setStart(o,0),n.setEnd(o,1),i.removeAllRanges(),i.addRange(n),new Promise(l=>{let s=t.registerCommand(me.COPY_COMMAND,a=>(Xl.objectKlassEquals(a,ClipboardEvent)&&(s(),vl!==null&&(window.clearTimeout(vl),vl=null),l(xx(t,a))),!0),me.COMMAND_PRIORITY_CRITICAL);vl=window.setTimeout(()=>{s(),vl=null,l(!1)},50),r.execCommand("copy"),o.remove()})};const OP=Si;var PP=OP,zd=PP,xc=lo,jr=Ft,M=_e;function _x(t,e){return typeof document.caretRangeFromPoint<"u"?(t=document.caretRangeFromPoint(t,e),t===null?null:{node:t.startContainer,offset:t.startOffset}):document.caretPositionFromPoint!=="undefined"?(t=document.caretPositionFromPoint(t,e),t===null?null:{node:t.offsetNode,offset:t.offset}):null}let Ps=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",AP=Ps&&"documentMode"in document?document.documentMode:null,MP=Ps&&"InputEvent"in window&&!AP?"getTargetRanges"in new window.InputEvent("input"):!1,LP=Ps&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),IP=Ps&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,DP=Ps&&/^(?=.*Chrome).*/i.test(navigator.userAgent),jP=Ps&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!DP,Og=M.createCommand("DRAG_DROP_PASTE_FILE"),Ov=class cC extends M.ElementNode{static getType(){return"quote"}static clone(e){return new cC(e.__key)}constructor(e){super(e)}createDOM(e){let n=document.createElement("blockquote");return jr.addClassNamesToElement(n,e.theme.quote),n}updateDOM(){return!1}static importDOM(){return{blockquote:()=>({conversion:zP,priority:0})}}exportDOM(e){if({element:e}=super.exportDOM(e),e&&jr.isHTMLElement(e)){this.isEmpty()&&e.append(document.createElement("br"));var n=this.getFormatType();e.style.textAlign=n,(n=this.getDirection())&&(e.dir=n)}return{element:e}}static importJSON(e){let n=Pv();return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,n){e=M.$createParagraphNode();let r=this.getDirection();return e.setDirection(r),this.insertAfter(e,n),e}collapseAtStart(){let e=M.$createParagraphNode();return this.getChildren().forEach(n=>e.append(n)),this.replace(e),!0}};function Pv(){return M.$applyNodeReplacement(new Ov)}let Av=class dC extends M.ElementNode{static getType(){return"heading"}static clone(e){return new dC(e.__tag,e.__key)}constructor(e,n){super(n),this.__tag=e}getTag(){return this.__tag}createDOM(e){let n=this.__tag,r=document.createElement(n);return e=e.theme.heading,e!==void 0&&jr.addClassNamesToElement(r,e[n]),r}updateDOM(){return!1}static importDOM(){return{h1:()=>({conversion:yl,priority:0}),h2:()=>({conversion:yl,priority:0}),h3:()=>({conversion:yl,priority:0}),h4:()=>({conversion:yl,priority:0}),h5:()=>({conversion:yl,priority:0}),h6:()=>({conversion:yl,priority:0}),p:e=>(e=e.firstChild,e!==null&&wx(e)?{conversion:()=>({node:null}),priority:3}:null),span:e=>wx(e)?{conversion:()=>({node:Fl("h1")}),priority:3}:null}}exportDOM(e){if({element:e}=super.exportDOM(e),e&&jr.isHTMLElement(e)){this.isEmpty()&&e.append(document.createElement("br"));var n=this.getFormatType();e.style.textAlign=n,(n=this.getDirection())&&(e.dir=n)}return{element:e}}static importJSON(e){let n=Fl(e.tag);return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,n=!0){e=e?e.anchor.offset:0,e=0<e&&e<this.getTextContentSize()?Fl(this.getTag()):M.$createParagraphNode();let r=this.getDirection();return e.setDirection(r),this.insertAfter(e,n),e}collapseAtStart(){let e=this.isEmpty()?M.$createParagraphNode():Fl(this.getTag());return this.getChildren().forEach(n=>e.append(n)),this.replace(e),!0}extractWithChild(){return!0}};function wx(t){return t.nodeName.toLowerCase()==="span"?t.style.fontSize==="26pt":!1}function yl(t){let e=t.nodeName.toLowerCase(),n=null;return(e==="h1"||e==="h2"||e==="h3"||e==="h4"||e==="h5"||e==="h6")&&(n=Fl(e),t.style!==null&&n.setFormat(t.style.textAlign)),{node:n}}function zP(t){let e=Pv();return t.style!==null&&e.setFormat(t.style.textAlign),{node:e}}function Fl(t){return M.$applyNodeReplacement(new Av(t))}function FP(t,e){t.preventDefault(),e.update(()=>{let n=M.$getSelection(),r=t instanceof InputEvent||t instanceof KeyboardEvent?null:t.clipboardData;r!=null&&(M.$isRangeSelection(n)||M.DEPRECATED_$isGridSelection(n))&&zd.$insertDataTransferForRichText(r,n,e)},{tag:"paste"})}async function BP(t,e){await zd.copyToClipboard(e,jr.objectKlassEquals(t,ClipboardEvent)?t:null),e.update(()=>{let n=M.$getSelection();M.$isRangeSelection(n)?n.removeText():M.$isNodeSelection(n)&&n.getNodes().forEach(r=>r.remove())})}function fa(t){let e=null;if(t instanceof DragEvent?e=t.dataTransfer:t instanceof ClipboardEvent&&(e=t.clipboardData),e===null)return[!1,[],!1];var n=e.types;return t=n.includes("Files"),n=n.includes("text/html")||n.includes("text/plain"),[t,Array.from(e.files),n]}function Sx(t){var e=M.$getSelection();if(!M.$isRangeSelection(e))return!1;let n=new Set;e=e.getNodes();for(let o=0;o<e.length;o++){var r=e[o],i=r.getKey();n.has(i)||(r=jr.$getNearestBlockElementAncestorOrThrow(r),i=r.getKey(),r.canIndent()&&!n.has(i)&&(n.add(i),t(r)))}return 0<n.size}function _c(t){return t=M.$getNearestNodeFromDOMNode(t),M.$isDecoratorNode(t)}Jr.$createHeadingNode=Fl;Jr.$createQuoteNode=Pv;Jr.$isHeadingNode=function(t){return t instanceof Av};Jr.$isQuoteNode=function(t){return t instanceof Ov};Jr.DRAG_DROP_PASTE=Og;Jr.HeadingNode=Av;Jr.QuoteNode=Ov;Jr.eventFiles=fa;Jr.registerRichText=function(t){return jr.mergeRegister(t.registerCommand(M.CLICK_COMMAND,()=>{const e=M.$getSelection();return M.$isNodeSelection(e)?(e.clear(),!0):!1},0),t.registerCommand(M.DELETE_CHARACTER_COMMAND,e=>{const n=M.$getSelection();return M.$isRangeSelection(n)?(n.deleteCharacter(e),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.DELETE_WORD_COMMAND,e=>{const n=M.$getSelection();return M.$isRangeSelection(n)?(n.deleteWord(e),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.DELETE_LINE_COMMAND,e=>{const n=M.$getSelection();return M.$isRangeSelection(n)?(n.deleteLine(e),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.CONTROLLED_TEXT_INSERTION_COMMAND,e=>{const n=M.$getSelection();if(typeof e=="string")M.$isRangeSelection(n)?n.insertText(e):M.DEPRECATED_$isGridSelection(n);else{if(!M.$isRangeSelection(n)&&!M.DEPRECATED_$isGridSelection(n))return!1;const r=e.dataTransfer;r!=null?zd.$insertDataTransferForRichText(r,n,t):M.$isRangeSelection(n)&&(e=e.data)&&n.insertText(e)}return!0},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.REMOVE_TEXT_COMMAND,()=>{const e=M.$getSelection();return M.$isRangeSelection(e)?(e.removeText(),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.FORMAT_TEXT_COMMAND,e=>{const n=M.$getSelection();return M.$isRangeSelection(n)?(n.formatText(e),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.FORMAT_ELEMENT_COMMAND,e=>{var n=M.$getSelection();if(!M.$isRangeSelection(n)&&!M.$isNodeSelection(n))return!1;n=n.getNodes();for(const r of n)n=jr.$findMatchingParent(r,i=>M.$isElementNode(i)&&!i.isInline()),n!==null&&n.setFormat(e);return!0},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.INSERT_LINE_BREAK_COMMAND,e=>{const n=M.$getSelection();return M.$isRangeSelection(n)?(n.insertLineBreak(e),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.INSERT_PARAGRAPH_COMMAND,()=>{const e=M.$getSelection();return M.$isRangeSelection(e)?(e.insertParagraph(),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.INSERT_TAB_COMMAND,()=>(M.$insertNodes([M.$createTabNode()]),!0),M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.INDENT_CONTENT_COMMAND,()=>Sx(e=>{const n=e.getIndent();e.setIndent(n+1)}),M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.OUTDENT_CONTENT_COMMAND,()=>Sx(e=>{const n=e.getIndent();0<n&&e.setIndent(n-1)}),M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_ARROW_UP_COMMAND,e=>{var n=M.$getSelection();if(M.$isNodeSelection(n)&&!_c(e.target)){if(e=n.getNodes(),0<e.length)return e[0].selectPrevious(),!0}else if(M.$isRangeSelection(n)&&(n=M.$getAdjacentNode(n.focus,!0),!e.shiftKey&&M.$isDecoratorNode(n)&&!n.isIsolated()&&!n.isInline()))return n.selectPrevious(),e.preventDefault(),!0;return!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_ARROW_DOWN_COMMAND,e=>{var n=M.$getSelection();if(M.$isNodeSelection(n)){if(e=n.getNodes(),0<e.length)return e[0].selectNext(0,0),!0}else if(M.$isRangeSelection(n)){let r=n.focus;if(r.key==="root"&&r.offset===M.$getRoot().getChildrenSize())return e.preventDefault(),!0;if(n=M.$getAdjacentNode(n.focus,!1),!e.shiftKey&&M.$isDecoratorNode(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_ARROW_LEFT_COMMAND,e=>{const n=M.$getSelection();if(M.$isNodeSelection(n)){var r=n.getNodes();if(0<r.length)return e.preventDefault(),r[0].selectPrevious(),!0}return M.$isRangeSelection(n)&&xc.$shouldOverrideDefaultCharacterSelection(n,!0)?(r=e.shiftKey,e.preventDefault(),xc.$moveCharacter(n,r,!0),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_ARROW_RIGHT_COMMAND,e=>{const n=M.$getSelection();if(M.$isNodeSelection(n)&&!_c(e.target)){var r=n.getNodes();if(0<r.length)return e.preventDefault(),r[0].selectNext(0,0),!0}return M.$isRangeSelection(n)?(r=e.shiftKey,xc.$shouldOverrideDefaultCharacterSelection(n,!1)?(e.preventDefault(),xc.$moveCharacter(n,r,!1),!0):!1):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_BACKSPACE_COMMAND,e=>{if(_c(e.target))return!1;const n=M.$getSelection();if(!M.$isRangeSelection(n))return!1;e.preventDefault(),{anchor:e}=n;const r=e.getNode();return n.isCollapsed()&&e.offset===0&&!M.$isRootNode(r)&&0<jr.$getNearestBlockElementAncestorOrThrow(r).getIndent()?t.dispatchCommand(M.OUTDENT_CONTENT_COMMAND,void 0):t.dispatchCommand(M.DELETE_CHARACTER_COMMAND,!0)},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_DELETE_COMMAND,e=>{if(_c(e.target))return!1;const n=M.$getSelection();return M.$isRangeSelection(n)?(e.preventDefault(),t.dispatchCommand(M.DELETE_CHARACTER_COMMAND,!1)):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_ENTER_COMMAND,e=>{const n=M.$getSelection();if(!M.$isRangeSelection(n))return!1;if(e!==null){if((IP||LP||jP)&&MP)return!1;if(e.preventDefault(),e.shiftKey)return t.dispatchCommand(M.INSERT_LINE_BREAK_COMMAND,!1)}return t.dispatchCommand(M.INSERT_PARAGRAPH_COMMAND,void 0)},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_ESCAPE_COMMAND,()=>{const e=M.$getSelection();return M.$isRangeSelection(e)?(t.blur(),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.DROP_COMMAND,e=>{const[,n]=fa(e);if(0<n.length){var r=_x(e.clientX,e.clientY);if(r!==null){const{offset:o,node:l}=r;var i=M.$getNearestNodeFromDOMNode(l);if(i!==null){if(r=M.$createRangeSelection(),M.$isTextNode(i))r.anchor.set(i.getKey(),o,"text"),r.focus.set(i.getKey(),o,"text");else{const s=i.getParentOrThrow().getKey();i=i.getIndexWithinParent()+1,r.anchor.set(s,i,"element"),r.focus.set(s,i,"element")}r=M.$normalizeSelection__EXPERIMENTAL(r),M.$setSelection(r)}t.dispatchCommand(Og,n)}return e.preventDefault(),!0}return e=M.$getSelection(),!!M.$isRangeSelection(e)},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.DRAGSTART_COMMAND,e=>{[e]=fa(e);const n=M.$getSelection();return!(e&&!M.$isRangeSelection(n))},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.DRAGOVER_COMMAND,e=>{var[n]=fa(e);const r=M.$getSelection();return n&&!M.$isRangeSelection(r)?!1:(n=_x(e.clientX,e.clientY),n!==null&&(n=M.$getNearestNodeFromDOMNode(n.node),M.$isDecoratorNode(n)&&e.preventDefault()),!0)},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.SELECT_ALL_COMMAND,()=>(M.$selectAll(),!0),M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.COPY_COMMAND,e=>(zd.copyToClipboard(t,jr.objectKlassEquals(e,ClipboardEvent)?e:null),!0),M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.CUT_COMMAND,e=>(BP(e,t),!0),M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.PASTE_COMMAND,e=>{const[,n,r]=fa(e);if(0<n.length&&!r)return t.dispatchCommand(Og,n),!0;if(M.isSelectionCapturedInDecoratorInput(e.target))return!1;const i=M.$getSelection();return M.$isRangeSelection(i)||M.DEPRECATED_$isGridSelection(i)?(FP(e,t),!0):!1},M.COMMAND_PRIORITY_EDITOR))};const UP=Jr;var Pa=UP,fC=Tr,WP=wP,Jn=p,VP=EP,hC=Ft,Ex=Gr,HP=kP,KP=Pa,Mv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Jn.useLayoutEffect:Jn.useEffect;function Cx(t){return t.getEditorState().read(VP.$canShowPlaceholderCurry(t.isComposing()))}function ZP(t){let[e,n]=Jn.useState(()=>Cx(t));return Mv(()=>{function r(){let i=Cx(t);n(i)}return r(),hC.mergeRegister(t.registerUpdateListener(()=>{r()}),t.registerEditableListener(()=>{r()}))},[t]),e}function GP(t,e){let[n,r]=Jn.useState(()=>t.getDecorators());return Mv(()=>t.registerDecoratorListener(i=>{Ex.flushSync(()=>{r(i)})}),[t]),Jn.useEffect(()=>{r(t.getDecorators())},[t]),Jn.useMemo(()=>{let i=[],o=Object.keys(n);for(let l=0;l<o.length;l++){let s=o[l],a=Jn.createElement(e,{onError:c=>t._onError(c)},Jn.createElement(Jn.Suspense,{fallback:null},n[s])),u=t.getElementByKey(s);u!==null&&i.push(Ex.createPortal(a,u,s))}return i},[e,n,t])}function YP(t){Mv(()=>hC.mergeRegister(KP.registerRichText(t),HP.registerDragonSupport(t)),[t])}function XP({content:t}){var[e]=fC.useLexicalComposerContext();e=ZP(e);let n=WP();return e?typeof t=="function"?t(n):t:null}XE.RichTextPlugin=function({contentEditable:t,placeholder:e,ErrorBoundary:n}){let[r]=fC.useLexicalComposerContext();return n=GP(r,n),YP(r),Jn.createElement(Jn.Fragment,null,t,Jn.createElement(XP,{content:e}),n)};const QP=XE;var JP=QP,pC={},ni=ji,qP=Tr,gC=p,eA=Ft,qs=_e;function tA(t){gC.useEffect(()=>eA.mergeRegister(t.registerCommand(ni.INSERT_ORDERED_LIST_COMMAND,()=>(ni.insertList(t,"number"),!0),qs.COMMAND_PRIORITY_LOW),t.registerCommand(ni.INSERT_UNORDERED_LIST_COMMAND,()=>(ni.insertList(t,"bullet"),!0),qs.COMMAND_PRIORITY_LOW),t.registerCommand(ni.REMOVE_LIST_COMMAND,()=>(ni.removeList(t),!0),qs.COMMAND_PRIORITY_LOW),t.registerCommand(qs.INSERT_PARAGRAPH_COMMAND,()=>!!ni.$handleListInsertParagraph(),qs.COMMAND_PRIORITY_LOW)),[t])}pC.ListPlugin=function(){let[t]=qP.useLexicalComposerContext();return gC.useEffect(()=>{if(!t.hasNodes([ni.ListNode,ni.ListItemNode]))throw Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[t]),tA(t),null};const nA=pC;var rA=nA,mC={},Ei={},vC=Ft,Ur=_e;let iA=new Set(["http:","https:","mailto:","sms:","tel:"]);class As extends Ur.ElementNode{static getType(){return"link"}static clone(e){return new As(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,n={},r){super(r);let{target:i=null,rel:o=null,title:l=null}=n;this.__url=e,this.__target=i,this.__rel=o,this.__title=l}createDOM(e){let n=document.createElement("a");return n.href=this.sanitizeUrl(this.__url),this.__target!==null&&(n.target=this.__target),this.__rel!==null&&(n.rel=this.__rel),this.__title!==null&&(n.title=this.__title),vC.addClassNamesToElement(n,e.theme.link),n}updateDOM(e,n){let r=this.__url,i=this.__target,o=this.__rel,l=this.__title;return r!==e.__url&&(n.href=r),i!==e.__target&&(i?n.target=i:n.removeAttribute("target")),o!==e.__rel&&(o?n.rel=o:n.removeAttribute("rel")),l!==e.__title&&(l?n.title=l:n.removeAttribute("title")),!1}static importDOM(){return{a:()=>({conversion:oA,priority:1})}}static importJSON(e){let n=cu(e.url,{rel:e.rel,target:e.target,title:e.title});return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}sanitizeUrl(e){try{let n=new URL(e);if(!iA.has(n.protocol))return"about:blank"}catch{}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){this.getWritable().__title=e}insertNewAfter(e,n=!0){return e=this.getParentOrThrow().insertNewAfter(e,n),Ur.$isElementNode(e)?(n=cu(this.__url,{rel:this.__rel,target:this.__target,title:this.__title}),e.append(n),n):null}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,n){if(!Ur.$isRangeSelection(n))return!1;e=n.anchor.getNode();let r=n.focus.getNode();return this.isParentOf(e)&&this.isParentOf(r)&&0<n.getTextContent().length}}function oA(t){let e=null;if(vC.isHTMLAnchorElement(t)){let n=t.textContent;n!==null&&n!==""&&(e=cu(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target"),title:t.getAttribute("title")}))}return{node:e}}function cu(t,e){return Ur.$applyNodeReplacement(new As(t,e))}function bo(t){return t instanceof As}class Fu extends As{static getType(){return"autolink"}static clone(e){return new Fu(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}static importJSON(e){let n=Pg(e.url,{rel:e.rel,target:e.target,title:e.title});return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),type:"autolink",version:1}}insertNewAfter(e,n=!0){return e=this.getParentOrThrow().insertNewAfter(e,n),Ur.$isElementNode(e)?(n=Pg(this.__url,{rel:this._rel,target:this.__target,title:this.__title}),e.append(n),n):null}}function Pg(t,e){return Ur.$applyNodeReplacement(new Fu(t,e))}let lA=Ur.createCommand("TOGGLE_LINK_COMMAND");function sA(t,e){for(;t!==null&&(t=t.getParent())!==null&&!e(t););return t}Ei.$createAutoLinkNode=Pg;Ei.$createLinkNode=cu;Ei.$isAutoLinkNode=function(t){return t instanceof Fu};Ei.$isLinkNode=bo;Ei.AutoLinkNode=Fu;Ei.LinkNode=As;Ei.TOGGLE_LINK_COMMAND=lA;Ei.toggleLink=function(t,e={}){let{target:n,title:r}=e,i=e.rel===void 0?"noreferrer":e.rel;if(e=Ur.$getSelection(),Ur.$isRangeSelection(e))if(e=e.extract(),t===null)e.forEach(l=>{if(l=l.getParent(),bo(l)){let s=l.getChildren();for(let a=0;a<s.length;a++)l.insertBefore(s[a]);l.remove()}});else{if(e.length===1){var o=e[0];if(o=bo(o)?o:sA(o,bo),o!==null){o.setURL(t),n!==void 0&&o.setTarget(n),i!==null&&o.setRel(i),r!==void 0&&o.setTitle(r);return}}let l=null,s=null;e.forEach(a=>{var u=a.getParent();if(u!==s&&u!==null&&(!Ur.$isElementNode(a)||a.isInline()))if(bo(u))s=u,u.setURL(t),n!==void 0&&u.setTarget(n),i!==null&&s.setRel(i),r!==void 0&&s.setTitle(r);else if(u.is(l)||(l=u,s=cu(t,{rel:i,target:n}),bo(u)?a.getPreviousSibling()===null?u.insertBefore(s):u.insertAfter(s):a.insertBefore(s)),bo(a)){if(!a.is(s)){if(s!==null){u=a.getChildren();for(let c=0;c<u.length;c++)s.append(u[c])}a.remove()}}else s!==null&&s.append(a)})}};const aA=Ei;var fs=aA,xl=fs,uA=Tr,cA=Ft,_l=_e,dA=p;mC.LinkPlugin=function({validateUrl:t}){let[e]=uA.useLexicalComposerContext();return dA.useEffect(()=>{if(!e.hasNodes([xl.LinkNode]))throw Error("LinkPlugin: LinkNode not registered on editor");return cA.mergeRegister(e.registerCommand(xl.TOGGLE_LINK_COMMAND,n=>{if(n===null)return xl.toggleLink(n),!0;if(typeof n=="string")return t===void 0||t(n)?(xl.toggleLink(n),!0):!1;let{url:r,target:i,rel:o,title:l}=n;return xl.toggleLink(r,{rel:o,target:i,title:l}),!0},_l.COMMAND_PRIORITY_LOW),t!==void 0?e.registerCommand(_l.PASTE_COMMAND,n=>{let r=_l.$getSelection();if(!_l.$isRangeSelection(r)||r.isCollapsed()||!(n instanceof ClipboardEvent)||n.clipboardData==null)return!1;let i=n.clipboardData.getData("text");return t(i)?r.getNodes().some(o=>_l.$isElementNode(o))?!1:(e.dispatchCommand(xl.TOGGLE_LINK_COMMAND,i),n.preventDefault(),!0):!1},_l.COMMAND_PRIORITY_LOW):()=>{})},[e,t]),null};const fA=mC;var hA=fA;function pA({ariaActiveDescendant:t,ariaAutoComplete:e,ariaControls:n,ariaDescribedBy:r,ariaExpanded:i,ariaLabel:o,ariaLabelledBy:l,ariaMultiline:s,ariaOwns:a,ariaRequired:u,autoCapitalize:c,className:d,id:f,role:h="textbox",spellCheck:m=!0,style:g,tabIndex:w,"data-testid":v,...y}){const[x]=Tr.useLexicalComposerContext(),[S,b]=p.useState(!1),T=p.useCallback($=>{var L;x.setRootElement($);const O=(L=document.getElementById("val-ui"))==null?void 0:L.shadowRoot;if(O&&"getSelection"in O){x._window=O;return}},[x]);return p.useLayoutEffect(()=>(b(x.isEditable()),x.registerEditableListener($=>{b($)})),[x]),_.jsx("div",{...y,"aria-activedescendant":S?t:void 0,"aria-autocomplete":S?e:"none","aria-controls":S?n:void 0,"aria-describedby":r,"aria-expanded":S&&h==="combobox"?!!i:void 0,"aria-label":o,"aria-labelledby":l,"aria-multiline":s,"aria-owns":S?a:void 0,"aria-readonly":S?void 0:!0,"aria-required":u,autoCapitalize:c,className:d,contentEditable:S,"data-testid":v,id:f,ref:T,role:h,spellCheck:m,style:g,tabIndex:w})}function gA({className:t}){return _.jsx(pA,{className:t})}class Bu extends _e.DecoratorNode{constructor(e,n){super(n),this.__src=e.src,this.__altText=e.altText,this.__width=e.width,this.__height=e.height}static getType(){return"image"}static clone(e){return new Bu({src:e.__src,altText:e.__altText,width:e.__width,height:e.__height})}exportJSON(){return{altText:this.__altText,height:this.__width,src:this.__src,type:"image",version:1,width:this.__width}}static importJSON(e){return yC(e)}createDOM(){return document.createElement("div")}updateDOM(){return!1}decorate(){return _.jsx(mA,{src:this.__src,altText:this.__altText,empty:this.__empty,height:this.__height,nodeKey:this.getKey()})}}function mA(t){return _.jsx("img",{src:t.src})}function yC(t){return new Bu(t)}function vA(){const[t]=Tr.useLexicalComposerContext();return p.useEffect(()=>{t.focus()},[t]),null}const xC=_e.createCommand("INSERT_IMAGE_COMMAND");function yA(){const[t]=Tr.useLexicalComposerContext();return p.useEffect(()=>{if(!t.hasNodes([Bu]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return Ft.mergeRegister(t.registerCommand(xC,e=>{const n=yC(e);return _e.$insertNodes([n]),_e.$isRootOrShadowRoot(n.getParentOrThrow())&&Ft.$wrapNodeInElement(n,_e.$createParagraphNode).selectEnd(),!0},_e.COMMAND_PRIORITY_EDITOR))},[t]),null}const xA=({className:t})=>_.jsxs("svg",{height:12,width:12,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[_.jsx("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),_.jsx("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]}),_A=xA,wA=({className:t})=>_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,width:12,height:12,children:[_.jsx("line",{x1:"19",y1:"4",x2:"10",y2:"4"}),_.jsx("line",{x1:"14",y1:"20",x2:"5",y2:"20"}),_.jsx("line",{x1:"15",y1:"4",x2:"9",y2:"20"})]}),SA=wA,EA=({className:t})=>_.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1",className:t,width:12,height:12,children:_.jsx("path",{fillRule:"evenodd",d:"M13,15 L13,21 C13,21.5522847 12.5522847,22 12,22 C11.4477153,22 11,21.5522847 11,21 L11,15 L13,15 Z M3,13 C2.44771525,13 2,12.5522847 2,12 C2,11.4477153 2.44771525,11 3,11 L21,11 C21.5522847,11 22,11.4477153 22,12 C22,12.5522847 21.5522847,13 21,13 L3,13 Z M19,2 C19.5522847,2 20,2.44771525 20,3 C20,3.55228475 19.5522847,4 19,4 L13,4 L13,9 L11,9 L11,4 L5,4 C4.44771525,4 4,3.55228475 4,3 C4,2.44771525 4.44771525,2 5,2 L19,2 Z"})}),CA=EA,kA=({variant:t="primary",onClick:e,children:n,icon:r,disabled:i=!1})=>_.jsx("button",{disabled:i,className:_f("font-sans font-[12px] tracking-[0.04em] py-1 px-2 rounded whitespace-nowrap group relative text-primary",{"font-bold":t==="primary","bg-background hover:bg-background text-fill disabled:bg-fill disabled:text-background":t==="primary","bg-transparent border border-primary text-primary hover:border-highlight hover:text-highlight disabled:bg-fill disabled:text-background":t!=="primary"}),onClick:e,children:_.jsxs("span",{className:"flex flex-row items-center justify-center gap-2",children:[r&&r,n]})}),$o=kA,bA=({className:t})=>_.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 12 12",xmlns:"http://www.w3.org/2000/svg",className:t,children:[_.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.70733 1.00015L8.7784 6.07121L8.07129 6.77832L3.00022 1.70725L3.70733 1.00015Z",fill:"currentColor"}),_.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.00015 10.4709L8.07121 5.39983L8.77832 6.10693L3.70725 11.178L3.00015 10.4709Z",fill:"currentColor"})]}),$A=bA,_C=re.createContext({get api(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get session(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get theme(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setTheme(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get editMode(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setEditMode(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get highlight(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setHighlight(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setWindowSize(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get windowSize(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")}});function Lv(){return re.useContext(_C)}const TA=({options:t,onChange:e,label:n,icon:r})=>{const[i,o]=p.useState(!1),l=p.useRef(null),[s,a]=p.useState(0),{windowSize:u}=Lv(),c=()=>{o(!i)},d=(f,h)=>{a(h),e(f),o(!1)};return p.useEffect(()=>{const f=h=>{i&&l.current&&!l.current.contains(h.target)&&o(!1)};return document.addEventListener("click",f),()=>{document.removeEventListener("click",f)}},[]),_.jsx("div",{className:"text-[12px]",ref:l,children:_.jsx($o,{onClick:f=>{f.preventDefault(),c()},icon:_.jsx($A,{className:`rotate-[-90deg] transition-transform duration-150 ease-in-out ${i?"":"rotate-[90deg]"}`}),children:_.jsxs("div",{className:"relative",children:[_.jsxs("span",{className:"flex flex-row items-center justify-center gap-1",children:[n,r&&r]}),i&&_.jsx("div",{className:"absolute -top-[4px] overflow-scroll shadow-lg -left-2 text-primary bg-border w-fit z-overlay",style:{maxHeight:u==null?void 0:u.innerHeight},children:_.jsx("div",{className:"flex flex-col ",children:t==null?void 0:t.map((f,h)=>_.jsx("button",{onClick:m=>{m.preventDefault(),d(f,h)},className:`text-left px-2 py-1 hover:bg-background hover:text-highlight ${h===s&&"font-bold bg-background hover:bg-background truncate"}`,children:f},f))})})]})})})},NA=TA,RA=new TextEncoder;function wC(t){return new Promise((e,n)=>{var o;const r=(o=t.currentTarget.files)==null?void 0:o[0],i=new FileReader;i.addEventListener("load",()=>{const l=i.result;if(typeof l=="string"){const s=new Image;s.addEventListener("load",async()=>{const a=await jn.getSHA256Hash(RA.encode(l));if(s.naturalWidth&&s.naturalHeight){const u=nv(l);e({src:l,width:s.naturalWidth,height:s.naturalHeight,filename:r==null?void 0:r.name,sha256:a,mimeType:u,fileExt:u&&rv(u)})}else e({src:l,filename:r==null?void 0:r.name,sha256:a})}),s.src=l}else n(l?{message:"Unexpected image result type",result:l}:{message:"Empty result"})}),r&&i.readAsDataURL(r)})}function SC(t){const e=t.anchor,n=t.focus,r=t.anchor.getNode(),i=t.focus.getNode();return r===i?r:t.isBackward()?lo.$isAtNodeEnd(n)?r:i:lo.$isAtNodeEnd(e)?r:i}function OA(){const[t]=Tr.useLexicalComposerContext();return p.useEffect(()=>Ft.mergeRegister(t.registerCommand(_e.CLICK_COMMAND,e=>{const n=_e.$getSelection();if(_e.$isRangeSelection(n)){const r=SC(n),i=Ft.$findMatchingParent(r,fs.$isLinkNode);if(fs.$isLinkNode(i)&&(e.metaKey||e.ctrlKey))return window.open(i.getURL(),"_blank"),!0}return!1},_e.COMMAND_PRIORITY_LOW)),[]),null}var EC={exports:{}},PA="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",AA=PA,MA=AA;function CC(){}function kC(){}kC.resetWarningCache=CC;var LA=function(){function t(r,i,o,l,s,a){if(a!==MA){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:kC,resetWarningCache:CC};return n.PropTypes=n,n};EC.exports=LA();var IA=EC.exports;const er=Tu(IA);function Ag(){return Ag=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ag.apply(this,arguments)}function DA(t,e){if(t==null)return{};var n=jA(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function jA(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var Iv=p.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,i=t.size,o=i===void 0?24:i,l=DA(t,["color","size"]);return re.createElement("svg",Ag({ref:e,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),re.createElement("polyline",{points:"20 6 9 17 4 12"}))});Iv.propTypes={color:er.string,size:er.oneOfType([er.string,er.number])};Iv.displayName="Check";const zA=Iv;function Mg(){return Mg=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Mg.apply(this,arguments)}function FA(t,e){if(t==null)return{};var n=BA(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function BA(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var Dv=p.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,i=t.size,o=i===void 0?24:i,l=FA(t,["color","size"]);return re.createElement("svg",Mg({ref:e,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),re.createElement("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),re.createElement("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}))});Dv.propTypes={color:er.string,size:er.oneOfType([er.string,er.number])};Dv.displayName="Link";const UA=Dv;function Lg(){return Lg=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Lg.apply(this,arguments)}function WA(t,e){if(t==null)return{};var n=VA(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function VA(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var jv=p.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,i=t.size,o=i===void 0?24:i,l=WA(t,["color","size"]);return re.createElement("svg",Lg({ref:e,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),re.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),re.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))});jv.propTypes={color:er.string,size:er.oneOfType([er.string,er.number])};jv.displayName="X";const HA=jv,KA=({fontSizes:t,fontsFamilies:e,onEditor:n,colors:r})=>{const[i]=Tr.useLexicalComposerContext();p.useEffect(()=>{n&&n(i)},[i]);const[o,l]=p.useState(i),[s,a]=p.useState(null),[u,c]=p.useState(!1),[d,f]=p.useState(!1),[h,m]=p.useState(!1),[g,w]=p.useState(!1);p.useState("15px"),p.useState("#000"),p.useState("Sans");const[v,y]=p.useState("paragraph");p.useState(!1),p.useState(!1),p.useState("url"),p.useState(null);const[x,S]=p.useState(null),b=P=>{i.dispatchCommand(fs.TOGGLE_LINK_COMMAND,P)},T={paragraph:"Normal",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",number:"Numbered List",bullet:"Bulleted List"},$={};for(const P in T)$[T[P]]=P;const O=p.useCallback(()=>{const P=_e.$getSelection();if(_e.$isRangeSelection(P)){const D=P.anchor.getNode();let B=D.getKey()==="root"?D:Ft.$findMatchingParent(D,k=>{const E=k.getParent();return E!==null&&_e.$isRootOrShadowRoot(E)});B===null&&(B=D.getTopLevelElementOrThrow());const oe=SC(P),H=Ft.$findMatchingParent(oe,fs.$isLinkNode);if(H!==null){const k=H.getURL();S(k)}else S(null);const Z=B.getKey(),C=o.getElementByKey(Z);if(c(P.hasFormat("bold")),f(P.hasFormat("italic")),m(P.hasFormat("strikethrough")),w(P.hasFormat("underline")),C!==null)if(a(Z),ji.$isListNode(B)){const k=Ft.$getNearestNodeOfType(D,ji.ListNode),E=k?k.getListType():B.getListType();y(E)}else{const k=Pa.$isHeadingNode(B)?B.getTag():B.getType();k in T&&y(k)}}},[o]);p.useEffect(()=>Ft.mergeRegister(i.registerUpdateListener(({editorState:P})=>{P.read(()=>{O()})})),[O,o,i]),p.useEffect(()=>i.registerCommand(_e.SELECTION_CHANGE_COMMAND,(P,D)=>(O(),l(D),!1),_e.COMMAND_PRIORITY_CRITICAL),[i,O]);const L=P=>{["h1","h2","h3","h4","h5","h6"].includes(P)?v!==P&&i.update(()=>{const D=_e.$getSelection();_e.$isRangeSelection(D)&&lo.$setBlocksType(D,()=>Pa.$createHeadingNode(P))}):P==="paragraph"&&v!=="paragraph"?i.update(()=>{const D=_e.$getSelection();(_e.$isRangeSelection(D)||_e.DEPRECATED_$isGridSelection(D))&&lo.$setBlocksType(D,()=>_e.$createParagraphNode())}):P==="number"&&v!=="number"?i.dispatchCommand(ji.INSERT_ORDERED_LIST_COMMAND,void 0):P==="bullet"&&v!=="bullet"?i.dispatchCommand(ji.INSERT_UNORDERED_LIST_COMMAND,void 0):i.dispatchCommand(ji.REMOVE_LIST_COMMAND,void 0)};return p.useCallback(()=>{i.update(()=>{const P=_e.$getSelection();if(_e.$isRangeSelection(P)){const D=P.anchor,B=P.focus,oe=P.getNodes();if(D.key===B.key&&D.offset===B.offset)return;oe.forEach((H,Z)=>{_e.$isTextNode(H)?(Z===0&&D.offset!==0&&(H=H.splitText(D.offset)[1]||H),Z===oe.length-1&&(H=H.splitText(B.offset)[0]||H),H.__style!==""&&H.setStyle(""),H.__format!==0&&(H.setFormat(0),Ft.$getNearestBlockElementAncestorOrThrow(H).setFormat(""))):Pa.$isHeadingNode(H)&&H.replace(_e.$createParagraphNode(),!0)})}})},[o]),_.jsxs("div",{className:"sticky top-0 border-b bg-background border-highlight flex flex-col",children:[_.jsxs("div",{className:"flex flex-row gap-1",children:[_.jsx(NA,{options:Object.values(T),label:T[v]??v+" (not supported)",onChange:P=>{L($[P])}}),_.jsx($o,{variant:"primary",onClick:P=>{P.preventDefault(),i.dispatchCommand(_e.FORMAT_TEXT_COMMAND,"bold")},active:u,icon:_.jsx(_A,{className:`${u&&"stroke-[3px]"}`})}),_.jsx($o,{active:h,onClick:P=>{P.preventDefault(),i.dispatchCommand(_e.FORMAT_TEXT_COMMAND,"strikethrough")},icon:_.jsx(CA,{className:`${h&&"stroke-[2px]"}`})}),_.jsx($o,{active:d,onClick:P=>{P.preventDefault(),i.dispatchCommand(_e.FORMAT_TEXT_COMMAND,"italic")},icon:_.jsx(SA,{className:`${d&&"stroke-[3px]"}`})}),_.jsx($o,{active:x!==null,onClick:P=>{P.preventDefault(),S(""),b("")},icon:_.jsx(UA,{width:12,height:12,className:`${x!==null&&"stroke-[3px]"}`})}),_.jsxs("label",{className:"flex items-center justify-center cursor-pointer",children:[_.jsx(mS,{}),_.jsx("input",{type:"file",hidden:!0,onChange:P=>{P.preventDefault(),wC(P).then(D=>{i.dispatchCommand(xC,{...D})}).catch(D=>{console.error("Error reading image",D)})}})]})]}),x!==null&&_.jsxs("div",{className:"flex flex-row p-2",children:[_.jsx("input",{type:"text",placeholder:"Enter URL",className:"w-1/3 text-primary bg-background px-2",value:x,onChange:P=>{P.preventDefault(),S(P.target.value)}}),_.jsx($o,{variant:"primary",onClick:P=>{P.preventDefault(),b(x||null)},icon:_.jsx(zA,{size:14})}),_.jsx($o,{variant:"primary",onClick:P=>{P.preventDefault(),b(null)},icon:_.jsx(HA,{size:14})})]})]})},ZA=KA;function GA(t){console.error(t)}const YA=28,XA=({richtext:t,onEditor:e})=>{const{windowSize:n}=Lv(),i={namespace:"val",editorState:o=>{o.setEditorState(o.parseEditorState({root:zR($S(t))}))},nodes:[Pa.HeadingNode,Bu,ji.ListNode,ji.ListItemNode,fs.LinkNode],theme:{text:{bold:"font-semibold",underline:"underline",italic:"italic",strikethrough:"line-through",underlineStrikethrough:"underline line-through"},list:{listitem:"ml-[20px]",ol:"list-decimal",ul:"list-disc"},heading:{h1:"text-4xl font-bold",h2:"text-3xl font-bold",h3:"text-2xl font-bold",h4:"text-xl font-bold",h5:"text-lg font-bold",h6:"text-md font-bold"},link:"text-highlight underline"},onError:GA};return _.jsxs(JO.LexicalComposer,{initialConfig:i,children:[_.jsx(vA,{}),_.jsx(ZA,{onEditor:e}),_.jsx(JP.RichTextPlugin,{contentEditable:_.jsx("div",{className:"font-sans border-b text-primary border-highlight",style:{minHeight:n!=null&&n.innerHeight?(n==null?void 0:n.innerHeight)-YA:void 0},children:_.jsx(gA,{className:"p-4 outline-none bg-fill"})}),placeholder:_.jsx("div",{className:"",children:"Enter some text..."}),ErrorBoundary:oP}),_.jsx(hA.LinkPlugin,{}),_.jsx(OA,{}),_.jsx(rA.ListPlugin,{}),_.jsx(yA,{}),_.jsx(pP.HistoryPlugin,{})]})};var QA={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const JA=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Kn=(t,e)=>{const n=p.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:o=2,absoluteStrokeWidth:l,children:s,...a},u)=>p.createElement("svg",{ref:u,...QA,width:i,height:i,stroke:r,strokeWidth:l?Number(o)*24/Number(i):o,className:`lucide lucide-${JA(t)}`,...a},[...e.map(([c,d])=>p.createElement(c,d)),...(Array.isArray(s)?s:[s])||[]]));return n.displayName=`${t}`,n},qA=Kn("Check",[["polyline",{points:"20 6 9 17 4 12",key:"10jjfj"}]]),bC=Kn("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),e5=Kn("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),kx=Kn("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]),t5=Kn("Maximize",[["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"}]]),n5=Kn("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]),r5=Kn("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),i5=Kn("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]),o5=Kn("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]),l5=Kn("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),s5=Kn("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]),a5=Kn("Sun",[["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"}]]),u5=Kn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),zv="p-1 border rounded-full shadow border-accent",bx="valbuild:urlBeforeNavigation";function c5({api:t,patches:e,onCommit:n}){const{theme:r,setTheme:i,editMode:o,setEditMode:l,session:s}=Lv();if(s.status==="success"&&s.data.mode==="unauthorized")return _.jsxs($x,{href:t.getLoginUrl(window.location.href),children:[_.jsx("span",{children:"Login"}),_.jsx(kx,{size:18})]});if(s.status==="success"&&!s.data.enabled)return _.jsxs($x,{href:t.getEnableUrl(window.location.href),children:[_.jsx("span",{children:"Enable"}),_.jsx(kx,{size:18})]});const[a,u]=p.useState();return p.useEffect(()=>{let c=0;for(const d in e)c+=e[d].length;u(c)},[e]),_.jsxs(d5,{children:[_.jsx(wc,{active:o==="hover",onClick:()=>{l(c=>c==="hover"?"off":"hover")},children:_.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:o==="hover"?_.jsx(i5,{size:18}):_.jsx(o5,{size:18})})}),_.jsx(wc,{onClick:()=>{i(r==="dark"?"light":"dark")},children:_.jsxs("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:[r==="dark"&&_.jsx(a5,{size:15}),r==="light"&&_.jsx(r5,{size:15})]})}),_.jsx(wc,{active:o==="full",onClick:()=>{if(o!=="full")localStorage.setItem(bx,window.location.href),window.location.href=t.getEditUrl();else if(o==="full"){const c=localStorage.getItem(bx);window.location.href=c||"/"}},children:_.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:o==="full"?_.jsx(n5,{size:15}):_.jsx(t5,{size:15})})}),a!==void 0&&_.jsx(wc,{onClick:()=>{a>0?t.postCommit({patches:e}).then(c=>{Lo.isErr(c)?(console.error(c.error),alert("Could not commit patches: "+c.error.message)):(console.log("Committed patches: ",c.value),n())}):alert("No patches to commit")},children:_.jsxs("div",{className:"relative h-[24px] w-[24px] flex justify-center items-center",children:[_.jsx("div",{className:"absolute -right-[10px] -top-[10px] border border-border rounded-full px-1 font-sans text-xs bg-card text-accent",children:a}),_.jsx(s5,{size:18})]})}),_.jsx("a",{className:zv,href:t.getDisableUrl(window.location.href),children:_.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:_.jsx(l5,{size:18})})})]})}function $x({href:t,children:e}){return _.jsx("div",{className:"flex flex-row items-center justify-center w-full h-full font-sans border-2 rounded-full gap-x-3 text-primary bg-background border-fill",children:_.jsx("a",{className:zv,href:t,children:_.jsx("div",{className:"flex items-center justify-center px-2 gap-x-2",children:e})})})}function d5({children:t}){return _.jsx("div",{className:"flex flex-row items-center justify-center w-full h-full px-2 py-2 font-sans border-2 rounded-full gap-x-3 text-primary bg-background border-fill",children:t})}function wc({active:t,onClick:e,children:n}){return _.jsx("button",{className:_f(zv,{"bg-accent drop-shadow-[0px_0px_12px_rgba(56,205,152,0.60)]":t}),onClick:e,children:n})}function f5(t,e){const[n,r]=p.useState({}),[i,o]=p.useState(0);return p.useEffect(()=>{t.status==="success"&&t.data.mode==="proxy"&&e.getPatches({}).then(l=>{if(Lo.isOk(l)){const s={};for(const a in l.value)s[a]=l.value[a].map(u=>u.patch_id);r(s)}else console.error("Could not load patches",l.error)})},[t,i]),{patches:n,setPatchResetId:o}}function h5(t="dark"){const[e,n]=p.useState(t);return p.useEffect(()=>{localStorage.getItem("val-theme")==="light"?n("light"):localStorage.getItem("val-theme")==="dark"||window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?n("dark"):window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches&&n("light");const r=i=>{localStorage.getItem("val-theme")||n(i.matches?"dark":"light")};return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",r),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",r)}},[]),[e,r=>{localStorage.setItem("val-theme",r),n(r)}]}var De;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const o={};for(const l of i)o[l]=l;return o},t.getValidEnumValues=i=>{const o=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),l={};for(const s of o)l[s]=i[s];return t.objectValues(l)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const l in i)Object.prototype.hasOwnProperty.call(i,l)&&o.push(l);return o},t.find=(i,o)=>{for(const l of i)if(o(l))return l},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(l=>typeof l=="string"?`'${l}'`:l).join(o)}t.joinValues=r,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(De||(De={}));var Ig;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Ig||(Ig={}));const q=De.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zi=t=>{switch(typeof t){case"undefined":return q.undefined;case"string":return q.string;case"number":return isNaN(t)?q.nan:q.number;case"boolean":return q.boolean;case"function":return q.function;case"bigint":return q.bigint;case"symbol":return q.symbol;case"object":return Array.isArray(t)?q.array:t===null?q.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?q.promise:typeof Map<"u"&&t instanceof Map?q.map:typeof Set<"u"&&t instanceof Set?q.set:typeof Date<"u"&&t instanceof Date?q.date:q.object;default:return q.unknown}},V=De.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"]),p5=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class wr extends Error{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}get errors(){return this.issues}format(e){const n=e||function(o){return o.message},r={_errors:[]},i=o=>{for(const l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)r._errors.push(n(l));else{let s=r,a=0;for(;a<l.path.length;){const u=l.path[a];a===l.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(n(l))):s[u]=s[u]||{_errors:[]},s=s[u],a++}}};return i(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,De.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}wr.create=t=>new wr(t);const du=(t,e)=>{let n;switch(t.code){case V.invalid_type:t.received===q.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case V.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,De.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${De.joinValues(t.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${De.joinValues(t.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${De.joinValues(t.options)}, received '${t.received}'`;break;case V.invalid_arguments:n="Invalid function arguments";break;case V.invalid_return_type:n="Invalid function return type";break;case V.invalid_date:n="Invalid date";break;case V.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}"`:De.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case V.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==="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 V.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 V.custom:n="Invalid input";break;case V.invalid_intersection_types:n="Intersection results could not be merged";break;case V.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case V.not_finite:n="Number must be finite";break;default:n=e.defaultError,De.assertNever(t)}return{message:n}};let $C=du;function g5(t){$C=t}function Fd(){return $C}const Bd=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,o=[...n,...i.path||[]],l={...i,path:o};let s="";const a=r.filter(u=>!!u).slice().reverse();for(const u of a)s=u(l,{data:e,defaultError:s}).message;return{...i,path:o,message:i.message||s}},m5=[];function te(t,e){const n=Bd({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Fd(),du].filter(r=>!!r)});t.common.issues.push(n)}class on{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 i of n){if(i.status==="aborted")return ye;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n)r.push({key:await i.key,value:await i.value});return on.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:o,value:l}=i;if(o.status==="aborted"||l.status==="aborted")return ye;o.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||i.alwaysSet)&&(r[o.value]=l.value)}return{status:e.value,value:r}}}const ye=Object.freeze({status:"aborted"}),TC=t=>({status:"dirty",value:t}),yn=t=>({status:"valid",value:t}),Dg=t=>t.status==="aborted",jg=t=>t.status==="dirty",fu=t=>t.status==="valid",Ud=t=>typeof Promise<"u"&&t instanceof Promise;var fe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(fe||(fe={}));class Hr{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Tx=(t,e)=>{if(fu(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 wr(t.common.issues);return this._error=n,this._error}}};function xe(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=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:i}:{errorMap:(l,s)=>l.code!=="invalid_type"?{message:s.defaultError}:typeof s.data>"u"?{message:r??s.defaultError}:{message:n??s.defaultError},description:i}}class Ce{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)}get description(){return this._def.description}_getType(e){return zi(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:zi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new on,ctx:{common:e.parent.common,data:e.data,parsedType:zi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Ud(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){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zi(e)},o=this._parseSync({data:e,path:i.path,parent:i});return Tx(i,o)}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:zi(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(Ud(i)?i:Promise.resolve(i));return Tx(r,o)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const l=e(i),s=()=>o.addIssue({code:V.custom,...r(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(a=>a?!0:(s(),!1)):l?!0:(s(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new kr({schema:this,typeName:he.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ci.create(this,this._def)}nullable(){return Qo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Sr.create(this,this._def)}promise(){return ps.create(this,this._def)}or(e){return mu.create([this,e],this._def)}and(e){return vu.create(this,e,this._def)}transform(e){return new kr({...xe(this._def),schema:this,typeName:he.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Su({...xe(this._def),innerType:this,defaultValue:n,typeName:he.ZodDefault})}brand(){return new RC({typeName:he.ZodBranded,type:this,...xe(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Kd({...xe(this._def),innerType:this,catchValue:n,typeName:he.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Uu.create(this,e)}readonly(){return Gd.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const v5=/^c[^\s-]{8,}$/i,y5=/^[a-z][a-z0-9]*$/,x5=/^[0-9A-HJKMNP-TV-Z]{26}$/,_5=/^[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,w5=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,S5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let zh;const E5=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,C5=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,k5=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function b5(t,e){return!!((e==="v4"||!e)&&E5.test(t)||(e==="v6"||!e)&&C5.test(t))}class yr extends Ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){const o=this._getOrReturnCtx(e);return te(o,{code:V.invalid_type,expected:q.string,received:o.parsedType}),ye}const r=new on;let i;for(const o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),te(i,{code:V.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),te(i,{code:V.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const l=e.data.length>o.value,s=e.data.length<o.value;(l||s)&&(i=this._getOrReturnCtx(e,i),l?te(i,{code:V.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):s&&te(i,{code:V.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")w5.test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"email",code:V.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")zh||(zh=new RegExp(S5,"u")),zh.test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"emoji",code:V.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")_5.test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"uuid",code:V.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")v5.test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"cuid",code:V.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")y5.test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"cuid2",code:V.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")x5.test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"ulid",code:V.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),te(i,{validation:"url",code:V.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"regex",code:V.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),te(i,{code:V.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),te(i,{code:V.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),te(i,{code:V.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?k5(o).test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{code:V.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="ip"?b5(e.data,o.version)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"ip",code:V.invalid_string,message:o.message}),r.dirty()):De.assertNever(o);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:V.invalid_string,...fe.errToObj(r)})}_addCheck(e){return new yr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...fe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...fe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...fe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...fe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...fe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...fe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...fe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...fe.errToObj(e)})}datetime(e){var n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,...fe.errToObj(e==null?void 0:e.message)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...fe.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...fe.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...fe.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...fe.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...fe.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...fe.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...fe.errToObj(n)})}nonempty(e){return this.min(1,fe.errToObj(e))}trim(){return new yr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new yr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new yr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}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 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 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}}yr.create=t=>{var e;return new yr({checks:[],typeName:he.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...xe(t)})};function $5(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(t.toFixed(i).replace(".","")),l=parseInt(e.toFixed(i).replace(".",""));return o%l/Math.pow(10,i)}class ao extends Ce{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)!==q.number){const o=this._getOrReturnCtx(e);return te(o,{code:V.invalid_type,expected:q.number,received:o.parsedType}),ye}let r;const i=new on;for(const o of this._def.checks)o.kind==="int"?De.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:V.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?$5(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:V.not_finite,message:o.message}),i.dirty()):De.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,fe.toString(n))}gt(e,n){return this.setLimit("min",e,!1,fe.toString(n))}lte(e,n){return this.setLimit("max",e,!0,fe.toString(n))}lt(e,n){return this.setLimit("max",e,!1,fe.toString(n))}setLimit(e,n,r,i){return new ao({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:fe.toString(i)}]})}_addCheck(e){return new ao({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:fe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:fe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:fe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:fe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:fe.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:fe.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:fe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:fe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:fe.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"&&De.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)}}ao.create=t=>new ao({checks:[],typeName:he.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...xe(t)});class uo extends Ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==q.bigint){const o=this._getOrReturnCtx(e);return te(o,{code:V.invalid_type,expected:q.bigint,received:o.parsedType}),ye}let r;const i=new on;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):De.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,fe.toString(n))}gt(e,n){return this.setLimit("min",e,!1,fe.toString(n))}lte(e,n){return this.setLimit("max",e,!0,fe.toString(n))}lt(e,n){return this.setLimit("max",e,!1,fe.toString(n))}setLimit(e,n,r,i){return new uo({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:fe.toString(i)}]})}_addCheck(e){return new uo({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:fe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:fe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:fe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:fe.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:fe.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}}uo.create=t=>{var e;return new uo({checks:[],typeName:he.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...xe(t)})};class hu extends Ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){const r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:q.boolean,received:r.parsedType}),ye}return yn(e.data)}}hu.create=t=>new hu({typeName:he.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...xe(t)});class Yo extends Ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){const o=this._getOrReturnCtx(e);return te(o,{code:V.invalid_type,expected:q.date,received:o.parsedType}),ye}if(isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return te(o,{code:V.invalid_date}),ye}const r=new on;let i;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),te(i,{code:V.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),te(i,{code:V.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):De.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Yo({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:fe.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:fe.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}}Yo.create=t=>new Yo({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:he.ZodDate,...xe(t)});class Wd extends Ce{_parse(e){if(this._getType(e)!==q.symbol){const r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:q.symbol,received:r.parsedType}),ye}return yn(e.data)}}Wd.create=t=>new Wd({typeName:he.ZodSymbol,...xe(t)});class pu extends Ce{_parse(e){if(this._getType(e)!==q.undefined){const r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:q.undefined,received:r.parsedType}),ye}return yn(e.data)}}pu.create=t=>new pu({typeName:he.ZodUndefined,...xe(t)});class gu extends Ce{_parse(e){if(this._getType(e)!==q.null){const r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:q.null,received:r.parsedType}),ye}return yn(e.data)}}gu.create=t=>new gu({typeName:he.ZodNull,...xe(t)});class hs extends Ce{constructor(){super(...arguments),this._any=!0}_parse(e){return yn(e.data)}}hs.create=t=>new hs({typeName:he.ZodAny,...xe(t)});class zo extends Ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return yn(e.data)}}zo.create=t=>new zo({typeName:he.ZodUnknown,...xe(t)});class gi extends Ce{_parse(e){const n=this._getOrReturnCtx(e);return te(n,{code:V.invalid_type,expected:q.never,received:n.parsedType}),ye}}gi.create=t=>new gi({typeName:he.ZodNever,...xe(t)});class Vd extends Ce{_parse(e){if(this._getType(e)!==q.undefined){const r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:q.void,received:r.parsedType}),ye}return yn(e.data)}}Vd.create=t=>new Vd({typeName:he.ZodVoid,...xe(t)});class Sr extends Ce{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==q.array)return te(n,{code:V.invalid_type,expected:q.array,received:n.parsedType}),ye;if(i.exactLength!==null){const l=n.data.length>i.exactLength.value,s=n.data.length<i.exactLength.value;(l||s)&&(te(n,{code:l?V.too_big:V.too_small,minimum:s?i.exactLength.value:void 0,maximum:l?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(te(n,{code:V.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(te(n,{code:V.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((l,s)=>i.type._parseAsync(new Hr(n,l,n.path,s)))).then(l=>on.mergeArray(r,l));const o=[...n.data].map((l,s)=>i.type._parseSync(new Hr(n,l,n.path,s)));return on.mergeArray(r,o)}get element(){return this._def.type}min(e,n){return new Sr({...this._def,minLength:{value:e,message:fe.toString(n)}})}max(e,n){return new Sr({...this._def,maxLength:{value:e,message:fe.toString(n)}})}length(e,n){return new Sr({...this._def,exactLength:{value:e,message:fe.toString(n)}})}nonempty(e){return this.min(1,e)}}Sr.create=(t,e)=>new Sr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:he.ZodArray,...xe(e)});function kl(t){if(t instanceof ct){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=ci.create(kl(r))}return new ct({...t._def,shape:()=>e})}else return t instanceof Sr?new Sr({...t._def,type:kl(t.element)}):t instanceof ci?ci.create(kl(t.unwrap())):t instanceof Qo?Qo.create(kl(t.unwrap())):t instanceof Kr?Kr.create(t.items.map(e=>kl(e))):t}class ct extends Ce{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=De.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==q.object){const u=this._getOrReturnCtx(e);return te(u,{code:V.invalid_type,expected:q.object,received:u.parsedType}),ye}const{status:r,ctx:i}=this._processInputParams(e),{shape:o,keys:l}=this._getCached(),s=[];if(!(this._def.catchall instanceof gi&&this._def.unknownKeys==="strip"))for(const u in i.data)l.includes(u)||s.push(u);const a=[];for(const u of l){const c=o[u],d=i.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new Hr(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof gi){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of s)a.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")s.length>0&&(te(i,{code:V.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of s){const d=i.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new Hr(i,d,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of a){const d=await c.key;u.push({key:d,value:await c.value,alwaysSet:c.alwaysSet})}return u}).then(u=>on.mergeObjectSync(r,u)):on.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return fe.errToObj,new ct({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o,l,s;const a=(l=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&l!==void 0?l:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=fe.errToObj(e).message)!==null&&s!==void 0?s:a}:{message:a}}}:{}})}strip(){return new ct({...this._def,unknownKeys:"strip"})}passthrough(){return new ct({...this._def,unknownKeys:"passthrough"})}extend(e){return new ct({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ct({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:he.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new ct({...this._def,catchall:e})}pick(e){const n={};return De.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new ct({...this._def,shape:()=>n})}omit(e){const n={};return De.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new ct({...this._def,shape:()=>n})}deepPartial(){return kl(this)}partial(e){const n={};return De.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}),new ct({...this._def,shape:()=>n})}required(e){const n={};return De.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof ci;)o=o._def.innerType;n[r]=o}}),new ct({...this._def,shape:()=>n})}keyof(){return NC(De.objectKeys(this.shape))}}ct.create=(t,e)=>new ct({shape:()=>t,unknownKeys:"strip",catchall:gi.create(),typeName:he.ZodObject,...xe(e)});ct.strictCreate=(t,e)=>new ct({shape:()=>t,unknownKeys:"strict",catchall:gi.create(),typeName:he.ZodObject,...xe(e)});ct.lazycreate=(t,e)=>new ct({shape:t,unknownKeys:"strip",catchall:gi.create(),typeName:he.ZodObject,...xe(e)});class mu extends Ce{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(o){for(const s of o)if(s.result.status==="valid")return s.result;for(const s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const l=o.map(s=>new wr(s.ctx.common.issues));return te(n,{code:V.invalid_union,unionErrors:l}),ye}if(n.common.async)return Promise.all(r.map(async o=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(i);{let o;const l=[];for(const a of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=a._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&l.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const s=l.map(a=>new wr(a));return te(n,{code:V.invalid_union,unionErrors:s}),ye}}get options(){return this._def.options}}mu.create=(t,e)=>new mu({options:t,typeName:he.ZodUnion,...xe(e)});const Hc=t=>t instanceof xu?Hc(t.schema):t instanceof kr?Hc(t.innerType()):t instanceof _u?[t.value]:t instanceof co?t.options:t instanceof wu?Object.keys(t.enum):t instanceof Su?Hc(t._def.innerType):t instanceof pu?[void 0]:t instanceof gu?[null]:null;class If extends Ce{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==q.object)return te(n,{code:V.invalid_type,expected:q.object,received:n.parsedType}),ye;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(te(n,{code:V.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ye)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const i=new Map;for(const o of n){const l=Hc(o.shape[e]);if(!l)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of l){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,o)}}return new If({typeName:he.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...xe(r)})}}function zg(t,e){const n=zi(t),r=zi(e);if(t===e)return{valid:!0,data:t};if(n===q.object&&r===q.object){const i=De.objectKeys(e),o=De.objectKeys(t).filter(s=>i.indexOf(s)!==-1),l={...t,...e};for(const s of o){const a=zg(t[s],e[s]);if(!a.valid)return{valid:!1};l[s]=a.data}return{valid:!0,data:l}}else if(n===q.array&&r===q.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let o=0;o<t.length;o++){const l=t[o],s=e[o],a=zg(l,s);if(!a.valid)return{valid:!1};i.push(a.data)}return{valid:!0,data:i}}else return n===q.date&&r===q.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class vu extends Ce{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(o,l)=>{if(Dg(o)||Dg(l))return ye;const s=zg(o.value,l.value);return s.valid?((jg(o)||jg(l))&&n.dirty(),{status:n.value,value:s.data}):(te(r,{code:V.invalid_intersection_types}),ye)};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(([o,l])=>i(o,l)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}vu.create=(t,e,n)=>new vu({left:t,right:e,typeName:he.ZodIntersection,...xe(n)});class Kr extends Ce{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.array)return te(r,{code:V.invalid_type,expected:q.array,received:r.parsedType}),ye;if(r.data.length<this._def.items.length)return te(r,{code:V.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ye;!this._def.rest&&r.data.length>this._def.items.length&&(te(r,{code:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((l,s)=>{const a=this._def.items[s]||this._def.rest;return a?a._parse(new Hr(r,l,r.path,s)):null}).filter(l=>!!l);return r.common.async?Promise.all(o).then(l=>on.mergeArray(n,l)):on.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new Kr({...this._def,rest:e})}}Kr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Kr({items:t,typeName:he.ZodTuple,rest:null,...xe(e)})};class yu extends Ce{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!==q.object)return te(r,{code:V.invalid_type,expected:q.object,received:r.parsedType}),ye;const i=[],o=this._def.keyType,l=this._def.valueType;for(const s in r.data)i.push({key:o._parse(new Hr(r,s,r.path,s)),value:l._parse(new Hr(r,r.data[s],r.path,s))});return r.common.async?on.mergeObjectAsync(n,i):on.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Ce?new yu({keyType:e,valueType:n,typeName:he.ZodRecord,...xe(r)}):new yu({keyType:yr.create(),valueType:e,typeName:he.ZodRecord,...xe(n)})}}class Hd extends Ce{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!==q.map)return te(r,{code:V.invalid_type,expected:q.map,received:r.parsedType}),ye;const i=this._def.keyType,o=this._def.valueType,l=[...r.data.entries()].map(([s,a],u)=>({key:i._parse(new Hr(r,s,r.path,[u,"key"])),value:o._parse(new Hr(r,a,r.path,[u,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const a of l){const u=await a.key,c=await a.value;if(u.status==="aborted"||c.status==="aborted")return ye;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const a of l){const u=a.key,c=a.value;if(u.status==="aborted"||c.status==="aborted")return ye;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}}}}Hd.create=(t,e,n)=>new Hd({valueType:e,keyType:t,typeName:he.ZodMap,...xe(n)});class Xo extends Ce{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.set)return te(r,{code:V.invalid_type,expected:q.set,received:r.parsedType}),ye;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(te(r,{code:V.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(te(r,{code:V.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function l(a){const u=new Set;for(const c of a){if(c.status==="aborted")return ye;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const s=[...r.data.values()].map((a,u)=>o._parse(new Hr(r,a,r.path,u)));return r.common.async?Promise.all(s).then(a=>l(a)):l(s)}min(e,n){return new Xo({...this._def,minSize:{value:e,message:fe.toString(n)}})}max(e,n){return new Xo({...this._def,maxSize:{value:e,message:fe.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Xo.create=(t,e)=>new Xo({valueType:t,minSize:null,maxSize:null,typeName:he.ZodSet,...xe(e)});class Ql extends Ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==q.function)return te(n,{code:V.invalid_type,expected:q.function,received:n.parsedType}),ye;function r(s,a){return Bd({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Fd(),du].filter(u=>!!u),issueData:{code:V.invalid_arguments,argumentsError:a}})}function i(s,a){return Bd({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Fd(),du].filter(u=>!!u),issueData:{code:V.invalid_return_type,returnTypeError:a}})}const o={errorMap:n.common.contextualErrorMap},l=n.data;if(this._def.returns instanceof ps){const s=this;return yn(async function(...a){const u=new wr([]),c=await s._def.args.parseAsync(a,o).catch(h=>{throw u.addIssue(r(a,h)),u}),d=await Reflect.apply(l,this,c);return await s._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{const s=this;return yn(function(...a){const u=s._def.args.safeParse(a,o);if(!u.success)throw new wr([r(a,u.error)]);const c=Reflect.apply(l,this,u.data),d=s._def.returns.safeParse(c,o);if(!d.success)throw new wr([i(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ql({...this._def,args:Kr.create(e).rest(zo.create())})}returns(e){return new Ql({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new Ql({args:e||Kr.create([]).rest(zo.create()),returns:n||zo.create(),typeName:he.ZodFunction,...xe(r)})}}class xu extends Ce{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})}}xu.create=(t,e)=>new xu({getter:t,typeName:he.ZodLazy,...xe(e)});class _u extends Ce{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return te(n,{received:n.data,code:V.invalid_literal,expected:this._def.value}),ye}return{status:"valid",value:e.data}}get value(){return this._def.value}}_u.create=(t,e)=>new _u({value:t,typeName:he.ZodLiteral,...xe(e)});function NC(t,e){return new co({values:t,typeName:he.ZodEnum,...xe(e)})}class co extends Ce{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return te(n,{expected:De.joinValues(r),received:n.parsedType,code:V.invalid_type}),ye}if(this._def.values.indexOf(e.data)===-1){const n=this._getOrReturnCtx(e),r=this._def.values;return te(n,{received:n.data,code:V.invalid_enum_value,options:r}),ye}return yn(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){return co.create(e)}exclude(e){return co.create(this.options.filter(n=>!e.includes(n)))}}co.create=NC;class wu extends Ce{_parse(e){const n=De.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==q.string&&r.parsedType!==q.number){const i=De.objectValues(n);return te(r,{expected:De.joinValues(i),received:r.parsedType,code:V.invalid_type}),ye}if(n.indexOf(e.data)===-1){const i=De.objectValues(n);return te(r,{received:r.data,code:V.invalid_enum_value,options:i}),ye}return yn(e.data)}get enum(){return this._def.values}}wu.create=(t,e)=>new wu({values:t,typeName:he.ZodNativeEnum,...xe(e)});class ps extends Ce{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==q.promise&&n.common.async===!1)return te(n,{code:V.invalid_type,expected:q.promise,received:n.parsedType}),ye;const r=n.parsedType===q.promise?n.data:Promise.resolve(n.data);return yn(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ps.create=(t,e)=>new ps({type:t,typeName:he.ZodPromise,...xe(e)});class kr extends Ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===he.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:l=>{te(r,l),l.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const l=i.transform(r.data,o);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(l).then(s=>this._def.schema._parseAsync({data:s,path:r.path,parent:r})):this._def.schema._parseSync({data:l,path:r.path,parent:r})}if(i.type==="refinement"){const l=s=>{const a=i.refinement(s,o);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ye:(s.status==="dirty"&&n.dirty(),l(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?ye:(s.status==="dirty"&&n.dirty(),l(s.value).then(()=>({status:n.value,value:s.value}))))}if(i.type==="transform")if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!fu(l))return l;const s=i.transform(l.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>fu(l)?Promise.resolve(i.transform(l.value,o)).then(s=>({status:n.value,value:s})):l);De.assertNever(i)}}kr.create=(t,e,n)=>new kr({schema:t,typeName:he.ZodEffects,effect:e,...xe(n)});kr.createWithPreprocess=(t,e,n)=>new kr({schema:e,effect:{type:"preprocess",transform:t},typeName:he.ZodEffects,...xe(n)});class ci extends Ce{_parse(e){return this._getType(e)===q.undefined?yn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ci.create=(t,e)=>new ci({innerType:t,typeName:he.ZodOptional,...xe(e)});class Qo extends Ce{_parse(e){return this._getType(e)===q.null?yn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Qo.create=(t,e)=>new Qo({innerType:t,typeName:he.ZodNullable,...xe(e)});class Su extends Ce{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===q.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Su.create=(t,e)=>new Su({innerType:t,typeName:he.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...xe(e)});class Kd extends Ce{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ud(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new wr(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new wr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Kd.create=(t,e)=>new Kd({innerType:t,typeName:he.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...xe(e)});class Zd extends Ce{_parse(e){if(this._getType(e)!==q.nan){const r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:q.nan,received:r.parsedType}),ye}return{status:"valid",value:e.data}}}Zd.create=t=>new Zd({typeName:he.ZodNaN,...xe(t)});const T5=Symbol("zod_brand");class RC extends Ce{_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 Uu extends Ce{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?ye:o.status==="dirty"?(n.dirty(),TC(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ye:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new Uu({in:e,out:n,typeName:he.ZodPipeline})}}class Gd extends Ce{_parse(e){const n=this._def.innerType._parse(e);return fu(n)&&(n.value=Object.freeze(n.value)),n}}Gd.create=(t,e)=>new Gd({innerType:t,typeName:he.ZodReadonly,...xe(e)});const OC=(t,e={},n)=>t?hs.create().superRefine((r,i)=>{var o,l;if(!t(r)){const s=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,a=(l=(o=s.fatal)!==null&&o!==void 0?o:n)!==null&&l!==void 0?l:!0,u=typeof s=="string"?{message:s}:s;i.addIssue({code:"custom",...u,fatal:a})}}):hs.create(),N5={object:ct.lazycreate};var he;(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"})(he||(he={}));const R5=(t,e={message:`Input not instance of ${t.name}`})=>OC(n=>n instanceof t,e),PC=yr.create,AC=ao.create,O5=Zd.create,P5=uo.create,MC=hu.create,A5=Yo.create,M5=Wd.create,L5=pu.create,I5=gu.create,D5=hs.create,j5=zo.create,z5=gi.create,F5=Vd.create,B5=Sr.create,U5=ct.create,W5=ct.strictCreate,V5=mu.create,H5=If.create,K5=vu.create,Z5=Kr.create,G5=yu.create,Y5=Hd.create,X5=Xo.create,Q5=Ql.create,J5=xu.create,q5=_u.create,e3=co.create,t3=wu.create,n3=ps.create,Nx=kr.create,r3=ci.create,i3=Qo.create,o3=kr.createWithPreprocess,l3=Uu.create,s3=()=>PC().optional(),a3=()=>AC().optional(),u3=()=>MC().optional(),c3={string:t=>yr.create({...t,coerce:!0}),number:t=>ao.create({...t,coerce:!0}),boolean:t=>hu.create({...t,coerce:!0}),bigint:t=>uo.create({...t,coerce:!0}),date:t=>Yo.create({...t,coerce:!0})},d3=ye;var Cn=Object.freeze({__proto__:null,defaultErrorMap:du,setErrorMap:g5,getErrorMap:Fd,makeIssue:Bd,EMPTY_PATH:m5,addIssueToContext:te,ParseStatus:on,INVALID:ye,DIRTY:TC,OK:yn,isAborted:Dg,isDirty:jg,isValid:fu,isAsync:Ud,get util(){return De},get objectUtil(){return Ig},ZodParsedType:q,getParsedType:zi,ZodType:Ce,ZodString:yr,ZodNumber:ao,ZodBigInt:uo,ZodBoolean:hu,ZodDate:Yo,ZodSymbol:Wd,ZodUndefined:pu,ZodNull:gu,ZodAny:hs,ZodUnknown:zo,ZodNever:gi,ZodVoid:Vd,ZodArray:Sr,ZodObject:ct,ZodUnion:mu,ZodDiscriminatedUnion:If,ZodIntersection:vu,ZodTuple:Kr,ZodRecord:yu,ZodMap:Hd,ZodSet:Xo,ZodFunction:Ql,ZodLazy:xu,ZodLiteral:_u,ZodEnum:co,ZodNativeEnum:wu,ZodPromise:ps,ZodEffects:kr,ZodTransformer:kr,ZodOptional:ci,ZodNullable:Qo,ZodDefault:Su,ZodCatch:Kd,ZodNaN:Zd,BRAND:T5,ZodBranded:RC,ZodPipeline:Uu,ZodReadonly:Gd,custom:OC,Schema:Ce,ZodSchema:Ce,late:N5,get ZodFirstPartyTypeKind(){return he},coerce:c3,any:D5,array:B5,bigint:P5,boolean:MC,date:A5,discriminatedUnion:H5,effect:Nx,enum:e3,function:Q5,instanceof:R5,intersection:K5,lazy:J5,literal:q5,map:Y5,nan:O5,nativeEnum:t3,never:z5,null:I5,nullable:i3,number:AC,object:U5,oboolean:u3,onumber:a3,optional:r3,ostring:s3,pipeline:l3,preprocess:o3,promise:n3,record:G5,set:X5,strictObject:W5,string:PC,symbol:M5,transformer:Nx,tuple:Z5,undefined:L5,union:V5,unknown:j5,void:F5,NEVER:d3,ZodIssueCode:V,quotelessJson:p5,ZodError:wr});const f3=Cn.union([Cn.object({id:Cn.string(),mode:Cn.literal("proxy"),full_name:Cn.string().optional().nullable(),username:Cn.string().optional().nullable(),avatar_url:Cn.string().url().optional().nullable(),enabled:Cn.boolean()}),Cn.object({mode:Cn.literal("local"),enabled:Cn.boolean().optional()}),Cn.object({mode:Cn.literal("unauthorized"),enabled:Cn.boolean().optional()})]);function h3(t){const[e,n]=p.useState({status:"not-asked"}),[r,i]=p.useState(0);return p.useEffect(()=>{n({status:"loading"}),t.getSession().then(async o=>{try{if(Lo.isOk(o)){const l=o.value;n({status:"success",data:f3.parse(l)})}else o.error.statusCode===401?n({status:"success",data:{mode:"unauthorized"}}):r<3?setTimeout(()=>{i(r+1)},200*r):n({status:"error",error:"Could not fetch session"})}catch(l){console.error("Could not authorize:",l),n({status:"error",error:"Got an error while trying to get session"})}})},[r]),e}const Rx=t=>typeof t=="boolean"?"".concat(t):t===0?"0":t,Ox=uS,p3=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return Ox(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=e,l=Object.keys(i).map(u=>{const c=n==null?void 0:n[u],d=o==null?void 0:o[u];if(c===null)return null;const f=Rx(c)||Rx(d);return i[u][f]}),s=n&&Object.entries(n).reduce((u,c)=>{let[d,f]=c;return f===void 0||(u[d]=f),u},{}),a=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:d,className:f,...h}=c;return Object.entries(h).every(m=>{let[g,w]=m;return Array.isArray(w)?w.includes({...o,...s}[g]):{...o,...s}[g]===w})?[...u,d,f]:u},[]);return Ox(t,l,a,n==null?void 0:n.class,n==null?void 0:n.className)},g3=p3("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ms=p.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...i},o)=>{const l=r?as:"button";return _.jsx(l,{className:xt(g3({variant:e,size:n,className:t})),ref:o,...i})});Ms.displayName="Button";const Fv=p.forwardRef(({className:t,type:e,...n},r)=>_.jsx("input",{type:e,className:xt("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...n}));Fv.displayName="Input";function LC(t){const e=t+"CollectionProvider",[n,r]=ol(e),[i,o]=n(e,{collectionRef:{current:null},itemMap:new Map}),l=h=>{const{scope:m,children:g}=h,w=re.useRef(null),v=re.useRef(new Map).current;return re.createElement(i,{scope:m,itemMap:v,collectionRef:w},g)},s=t+"CollectionSlot",a=re.forwardRef((h,m)=>{const{scope:g,children:w}=h,v=o(s,g),y=st(m,v.collectionRef);return re.createElement(as,{ref:y},w)}),u=t+"CollectionItemSlot",c="data-radix-collection-item",d=re.forwardRef((h,m)=>{const{scope:g,children:w,...v}=h,y=re.useRef(null),x=st(m,y),S=o(u,g);return re.useEffect(()=>(S.itemMap.set(y,{ref:y,...v}),()=>void S.itemMap.delete(y))),re.createElement(as,{[c]:"",ref:x},w)});function f(h){const m=o(t+"CollectionConsumer",h);return re.useCallback(()=>{const w=m.collectionRef.current;if(!w)return[];const v=Array.from(w.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((S,b)=>v.indexOf(S.ref.current)-v.indexOf(b.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:l,Slot:a,ItemSlot:d},f,r]}function m3(t,e=globalThis==null?void 0:globalThis.document){const n=en(t);p.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r),()=>e.removeEventListener("keydown",r)},[n,e])}const Fg="dismissableLayer.update",v3="dismissableLayer.pointerDownOutside",y3="dismissableLayer.focusOutside";let Px;const x3=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_3=p.forwardRef((t,e)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:l,onInteractOutside:s,onDismiss:a,...u}=t,c=p.useContext(x3),[d,f]=p.useState(null),h=(n=d==null?void 0:d.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,m]=p.useState({}),g=st(e,O=>f(O)),w=Array.from(c.layers),[v]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=w.indexOf(v),x=d?w.indexOf(d):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,b=x>=y,T=w3(O=>{const L=O.target,P=[...c.branches].some(D=>D.contains(L));!b||P||(o==null||o(O),s==null||s(O),O.defaultPrevented||a==null||a())},h),$=S3(O=>{const L=O.target;[...c.branches].some(D=>D.contains(L))||(l==null||l(O),s==null||s(O),O.defaultPrevented||a==null||a())},h);return m3(O=>{x===c.layers.size-1&&(i==null||i(O),!O.defaultPrevented&&a&&(O.preventDefault(),a()))},h),p.useEffect(()=>{if(d)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Px=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),Ax(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Px)}},[d,h,r,c]),p.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),Ax())},[d,c]),p.useEffect(()=>{const O=()=>m({});return document.addEventListener(Fg,O),()=>document.removeEventListener(Fg,O)},[]),p.createElement(Ke.div,ie({},u,{ref:g,style:{pointerEvents:S?b?"auto":"none":void 0,...t.style},onFocusCapture:nt(t.onFocusCapture,$.onFocusCapture),onBlurCapture:nt(t.onBlurCapture,$.onBlurCapture),onPointerDownCapture:nt(t.onPointerDownCapture,T.onPointerDownCapture)}))});function w3(t,e=globalThis==null?void 0:globalThis.document){const n=en(t),r=p.useRef(!1),i=p.useRef(()=>{});return p.useEffect(()=>{const o=s=>{if(s.target&&!r.current){let c=function(){IC(v3,n,u,{discrete:!0})};var a=c;const u={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=c,e.addEventListener("click",i.current,{once:!0})):c()}else e.removeEventListener("click",i.current);r.current=!1},l=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),e.removeEventListener("pointerdown",o),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function S3(t,e=globalThis==null?void 0:globalThis.document){const n=en(t),r=p.useRef(!1);return p.useEffect(()=>{const i=o=>{o.target&&!r.current&&IC(y3,n,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ax(){const t=new CustomEvent(Fg);document.dispatchEvent(t)}function IC(t,e,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?t2(i,o):i.dispatchEvent(o)}let Fh=0;function E3(){p.useEffect(()=>{var t,e;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(t=n[0])!==null&&t!==void 0?t:Mx()),document.body.insertAdjacentElement("beforeend",(e=n[1])!==null&&e!==void 0?e:Mx()),Fh++,()=>{Fh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),Fh--}},[])}function Mx(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",t}const Bh="focusScope.autoFocusOnMount",Uh="focusScope.autoFocusOnUnmount",Lx={bubbles:!1,cancelable:!0},C3=p.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...l}=t,[s,a]=p.useState(null),u=en(i),c=en(o),d=p.useRef(null),f=st(e,g=>a(g)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let y=function(T){if(h.paused||!s)return;const $=T.target;s.contains($)?d.current=$:Oi(d.current,{select:!0})},x=function(T){if(h.paused||!s)return;const $=T.relatedTarget;$!==null&&(s.contains($)||Oi(d.current,{select:!0}))},S=function(T){if(document.activeElement===document.body)for(const O of T)O.removedNodes.length>0&&Oi(s)};var g=y,w=x,v=S;document.addEventListener("focusin",y),document.addEventListener("focusout",x);const b=new MutationObserver(S);return s&&b.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),b.disconnect()}}},[r,s,h.paused]),p.useEffect(()=>{if(s){Dx.add(h);const g=document.activeElement;if(!s.contains(g)){const v=new CustomEvent(Bh,Lx);s.addEventListener(Bh,u),s.dispatchEvent(v),v.defaultPrevented||(k3(R3(DC(s)),{select:!0}),document.activeElement===g&&Oi(s))}return()=>{s.removeEventListener(Bh,u),setTimeout(()=>{const v=new CustomEvent(Uh,Lx);s.addEventListener(Uh,c),s.dispatchEvent(v),v.defaultPrevented||Oi(g??document.body,{select:!0}),s.removeEventListener(Uh,c),Dx.remove(h)},0)}}},[s,u,c,h]);const m=p.useCallback(g=>{if(!n&&!r||h.paused)return;const w=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(w&&v){const y=g.currentTarget,[x,S]=b3(y);x&&S?!g.shiftKey&&v===S?(g.preventDefault(),n&&Oi(x,{select:!0})):g.shiftKey&&v===x&&(g.preventDefault(),n&&Oi(S,{select:!0})):v===y&&g.preventDefault()}},[n,r,h.paused]);return p.createElement(Ke.div,ie({tabIndex:-1},l,{ref:f,onKeyDown:m}))});function k3(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Oi(r,{select:e}),document.activeElement!==n)return}function b3(t){const e=DC(t),n=Ix(e,t),r=Ix(e.reverse(),t);return[n,r]}function DC(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Ix(t,e){for(const n of t)if(!$3(n,{upTo:e}))return n}function $3(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}function T3(t){return t instanceof HTMLInputElement&&"select"in t}function Oi(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&T3(t)&&e&&t.select()}}const Dx=N3();function N3(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=jx(t,e),t.unshift(e)},remove(e){var n;t=jx(t,e),(n=t[0])===null||n===void 0||n.resume()}}}function jx(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function R3(t){return t.filter(e=>e.tagName!=="A")}const O3=M_.useId||(()=>{});let P3=0;function Df(t){const[e,n]=p.useState(O3());return Un(()=>{t||n(r=>r??String(P3++))},[t]),t||(e?`radix-${e}`:"")}const A3=["top","right","bottom","left"],fo=Math.min,Ln=Math.max,Yd=Math.round,Sc=Math.floor,ho=t=>({x:t,y:t}),M3={left:"right",right:"left",bottom:"top",top:"bottom"},L3={start:"end",end:"start"};function Bg(t,e,n){return Ln(t,fo(e,n))}function mi(t,e){return typeof t=="function"?t(e):t}function vi(t){return t.split("-")[0]}function Ls(t){return t.split("-")[1]}function Bv(t){return t==="x"?"y":"x"}function Uv(t){return t==="y"?"height":"width"}function Is(t){return["top","bottom"].includes(vi(t))?"y":"x"}function Wv(t){return Bv(Is(t))}function I3(t,e,n){n===void 0&&(n=!1);const r=Ls(t),i=Wv(t),o=Uv(i);let l=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(l=Xd(l)),[l,Xd(l)]}function D3(t){const e=Xd(t);return[Ug(t),e,Ug(e)]}function Ug(t){return t.replace(/start|end/g,e=>L3[e])}function j3(t,e,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],l=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?o:l;default:return[]}}function z3(t,e,n,r){const i=Ls(t);let o=j3(vi(t),n==="start",r);return i&&(o=o.map(l=>l+"-"+i),e&&(o=o.concat(o.map(Ug)))),o}function Xd(t){return t.replace(/left|right|bottom|top/g,e=>M3[e])}function F3(t){return{top:0,right:0,bottom:0,left:0,...t}}function jC(t){return typeof t!="number"?F3(t):{top:t,right:t,bottom:t,left:t}}function Qd(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function zx(t,e,n){let{reference:r,floating:i}=t;const o=Is(e),l=Wv(e),s=Uv(l),a=vi(e),u=o==="y",c=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2;let h;switch(a){case"top":h={x:c,y:r.y-i.height};break;case"bottom":h={x:c,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-i.width,y:d};break;default:h={x:r.x,y:r.y}}switch(Ls(e)){case"start":h[l]-=f*(n&&u?-1:1);break;case"end":h[l]+=f*(n&&u?-1:1);break}return h}const B3=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:l}=n,s=o.filter(Boolean),a=await(l.isRTL==null?void 0:l.isRTL(e));let u=await l.getElementRects({reference:t,floating:e,strategy:i}),{x:c,y:d}=zx(u,r,a),f=r,h={},m=0;for(let g=0;g<s.length;g++){const{name:w,fn:v}=s[g],{x:y,y:x,data:S,reset:b}=await v({x:c,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:h,rects:u,platform:l,elements:{reference:t,floating:e}});if(c=y??c,d=x??d,h={...h,[w]:{...h[w],...S}},b&&m<=50){m++,typeof b=="object"&&(b.placement&&(f=b.placement),b.rects&&(u=b.rects===!0?await l.getElementRects({reference:t,floating:e,strategy:i}):b.rects),{x:c,y:d}=zx(u,f,a)),g=-1;continue}}return{x:c,y:d,placement:f,strategy:i,middlewareData:h}};async function Eu(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:o,rects:l,elements:s,strategy:a}=t,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=mi(e,t),m=jC(h),w=s[f?d==="floating"?"reference":"floating":d],v=Qd(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(w)))==null||n?w:w.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:a})),y=d==="floating"?{...l.floating,x:r,y:i}:l.reference,x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(s.floating)),S=await(o.isElement==null?void 0:o.isElement(x))?await(o.getScale==null?void 0:o.getScale(x))||{x:1,y:1}:{x:1,y:1},b=Qd(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({rect:y,offsetParent:x,strategy:a}):y);return{top:(v.top-b.top+m.top)/S.y,bottom:(b.bottom-v.bottom+m.bottom)/S.y,left:(v.left-b.left+m.left)/S.x,right:(b.right-v.right+m.right)/S.x}}const Fx=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:l,elements:s,middlewareData:a}=e,{element:u,padding:c=0}=mi(t,e)||{};if(u==null)return{};const d=jC(c),f={x:n,y:r},h=Wv(i),m=Uv(h),g=await l.getDimensions(u),w=h==="y",v=w?"top":"left",y=w?"bottom":"right",x=w?"clientHeight":"clientWidth",S=o.reference[m]+o.reference[h]-f[h]-o.floating[m],b=f[h]-o.reference[h],T=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u));let $=T?T[x]:0;(!$||!await(l.isElement==null?void 0:l.isElement(T)))&&($=s.floating[x]||o.floating[m]);const O=S/2-b/2,L=$/2-g[m]/2-1,P=fo(d[v],L),D=fo(d[y],L),B=P,oe=$-g[m]-D,H=$/2-g[m]/2+O,Z=Bg(B,H,oe),C=!a.arrow&&Ls(i)!=null&&H!=Z&&o.reference[m]/2-(H<B?P:D)-g[m]/2<0,k=C?H<B?H-B:H-oe:0;return{[h]:f[h]+k,data:{[h]:Z,centerOffset:H-Z-k,...C&&{alignmentOffset:k}},reset:C}}}),U3=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:o,rects:l,initialPlacement:s,platform:a,elements:u}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...w}=mi(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const v=vi(i),y=vi(s)===s,x=await(a.isRTL==null?void 0:a.isRTL(u.floating)),S=f||(y||!g?[Xd(s)]:D3(s));!f&&m!=="none"&&S.push(...z3(s,g,m,x));const b=[s,...S],T=await Eu(e,w),$=[];let O=((r=o.flip)==null?void 0:r.overflows)||[];if(c&&$.push(T[v]),d){const B=I3(i,l,x);$.push(T[B[0]],T[B[1]])}if(O=[...O,{placement:i,overflows:$}],!$.every(B=>B<=0)){var L,P;const B=(((L=o.flip)==null?void 0:L.index)||0)+1,oe=b[B];if(oe)return{data:{index:B,overflows:O},reset:{placement:oe}};let H=(P=O.filter(Z=>Z.overflows[0]<=0).sort((Z,C)=>Z.overflows[1]-C.overflows[1])[0])==null?void 0:P.placement;if(!H)switch(h){case"bestFit":{var D;const Z=(D=O.map(C=>[C.placement,C.overflows.filter(k=>k>0).reduce((k,E)=>k+E,0)]).sort((C,k)=>C[1]-k[1])[0])==null?void 0:D[0];Z&&(H=Z);break}case"initialPlacement":H=s;break}if(i!==H)return{reset:{placement:H}}}return{}}}};function Bx(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ux(t){return A3.some(e=>t[e]>=0)}const W3=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=mi(t,e);switch(r){case"referenceHidden":{const o=await Eu(e,{...i,elementContext:"reference"}),l=Bx(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Ux(l)}}}case"escaped":{const o=await Eu(e,{...i,altBoundary:!0}),l=Bx(o,n.floating);return{data:{escapedOffsets:l,escaped:Ux(l)}}}default:return{}}}}};async function V3(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),l=vi(n),s=Ls(n),a=Is(n)==="y",u=["left","top"].includes(l)?-1:1,c=o&&a?-1:1,d=mi(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&typeof m=="number"&&(h=s==="end"?m*-1:m),a?{x:h*c,y:f*u}:{x:f*u,y:h*c}}const H3=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){const{x:n,y:r}=e,i=await V3(e,t);return{x:n+i.x,y:r+i.y,data:i}}}},K3=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:s={fn:w=>{let{x:v,y}=w;return{x:v,y}}},...a}=mi(t,e),u={x:n,y:r},c=await Eu(e,a),d=Is(vi(i)),f=Bv(d);let h=u[f],m=u[d];if(o){const w=f==="y"?"top":"left",v=f==="y"?"bottom":"right",y=h+c[w],x=h-c[v];h=Bg(y,h,x)}if(l){const w=d==="y"?"top":"left",v=d==="y"?"bottom":"right",y=m+c[w],x=m-c[v];m=Bg(y,m,x)}const g=s.fn({...e,[f]:h,[d]:m});return{...g,data:{x:g.x-n,y:g.y-r}}}}},Z3=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:o,middlewareData:l}=e,{offset:s=0,mainAxis:a=!0,crossAxis:u=!0}=mi(t,e),c={x:n,y:r},d=Is(i),f=Bv(d);let h=c[f],m=c[d];const g=mi(s,e),w=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(a){const x=f==="y"?"height":"width",S=o.reference[f]-o.floating[x]+w.mainAxis,b=o.reference[f]+o.reference[x]-w.mainAxis;h<S?h=S:h>b&&(h=b)}if(u){var v,y;const x=f==="y"?"width":"height",S=["top","left"].includes(vi(i)),b=o.reference[d]-o.floating[x]+(S&&((v=l.offset)==null?void 0:v[d])||0)+(S?0:w.crossAxis),T=o.reference[d]+o.reference[x]+(S?0:((y=l.offset)==null?void 0:y[d])||0)-(S?w.crossAxis:0);m<b?m=b:m>T&&(m=T)}return{[f]:h,[d]:m}}}},G3=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:i,elements:o}=e,{apply:l=()=>{},...s}=mi(t,e),a=await Eu(e,s),u=vi(n),c=Ls(n),d=Is(n)==="y",{width:f,height:h}=r.floating;let m,g;u==="top"||u==="bottom"?(m=u,g=c===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(g=u,m=c==="end"?"top":"bottom");const w=h-a[m],v=f-a[g],y=!e.middlewareData.shift;let x=w,S=v;if(d){const T=f-a.left-a.right;S=c||y?fo(v,T):T}else{const T=h-a.top-a.bottom;x=c||y?fo(w,T):T}if(y&&!c){const T=Ln(a.left,0),$=Ln(a.right,0),O=Ln(a.top,0),L=Ln(a.bottom,0);d?S=f-2*(T!==0||$!==0?T+$:Ln(a.left,a.right)):x=h-2*(O!==0||L!==0?O+L:Ln(a.top,a.bottom))}await l({...e,availableWidth:S,availableHeight:x});const b=await i.getDimensions(o.floating);return f!==b.width||h!==b.height?{reset:{rects:!0}}:{}}}};function po(t){return zC(t)?(t.nodeName||"").toLowerCase():"#document"}function Fn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ci(t){var e;return(e=(zC(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function zC(t){return t instanceof Node||t instanceof Fn(t).Node}function yi(t){return t instanceof Element||t instanceof Fn(t).Element}function Zr(t){return t instanceof HTMLElement||t instanceof Fn(t).HTMLElement}function Wx(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Fn(t).ShadowRoot}function Wu(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=ir(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function Y3(t){return["table","td","th"].includes(po(t))}function Vv(t){const e=Hv(),n=ir(t);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function X3(t){let e=gs(t);for(;Zr(e)&&!jf(e);){if(Vv(e))return e;e=gs(e)}return null}function Hv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function jf(t){return["html","body","#document"].includes(po(t))}function ir(t){return Fn(t).getComputedStyle(t)}function zf(t){return yi(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function gs(t){if(po(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Wx(t)&&t.host||Ci(t);return Wx(e)?e.host:e}function FC(t){const e=gs(t);return jf(e)?t.ownerDocument?t.ownerDocument.body:t.body:Zr(e)&&Wu(e)?e:FC(e)}function Cu(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=FC(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),l=Fn(i);return o?e.concat(l,l.visualViewport||[],Wu(i)?i:[],l.frameElement&&n?Cu(l.frameElement):[]):e.concat(i,Cu(i,[],n))}function BC(t){const e=ir(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Zr(t),o=i?t.offsetWidth:n,l=i?t.offsetHeight:r,s=Yd(n)!==o||Yd(r)!==l;return s&&(n=o,r=l),{width:n,height:r,$:s}}function Kv(t){return yi(t)?t:t.contextElement}function Jl(t){const e=Kv(t);if(!Zr(e))return ho(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=BC(e);let l=(o?Yd(n.width):n.width)/r,s=(o?Yd(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!s||!Number.isFinite(s))&&(s=1),{x:l,y:s}}const Q3=ho(0);function UC(t){const e=Fn(t);return!Hv()||!e.visualViewport?Q3:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function J3(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Fn(t)?!1:e}function Jo(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=Kv(t);let l=ho(1);e&&(r?yi(r)&&(l=Jl(r)):l=Jl(t));const s=J3(o,n,r)?UC(o):ho(0);let a=(i.left+s.x)/l.x,u=(i.top+s.y)/l.y,c=i.width/l.x,d=i.height/l.y;if(o){const f=Fn(o),h=r&&yi(r)?Fn(r):r;let m=f.frameElement;for(;m&&r&&h!==f;){const g=Jl(m),w=m.getBoundingClientRect(),v=ir(m),y=w.left+(m.clientLeft+parseFloat(v.paddingLeft))*g.x,x=w.top+(m.clientTop+parseFloat(v.paddingTop))*g.y;a*=g.x,u*=g.y,c*=g.x,d*=g.y,a+=y,u+=x,m=Fn(m).frameElement}}return Qd({width:c,height:d,x:a,y:u})}function q3(t){let{rect:e,offsetParent:n,strategy:r}=t;const i=Zr(n),o=Ci(n);if(n===o)return e;let l={scrollLeft:0,scrollTop:0},s=ho(1);const a=ho(0);if((i||!i&&r!=="fixed")&&((po(n)!=="body"||Wu(o))&&(l=zf(n)),Zr(n))){const u=Jo(n);s=Jl(n),a.x=u.x+n.clientLeft,a.y=u.y+n.clientTop}return{width:e.width*s.x,height:e.height*s.y,x:e.x*s.x-l.scrollLeft*s.x+a.x,y:e.y*s.y-l.scrollTop*s.y+a.y}}function eM(t){return Array.from(t.getClientRects())}function WC(t){return Jo(Ci(t)).left+zf(t).scrollLeft}function tM(t){const e=Ci(t),n=zf(t),r=t.ownerDocument.body,i=Ln(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Ln(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+WC(t);const s=-n.scrollTop;return ir(r).direction==="rtl"&&(l+=Ln(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:l,y:s}}function nM(t,e){const n=Fn(t),r=Ci(t),i=n.visualViewport;let o=r.clientWidth,l=r.clientHeight,s=0,a=0;if(i){o=i.width,l=i.height;const u=Hv();(!u||u&&e==="fixed")&&(s=i.offsetLeft,a=i.offsetTop)}return{width:o,height:l,x:s,y:a}}function rM(t,e){const n=Jo(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=Zr(t)?Jl(t):ho(1),l=t.clientWidth*o.x,s=t.clientHeight*o.y,a=i*o.x,u=r*o.y;return{width:l,height:s,x:a,y:u}}function Vx(t,e,n){let r;if(e==="viewport")r=nM(t,n);else if(e==="document")r=tM(Ci(t));else if(yi(e))r=rM(e,n);else{const i=UC(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return Qd(r)}function VC(t,e){const n=gs(t);return n===e||!yi(n)||jf(n)?!1:ir(n).position==="fixed"||VC(n,e)}function iM(t,e){const n=e.get(t);if(n)return n;let r=Cu(t,[],!1).filter(s=>yi(s)&&po(s)!=="body"),i=null;const o=ir(t).position==="fixed";let l=o?gs(t):t;for(;yi(l)&&!jf(l);){const s=ir(l),a=Vv(l);!a&&s.position==="fixed"&&(i=null),(o?!a&&!i:!a&&s.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Wu(l)&&!a&&VC(t,l))?r=r.filter(c=>c!==l):i=s,l=gs(l)}return e.set(t,r),r}function oM(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const l=[...n==="clippingAncestors"?iM(e,this._c):[].concat(n),r],s=l[0],a=l.reduce((u,c)=>{const d=Vx(e,c,i);return u.top=Ln(d.top,u.top),u.right=fo(d.right,u.right),u.bottom=fo(d.bottom,u.bottom),u.left=Ln(d.left,u.left),u},Vx(e,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function lM(t){return BC(t)}function sM(t,e,n){const r=Zr(e),i=Ci(e),o=n==="fixed",l=Jo(t,!0,o,e);let s={scrollLeft:0,scrollTop:0};const a=ho(0);if(r||!r&&!o)if((po(e)!=="body"||Wu(i))&&(s=zf(e)),r){const u=Jo(e,!0,o,e);a.x=u.x+e.clientLeft,a.y=u.y+e.clientTop}else i&&(a.x=WC(i));return{x:l.left+s.scrollLeft-a.x,y:l.top+s.scrollTop-a.y,width:l.width,height:l.height}}function Hx(t,e){return!Zr(t)||ir(t).position==="fixed"?null:e?e(t):t.offsetParent}function HC(t,e){const n=Fn(t);if(!Zr(t))return n;let r=Hx(t,e);for(;r&&Y3(r)&&ir(r).position==="static";)r=Hx(r,e);return r&&(po(r)==="html"||po(r)==="body"&&ir(r).position==="static"&&!Vv(r))?n:r||X3(t)||n}const aM=async function(t){let{reference:e,floating:n,strategy:r}=t;const i=this.getOffsetParent||HC,o=this.getDimensions;return{reference:sM(e,await i(n),r),floating:{x:0,y:0,...await o(n)}}};function uM(t){return ir(t).direction==="rtl"}const cM={convertOffsetParentRelativeRectToViewportRelativeRect:q3,getDocumentElement:Ci,getClippingRect:oM,getOffsetParent:HC,getElementRects:aM,getClientRects:eM,getDimensions:lM,getScale:Jl,isElement:yi,isRTL:uM};function dM(t,e){let n=null,r;const i=Ci(t);function o(){clearTimeout(r),n&&n.disconnect(),n=null}function l(s,a){s===void 0&&(s=!1),a===void 0&&(a=1),o();const{left:u,top:c,width:d,height:f}=t.getBoundingClientRect();if(s||e(),!d||!f)return;const h=Sc(c),m=Sc(i.clientWidth-(u+d)),g=Sc(i.clientHeight-(c+f)),w=Sc(u),y={rootMargin:-h+"px "+-m+"px "+-g+"px "+-w+"px",threshold:Ln(0,fo(1,a))||1};let x=!0;function S(b){const T=b[0].intersectionRatio;if(T!==a){if(!x)return l();T?l(!1,T):r=setTimeout(()=>{l(!1,1e-7)},100)}x=!1}try{n=new IntersectionObserver(S,{...y,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,y)}n.observe(t)}return l(!0),o}function fM(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=Kv(t),c=i||o?[...u?Cu(u):[],...Cu(e)]:[];c.forEach(v=>{i&&v.addEventListener("scroll",n,{passive:!0}),o&&v.addEventListener("resize",n)});const d=u&&s?dM(u,n):null;let f=-1,h=null;l&&(h=new ResizeObserver(v=>{let[y]=v;y&&y.target===u&&h&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{h&&h.observe(e)})),n()}),u&&!a&&h.observe(u),h.observe(e));let m,g=a?Jo(t):null;a&&w();function w(){const v=Jo(t);g&&(v.x!==g.x||v.y!==g.y||v.width!==g.width||v.height!==g.height)&&n(),g=v,m=requestAnimationFrame(w)}return n(),()=>{c.forEach(v=>{i&&v.removeEventListener("scroll",n),o&&v.removeEventListener("resize",n)}),d&&d(),h&&h.disconnect(),h=null,a&&cancelAnimationFrame(m)}}const hM=(t,e,n)=>{const r=new Map,i={platform:cM,...n},o={...i.platform,_c:r};return B3(t,e,{...i,platform:o})},pM=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Fx({element:r.current,padding:i}).fn(n):{}:r?Fx({element:r,padding:i}).fn(n):{}}}};var Kc=typeof document<"u"?p.useLayoutEffect:p.useEffect;function Jd(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,i;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(!Jd(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&t.$$typeof)&&!Jd(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function KC(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Kx(t,e){const n=KC(t);return Math.round(e*n)/n}function Zx(t){const e=p.useRef(t);return Kc(()=>{e.current=t}),e}function gM(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:l}={},transform:s=!0,whileElementsMounted:a,open:u}=t,[c,d]=p.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=p.useState(r);Jd(f,r)||h(r);const[m,g]=p.useState(null),[w,v]=p.useState(null),y=p.useCallback(C=>{C!=T.current&&(T.current=C,g(C))},[g]),x=p.useCallback(C=>{C!==$.current&&($.current=C,v(C))},[v]),S=o||m,b=l||w,T=p.useRef(null),$=p.useRef(null),O=p.useRef(c),L=Zx(a),P=Zx(i),D=p.useCallback(()=>{if(!T.current||!$.current)return;const C={placement:e,strategy:n,middleware:f};P.current&&(C.platform=P.current),hM(T.current,$.current,C).then(k=>{const E={...k,isPositioned:!0};B.current&&!Jd(O.current,E)&&(O.current=E,Gr.flushSync(()=>{d(E)}))})},[f,e,n,P]);Kc(()=>{u===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,d(C=>({...C,isPositioned:!1})))},[u]);const B=p.useRef(!1);Kc(()=>(B.current=!0,()=>{B.current=!1}),[]),Kc(()=>{if(S&&(T.current=S),b&&($.current=b),S&&b){if(L.current)return L.current(S,b,D);D()}},[S,b,D,L]);const oe=p.useMemo(()=>({reference:T,floating:$,setReference:y,setFloating:x}),[y,x]),H=p.useMemo(()=>({reference:S,floating:b}),[S,b]),Z=p.useMemo(()=>{const C={position:n,left:0,top:0};if(!H.floating)return C;const k=Kx(H.floating,c.x),E=Kx(H.floating,c.y);return s?{...C,transform:"translate("+k+"px, "+E+"px)",...KC(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:E}},[n,s,H.floating,c.x,c.y]);return p.useMemo(()=>({...c,update:D,refs:oe,elements:H,floatingStyles:Z}),[c,D,oe,H,Z])}function ZC(t){const[e,n]=p.useState(void 0);return Un(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let l,s;if("borderBoxSize"in o){const a=o.borderBoxSize,u=Array.isArray(a)?a[0]:a;l=u.inlineSize,s=u.blockSize}else l=t.offsetWidth,s=t.offsetHeight;n({width:l,height:s})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}const GC="Popper",[YC,XC]=ol(GC),[mM,QC]=YC(GC),vM=t=>{const{__scopePopper:e,children:n}=t,[r,i]=p.useState(null);return p.createElement(mM,{scope:e,anchor:r,onAnchorChange:i},n)},yM="PopperAnchor",xM=p.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,o=QC(yM,n),l=p.useRef(null),s=st(e,l);return p.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||l.current)}),r?null:p.createElement(Ke.div,ie({},i,{ref:s}))}),JC="PopperContent",[_M,RD]=YC(JC),wM=p.forwardRef((t,e)=>{var n,r,i,o,l,s,a,u;const{__scopePopper:c,side:d="bottom",sideOffset:f=0,align:h="center",alignOffset:m=0,arrowPadding:g=0,avoidCollisions:w=!0,collisionBoundary:v=[],collisionPadding:y=0,sticky:x="partial",hideWhenDetached:S=!1,updatePositionStrategy:b="optimized",onPlaced:T,...$}=t,O=QC(JC,c),[L,P]=p.useState(null),D=st(e,Sn=>P(Sn)),[B,oe]=p.useState(null),H=ZC(B),Z=(n=H==null?void 0:H.width)!==null&&n!==void 0?n:0,C=(r=H==null?void 0:H.height)!==null&&r!==void 0?r:0,k=d+(h!=="center"?"-"+h:""),E=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},A=Array.isArray(v)?v:[v],N=A.length>0,F={padding:E,boundary:A.filter(SM),altBoundary:N},{refs:K,floatingStyles:de,placement:se,isPositioned:Ae,middlewareData:Ne}=gM({strategy:"fixed",placement:k,whileElementsMounted:(...Sn)=>fM(...Sn,{animationFrame:b==="always"}),elements:{reference:O.anchor},middleware:[H3({mainAxis:f+C,alignmentAxis:m}),w&&K3({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?Z3():void 0,...F}),w&&U3({...F}),G3({...F,apply:({elements:Sn,rects:lr,availableWidth:ze,availableHeight:Tt})=>{const{width:at,height:ln}=lr.reference,En=Sn.floating.style;En.setProperty("--radix-popper-available-width",`${ze}px`),En.setProperty("--radix-popper-available-height",`${Tt}px`),En.setProperty("--radix-popper-anchor-width",`${at}px`),En.setProperty("--radix-popper-anchor-height",`${ln}px`)}}),B&&pM({element:B,padding:g}),EM({arrowWidth:Z,arrowHeight:C}),S&&W3({strategy:"referenceHidden",...F})]}),[Q,je]=qC(se),be=en(T);Un(()=>{Ae&&(be==null||be())},[Ae,be]);const Re=(i=Ne.arrow)===null||i===void 0?void 0:i.x,we=(o=Ne.arrow)===null||o===void 0?void 0:o.y,Ie=((l=Ne.arrow)===null||l===void 0?void 0:l.centerOffset)!==0,[Qe,Wt]=p.useState();return Un(()=>{L&&Wt(window.getComputedStyle(L).zIndex)},[L]),p.createElement("div",{ref:K.setFloating,"data-radix-popper-content-wrapper":"",style:{...de,transform:Ae?de.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Qe,"--radix-popper-transform-origin":[(s=Ne.transformOrigin)===null||s===void 0?void 0:s.x,(a=Ne.transformOrigin)===null||a===void 0?void 0:a.y].join(" ")},dir:t.dir},p.createElement(_M,{scope:c,placedSide:Q,onArrowChange:oe,arrowX:Re,arrowY:we,shouldHideArrow:Ie},p.createElement(Ke.div,ie({"data-side":Q,"data-align":je},$,{ref:D,style:{...$.style,animation:Ae?void 0:"none",opacity:(u=Ne.hide)!==null&&u!==void 0&&u.referenceHidden?0:void 0}}))))});function SM(t){return t!==null}const EM=t=>({name:"transformOrigin",options:t,fn(e){var n,r,i,o,l;const{placement:s,rects:a,middlewareData:u}=e,d=((n=u.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,f=d?0:t.arrowWidth,h=d?0:t.arrowHeight,[m,g]=qC(s),w={start:"0%",center:"50%",end:"100%"}[g],v=((r=(i=u.arrow)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)+f/2,y=((o=(l=u.arrow)===null||l===void 0?void 0:l.y)!==null&&o!==void 0?o:0)+h/2;let x="",S="";return m==="bottom"?(x=d?w:`${v}px`,S=`${-h}px`):m==="top"?(x=d?w:`${v}px`,S=`${a.floating.height+h}px`):m==="right"?(x=`${-h}px`,S=d?w:`${y}px`):m==="left"&&(x=`${a.floating.width+h}px`,S=d?w:`${y}px`),{data:{x,y:S}}}});function qC(t){const[e,n="center"]=t.split("-");return[e,n]}const CM=vM,kM=xM,bM=wM,$M=p.forwardRef((t,e)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...i}=t;return r?jw.createPortal(p.createElement(Ke.div,ie({},i,{ref:e})),r):null});function ms({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=TM({defaultProp:e,onChange:n}),o=t!==void 0,l=o?t:r,s=en(n),a=p.useCallback(u=>{if(o){const d=typeof u=="function"?u(t):u;d!==t&&s(d)}else i(u)},[o,t,i,s]);return[l,a]}function TM({defaultProp:t,onChange:e}){const n=p.useState(t),[r]=n,i=p.useRef(r),o=en(e);return p.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}function ek(t){const e=p.useRef({value:t,previous:t});return p.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}const NM=p.forwardRef((t,e)=>p.createElement(Ke.span,ie({},t,{ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}})));var RM=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},wl=new WeakMap,Ec=new WeakMap,Cc={},Wh=0,tk=function(t){return t&&(t.host||tk(t.parentNode))},OM=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=tk(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})},PM=function(t,e,n,r){var i=OM(e,Array.isArray(t)?t:[t]);Cc[n]||(Cc[n]=new WeakMap);var o=Cc[n],l=[],s=new Set,a=new Set(i),u=function(d){!d||s.has(d)||(s.add(d),u(d.parentNode))};i.forEach(u);var c=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(f){if(s.has(f))c(f);else{var h=f.getAttribute(r),m=h!==null&&h!=="false",g=(wl.get(f)||0)+1,w=(o.get(f)||0)+1;wl.set(f,g),o.set(f,w),l.push(f),g===1&&m&&Ec.set(f,!0),w===1&&f.setAttribute(n,"true"),m||f.setAttribute(r,"true")}})};return c(e),s.clear(),Wh++,function(){l.forEach(function(d){var f=wl.get(d)-1,h=o.get(d)-1;wl.set(d,f),o.set(d,h),f||(Ec.has(d)||d.removeAttribute(r),Ec.delete(d)),h||d.removeAttribute(n)}),Wh--,Wh||(wl=new WeakMap,wl=new WeakMap,Ec=new WeakMap,Cc={})}},AM=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=e||RM(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),PM(r,i,n,"aria-hidden")):function(){return null}},Lr=function(){return Lr=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Lr.apply(this,arguments)};function nk(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 i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function MM(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}var Zc="right-scroll-bar-position",Gc="width-before-scroll-bar",LM="with-scroll-bars-hidden",IM="--removed-body-scroll-bar-size";function DM(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function jM(t,e){var n=p.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}function zM(t,e){return jM(e||null,function(n){return t.forEach(function(r){return DM(r,n)})})}function FM(t){return t}function BM(t,e){e===void 0&&(e=FM);var n=[],r=!1,i={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(o){var l=e(o,r);return n.push(l),function(){n=n.filter(function(s){return s!==l})}},assignSyncMedium:function(o){for(r=!0;n.length;){var l=n;n=[],l.forEach(o)}n={push:function(s){return o(s)},filter:function(){return n}}},assignMedium:function(o){r=!0;var l=[];if(n.length){var s=n;n=[],s.forEach(o),l=n}var a=function(){var c=l;l=[],c.forEach(o)},u=function(){return Promise.resolve().then(a)};u(),n={push:function(c){l.push(c),u()},filter:function(c){return l=l.filter(c),n}}}};return i}function UM(t){t===void 0&&(t={});var e=BM(null);return e.options=Lr({async:!0,ssr:!1},t),e}var rk=function(t){var e=t.sideCar,n=nk(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 p.createElement(r,Lr({},n))};rk.isSideCarExport=!0;function WM(t,e){return t.useMedium(e),rk}var ik=UM(),Vh=function(){},Ff=p.forwardRef(function(t,e){var n=p.useRef(null),r=p.useState({onScrollCapture:Vh,onWheelCapture:Vh,onTouchMoveCapture:Vh}),i=r[0],o=r[1],l=t.forwardProps,s=t.children,a=t.className,u=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,h=t.noIsolation,m=t.inert,g=t.allowPinchZoom,w=t.as,v=w===void 0?"div":w,y=nk(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),x=f,S=zM([n,e]),b=Lr(Lr({},y),i);return p.createElement(p.Fragment,null,c&&p.createElement(x,{sideCar:ik,removeScrollBar:u,shards:d,noIsolation:h,inert:m,setCallbacks:o,allowPinchZoom:!!g,lockRef:n}),l?p.cloneElement(p.Children.only(s),Lr(Lr({},b),{ref:S})):p.createElement(v,Lr({},b,{className:a,ref:S}),s))});Ff.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ff.classNames={fullWidth:Gc,zeroRight:Zc};var Gx,VM=function(){if(Gx)return Gx;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function HM(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=VM();return e&&t.setAttribute("nonce",e),t}function KM(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function ZM(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var GM=function(){var t=0,e=null;return{add:function(n){t==0&&(e=HM())&&(KM(e,n),ZM(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},YM=function(){var t=GM();return function(e,n){p.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},ok=function(){var t=YM(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},XM={left:0,top:0,right:0,gap:0},Hh=function(t){return parseInt(t||"",10)||0},QM=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[Hh(n),Hh(r),Hh(i)]},JM=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return XM;var e=QM(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])}},qM=ok(),e4=function(t,e,n,r){var i=t.left,o=t.top,l=t.right,s=t.gap;return n===void 0&&(n="margin"),`
|
|
129
|
+
`?e.insertParagraph():o===" "?e.insertNodes([me.$createTabNode()]):e.insertText(o);else e.insertRawText(t)};Si.$insertGeneratedNodes=Rg;Si.copyToClipboard=async function(t,e){if(vl!==null)return!1;if(e!==null)return new Promise(l=>{t.update(()=>{l(xx(t,e))})});var n=t.getRootElement();let r=t._window==null?window.document:t._window.document,i=iC?(t._window||window).getSelection():null;if(n===null||i===null)return!1;let o=r.createElement("span");return o.style.cssText="position: fixed; top: -1000px;",o.append(r.createTextNode("#")),n.append(o),n=new Range,n.setStart(o,0),n.setEnd(o,1),i.removeAllRanges(),i.addRange(n),new Promise(l=>{let s=t.registerCommand(me.COPY_COMMAND,a=>(Xl.objectKlassEquals(a,ClipboardEvent)&&(s(),vl!==null&&(window.clearTimeout(vl),vl=null),l(xx(t,a))),!0),me.COMMAND_PRIORITY_CRITICAL);vl=window.setTimeout(()=>{s(),vl=null,l(!1)},50),r.execCommand("copy"),o.remove()})};const OP=Si;var PP=OP,zd=PP,xc=lo,jr=Ft,M=_e;function _x(t,e){return typeof document.caretRangeFromPoint<"u"?(t=document.caretRangeFromPoint(t,e),t===null?null:{node:t.startContainer,offset:t.startOffset}):document.caretPositionFromPoint!=="undefined"?(t=document.caretPositionFromPoint(t,e),t===null?null:{node:t.offsetNode,offset:t.offset}):null}let Ps=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",AP=Ps&&"documentMode"in document?document.documentMode:null,MP=Ps&&"InputEvent"in window&&!AP?"getTargetRanges"in new window.InputEvent("input"):!1,LP=Ps&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),IP=Ps&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,DP=Ps&&/^(?=.*Chrome).*/i.test(navigator.userAgent),jP=Ps&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!DP,Og=M.createCommand("DRAG_DROP_PASTE_FILE"),Ov=class cC extends M.ElementNode{static getType(){return"quote"}static clone(e){return new cC(e.__key)}constructor(e){super(e)}createDOM(e){let n=document.createElement("blockquote");return jr.addClassNamesToElement(n,e.theme.quote),n}updateDOM(){return!1}static importDOM(){return{blockquote:()=>({conversion:zP,priority:0})}}exportDOM(e){if({element:e}=super.exportDOM(e),e&&jr.isHTMLElement(e)){this.isEmpty()&&e.append(document.createElement("br"));var n=this.getFormatType();e.style.textAlign=n,(n=this.getDirection())&&(e.dir=n)}return{element:e}}static importJSON(e){let n=Pv();return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,n){e=M.$createParagraphNode();let r=this.getDirection();return e.setDirection(r),this.insertAfter(e,n),e}collapseAtStart(){let e=M.$createParagraphNode();return this.getChildren().forEach(n=>e.append(n)),this.replace(e),!0}};function Pv(){return M.$applyNodeReplacement(new Ov)}let Av=class dC extends M.ElementNode{static getType(){return"heading"}static clone(e){return new dC(e.__tag,e.__key)}constructor(e,n){super(n),this.__tag=e}getTag(){return this.__tag}createDOM(e){let n=this.__tag,r=document.createElement(n);return e=e.theme.heading,e!==void 0&&jr.addClassNamesToElement(r,e[n]),r}updateDOM(){return!1}static importDOM(){return{h1:()=>({conversion:yl,priority:0}),h2:()=>({conversion:yl,priority:0}),h3:()=>({conversion:yl,priority:0}),h4:()=>({conversion:yl,priority:0}),h5:()=>({conversion:yl,priority:0}),h6:()=>({conversion:yl,priority:0}),p:e=>(e=e.firstChild,e!==null&&wx(e)?{conversion:()=>({node:null}),priority:3}:null),span:e=>wx(e)?{conversion:()=>({node:Fl("h1")}),priority:3}:null}}exportDOM(e){if({element:e}=super.exportDOM(e),e&&jr.isHTMLElement(e)){this.isEmpty()&&e.append(document.createElement("br"));var n=this.getFormatType();e.style.textAlign=n,(n=this.getDirection())&&(e.dir=n)}return{element:e}}static importJSON(e){let n=Fl(e.tag);return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,n=!0){e=e?e.anchor.offset:0,e=0<e&&e<this.getTextContentSize()?Fl(this.getTag()):M.$createParagraphNode();let r=this.getDirection();return e.setDirection(r),this.insertAfter(e,n),e}collapseAtStart(){let e=this.isEmpty()?M.$createParagraphNode():Fl(this.getTag());return this.getChildren().forEach(n=>e.append(n)),this.replace(e),!0}extractWithChild(){return!0}};function wx(t){return t.nodeName.toLowerCase()==="span"?t.style.fontSize==="26pt":!1}function yl(t){let e=t.nodeName.toLowerCase(),n=null;return(e==="h1"||e==="h2"||e==="h3"||e==="h4"||e==="h5"||e==="h6")&&(n=Fl(e),t.style!==null&&n.setFormat(t.style.textAlign)),{node:n}}function zP(t){let e=Pv();return t.style!==null&&e.setFormat(t.style.textAlign),{node:e}}function Fl(t){return M.$applyNodeReplacement(new Av(t))}function FP(t,e){t.preventDefault(),e.update(()=>{let n=M.$getSelection(),r=t instanceof InputEvent||t instanceof KeyboardEvent?null:t.clipboardData;r!=null&&(M.$isRangeSelection(n)||M.DEPRECATED_$isGridSelection(n))&&zd.$insertDataTransferForRichText(r,n,e)},{tag:"paste"})}async function BP(t,e){await zd.copyToClipboard(e,jr.objectKlassEquals(t,ClipboardEvent)?t:null),e.update(()=>{let n=M.$getSelection();M.$isRangeSelection(n)?n.removeText():M.$isNodeSelection(n)&&n.getNodes().forEach(r=>r.remove())})}function fa(t){let e=null;if(t instanceof DragEvent?e=t.dataTransfer:t instanceof ClipboardEvent&&(e=t.clipboardData),e===null)return[!1,[],!1];var n=e.types;return t=n.includes("Files"),n=n.includes("text/html")||n.includes("text/plain"),[t,Array.from(e.files),n]}function Sx(t){var e=M.$getSelection();if(!M.$isRangeSelection(e))return!1;let n=new Set;e=e.getNodes();for(let o=0;o<e.length;o++){var r=e[o],i=r.getKey();n.has(i)||(r=jr.$getNearestBlockElementAncestorOrThrow(r),i=r.getKey(),r.canIndent()&&!n.has(i)&&(n.add(i),t(r)))}return 0<n.size}function _c(t){return t=M.$getNearestNodeFromDOMNode(t),M.$isDecoratorNode(t)}Jr.$createHeadingNode=Fl;Jr.$createQuoteNode=Pv;Jr.$isHeadingNode=function(t){return t instanceof Av};Jr.$isQuoteNode=function(t){return t instanceof Ov};Jr.DRAG_DROP_PASTE=Og;Jr.HeadingNode=Av;Jr.QuoteNode=Ov;Jr.eventFiles=fa;Jr.registerRichText=function(t){return jr.mergeRegister(t.registerCommand(M.CLICK_COMMAND,()=>{const e=M.$getSelection();return M.$isNodeSelection(e)?(e.clear(),!0):!1},0),t.registerCommand(M.DELETE_CHARACTER_COMMAND,e=>{const n=M.$getSelection();return M.$isRangeSelection(n)?(n.deleteCharacter(e),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.DELETE_WORD_COMMAND,e=>{const n=M.$getSelection();return M.$isRangeSelection(n)?(n.deleteWord(e),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.DELETE_LINE_COMMAND,e=>{const n=M.$getSelection();return M.$isRangeSelection(n)?(n.deleteLine(e),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.CONTROLLED_TEXT_INSERTION_COMMAND,e=>{const n=M.$getSelection();if(typeof e=="string")M.$isRangeSelection(n)?n.insertText(e):M.DEPRECATED_$isGridSelection(n);else{if(!M.$isRangeSelection(n)&&!M.DEPRECATED_$isGridSelection(n))return!1;const r=e.dataTransfer;r!=null?zd.$insertDataTransferForRichText(r,n,t):M.$isRangeSelection(n)&&(e=e.data)&&n.insertText(e)}return!0},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.REMOVE_TEXT_COMMAND,()=>{const e=M.$getSelection();return M.$isRangeSelection(e)?(e.removeText(),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.FORMAT_TEXT_COMMAND,e=>{const n=M.$getSelection();return M.$isRangeSelection(n)?(n.formatText(e),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.FORMAT_ELEMENT_COMMAND,e=>{var n=M.$getSelection();if(!M.$isRangeSelection(n)&&!M.$isNodeSelection(n))return!1;n=n.getNodes();for(const r of n)n=jr.$findMatchingParent(r,i=>M.$isElementNode(i)&&!i.isInline()),n!==null&&n.setFormat(e);return!0},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.INSERT_LINE_BREAK_COMMAND,e=>{const n=M.$getSelection();return M.$isRangeSelection(n)?(n.insertLineBreak(e),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.INSERT_PARAGRAPH_COMMAND,()=>{const e=M.$getSelection();return M.$isRangeSelection(e)?(e.insertParagraph(),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.INSERT_TAB_COMMAND,()=>(M.$insertNodes([M.$createTabNode()]),!0),M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.INDENT_CONTENT_COMMAND,()=>Sx(e=>{const n=e.getIndent();e.setIndent(n+1)}),M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.OUTDENT_CONTENT_COMMAND,()=>Sx(e=>{const n=e.getIndent();0<n&&e.setIndent(n-1)}),M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_ARROW_UP_COMMAND,e=>{var n=M.$getSelection();if(M.$isNodeSelection(n)&&!_c(e.target)){if(e=n.getNodes(),0<e.length)return e[0].selectPrevious(),!0}else if(M.$isRangeSelection(n)&&(n=M.$getAdjacentNode(n.focus,!0),!e.shiftKey&&M.$isDecoratorNode(n)&&!n.isIsolated()&&!n.isInline()))return n.selectPrevious(),e.preventDefault(),!0;return!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_ARROW_DOWN_COMMAND,e=>{var n=M.$getSelection();if(M.$isNodeSelection(n)){if(e=n.getNodes(),0<e.length)return e[0].selectNext(0,0),!0}else if(M.$isRangeSelection(n)){let r=n.focus;if(r.key==="root"&&r.offset===M.$getRoot().getChildrenSize())return e.preventDefault(),!0;if(n=M.$getAdjacentNode(n.focus,!1),!e.shiftKey&&M.$isDecoratorNode(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_ARROW_LEFT_COMMAND,e=>{const n=M.$getSelection();if(M.$isNodeSelection(n)){var r=n.getNodes();if(0<r.length)return e.preventDefault(),r[0].selectPrevious(),!0}return M.$isRangeSelection(n)&&xc.$shouldOverrideDefaultCharacterSelection(n,!0)?(r=e.shiftKey,e.preventDefault(),xc.$moveCharacter(n,r,!0),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_ARROW_RIGHT_COMMAND,e=>{const n=M.$getSelection();if(M.$isNodeSelection(n)&&!_c(e.target)){var r=n.getNodes();if(0<r.length)return e.preventDefault(),r[0].selectNext(0,0),!0}return M.$isRangeSelection(n)?(r=e.shiftKey,xc.$shouldOverrideDefaultCharacterSelection(n,!1)?(e.preventDefault(),xc.$moveCharacter(n,r,!1),!0):!1):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_BACKSPACE_COMMAND,e=>{if(_c(e.target))return!1;const n=M.$getSelection();if(!M.$isRangeSelection(n))return!1;e.preventDefault(),{anchor:e}=n;const r=e.getNode();return n.isCollapsed()&&e.offset===0&&!M.$isRootNode(r)&&0<jr.$getNearestBlockElementAncestorOrThrow(r).getIndent()?t.dispatchCommand(M.OUTDENT_CONTENT_COMMAND,void 0):t.dispatchCommand(M.DELETE_CHARACTER_COMMAND,!0)},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_DELETE_COMMAND,e=>{if(_c(e.target))return!1;const n=M.$getSelection();return M.$isRangeSelection(n)?(e.preventDefault(),t.dispatchCommand(M.DELETE_CHARACTER_COMMAND,!1)):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_ENTER_COMMAND,e=>{const n=M.$getSelection();if(!M.$isRangeSelection(n))return!1;if(e!==null){if((IP||LP||jP)&&MP)return!1;if(e.preventDefault(),e.shiftKey)return t.dispatchCommand(M.INSERT_LINE_BREAK_COMMAND,!1)}return t.dispatchCommand(M.INSERT_PARAGRAPH_COMMAND,void 0)},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.KEY_ESCAPE_COMMAND,()=>{const e=M.$getSelection();return M.$isRangeSelection(e)?(t.blur(),!0):!1},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.DROP_COMMAND,e=>{const[,n]=fa(e);if(0<n.length){var r=_x(e.clientX,e.clientY);if(r!==null){const{offset:o,node:l}=r;var i=M.$getNearestNodeFromDOMNode(l);if(i!==null){if(r=M.$createRangeSelection(),M.$isTextNode(i))r.anchor.set(i.getKey(),o,"text"),r.focus.set(i.getKey(),o,"text");else{const s=i.getParentOrThrow().getKey();i=i.getIndexWithinParent()+1,r.anchor.set(s,i,"element"),r.focus.set(s,i,"element")}r=M.$normalizeSelection__EXPERIMENTAL(r),M.$setSelection(r)}t.dispatchCommand(Og,n)}return e.preventDefault(),!0}return e=M.$getSelection(),!!M.$isRangeSelection(e)},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.DRAGSTART_COMMAND,e=>{[e]=fa(e);const n=M.$getSelection();return!(e&&!M.$isRangeSelection(n))},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.DRAGOVER_COMMAND,e=>{var[n]=fa(e);const r=M.$getSelection();return n&&!M.$isRangeSelection(r)?!1:(n=_x(e.clientX,e.clientY),n!==null&&(n=M.$getNearestNodeFromDOMNode(n.node),M.$isDecoratorNode(n)&&e.preventDefault()),!0)},M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.SELECT_ALL_COMMAND,()=>(M.$selectAll(),!0),M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.COPY_COMMAND,e=>(zd.copyToClipboard(t,jr.objectKlassEquals(e,ClipboardEvent)?e:null),!0),M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.CUT_COMMAND,e=>(BP(e,t),!0),M.COMMAND_PRIORITY_EDITOR),t.registerCommand(M.PASTE_COMMAND,e=>{const[,n,r]=fa(e);if(0<n.length&&!r)return t.dispatchCommand(Og,n),!0;if(M.isSelectionCapturedInDecoratorInput(e.target))return!1;const i=M.$getSelection();return M.$isRangeSelection(i)||M.DEPRECATED_$isGridSelection(i)?(FP(e,t),!0):!1},M.COMMAND_PRIORITY_EDITOR))};const UP=Jr;var Pa=UP,fC=Tr,WP=wP,Jn=p,VP=EP,hC=Ft,Ex=Gr,HP=kP,KP=Pa,Mv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Jn.useLayoutEffect:Jn.useEffect;function Cx(t){return t.getEditorState().read(VP.$canShowPlaceholderCurry(t.isComposing()))}function ZP(t){let[e,n]=Jn.useState(()=>Cx(t));return Mv(()=>{function r(){let i=Cx(t);n(i)}return r(),hC.mergeRegister(t.registerUpdateListener(()=>{r()}),t.registerEditableListener(()=>{r()}))},[t]),e}function GP(t,e){let[n,r]=Jn.useState(()=>t.getDecorators());return Mv(()=>t.registerDecoratorListener(i=>{Ex.flushSync(()=>{r(i)})}),[t]),Jn.useEffect(()=>{r(t.getDecorators())},[t]),Jn.useMemo(()=>{let i=[],o=Object.keys(n);for(let l=0;l<o.length;l++){let s=o[l],a=Jn.createElement(e,{onError:c=>t._onError(c)},Jn.createElement(Jn.Suspense,{fallback:null},n[s])),u=t.getElementByKey(s);u!==null&&i.push(Ex.createPortal(a,u,s))}return i},[e,n,t])}function YP(t){Mv(()=>hC.mergeRegister(KP.registerRichText(t),HP.registerDragonSupport(t)),[t])}function XP({content:t}){var[e]=fC.useLexicalComposerContext();e=ZP(e);let n=WP();return e?typeof t=="function"?t(n):t:null}XE.RichTextPlugin=function({contentEditable:t,placeholder:e,ErrorBoundary:n}){let[r]=fC.useLexicalComposerContext();return n=GP(r,n),YP(r),Jn.createElement(Jn.Fragment,null,t,Jn.createElement(XP,{content:e}),n)};const QP=XE;var JP=QP,pC={},ni=ji,qP=Tr,gC=p,eA=Ft,qs=_e;function tA(t){gC.useEffect(()=>eA.mergeRegister(t.registerCommand(ni.INSERT_ORDERED_LIST_COMMAND,()=>(ni.insertList(t,"number"),!0),qs.COMMAND_PRIORITY_LOW),t.registerCommand(ni.INSERT_UNORDERED_LIST_COMMAND,()=>(ni.insertList(t,"bullet"),!0),qs.COMMAND_PRIORITY_LOW),t.registerCommand(ni.REMOVE_LIST_COMMAND,()=>(ni.removeList(t),!0),qs.COMMAND_PRIORITY_LOW),t.registerCommand(qs.INSERT_PARAGRAPH_COMMAND,()=>!!ni.$handleListInsertParagraph(),qs.COMMAND_PRIORITY_LOW)),[t])}pC.ListPlugin=function(){let[t]=qP.useLexicalComposerContext();return gC.useEffect(()=>{if(!t.hasNodes([ni.ListNode,ni.ListItemNode]))throw Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[t]),tA(t),null};const nA=pC;var rA=nA,mC={},Ei={},vC=Ft,Ur=_e;let iA=new Set(["http:","https:","mailto:","sms:","tel:"]);class As extends Ur.ElementNode{static getType(){return"link"}static clone(e){return new As(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,n={},r){super(r);let{target:i=null,rel:o=null,title:l=null}=n;this.__url=e,this.__target=i,this.__rel=o,this.__title=l}createDOM(e){let n=document.createElement("a");return n.href=this.sanitizeUrl(this.__url),this.__target!==null&&(n.target=this.__target),this.__rel!==null&&(n.rel=this.__rel),this.__title!==null&&(n.title=this.__title),vC.addClassNamesToElement(n,e.theme.link),n}updateDOM(e,n){let r=this.__url,i=this.__target,o=this.__rel,l=this.__title;return r!==e.__url&&(n.href=r),i!==e.__target&&(i?n.target=i:n.removeAttribute("target")),o!==e.__rel&&(o?n.rel=o:n.removeAttribute("rel")),l!==e.__title&&(l?n.title=l:n.removeAttribute("title")),!1}static importDOM(){return{a:()=>({conversion:oA,priority:1})}}static importJSON(e){let n=cu(e.url,{rel:e.rel,target:e.target,title:e.title});return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}sanitizeUrl(e){try{let n=new URL(e);if(!iA.has(n.protocol))return"about:blank"}catch{}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){this.getWritable().__title=e}insertNewAfter(e,n=!0){return e=this.getParentOrThrow().insertNewAfter(e,n),Ur.$isElementNode(e)?(n=cu(this.__url,{rel:this.__rel,target:this.__target,title:this.__title}),e.append(n),n):null}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,n){if(!Ur.$isRangeSelection(n))return!1;e=n.anchor.getNode();let r=n.focus.getNode();return this.isParentOf(e)&&this.isParentOf(r)&&0<n.getTextContent().length}}function oA(t){let e=null;if(vC.isHTMLAnchorElement(t)){let n=t.textContent;n!==null&&n!==""&&(e=cu(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target"),title:t.getAttribute("title")}))}return{node:e}}function cu(t,e){return Ur.$applyNodeReplacement(new As(t,e))}function bo(t){return t instanceof As}class Fu extends As{static getType(){return"autolink"}static clone(e){return new Fu(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}static importJSON(e){let n=Pg(e.url,{rel:e.rel,target:e.target,title:e.title});return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),type:"autolink",version:1}}insertNewAfter(e,n=!0){return e=this.getParentOrThrow().insertNewAfter(e,n),Ur.$isElementNode(e)?(n=Pg(this.__url,{rel:this._rel,target:this.__target,title:this.__title}),e.append(n),n):null}}function Pg(t,e){return Ur.$applyNodeReplacement(new Fu(t,e))}let lA=Ur.createCommand("TOGGLE_LINK_COMMAND");function sA(t,e){for(;t!==null&&(t=t.getParent())!==null&&!e(t););return t}Ei.$createAutoLinkNode=Pg;Ei.$createLinkNode=cu;Ei.$isAutoLinkNode=function(t){return t instanceof Fu};Ei.$isLinkNode=bo;Ei.AutoLinkNode=Fu;Ei.LinkNode=As;Ei.TOGGLE_LINK_COMMAND=lA;Ei.toggleLink=function(t,e={}){let{target:n,title:r}=e,i=e.rel===void 0?"noreferrer":e.rel;if(e=Ur.$getSelection(),Ur.$isRangeSelection(e))if(e=e.extract(),t===null)e.forEach(l=>{if(l=l.getParent(),bo(l)){let s=l.getChildren();for(let a=0;a<s.length;a++)l.insertBefore(s[a]);l.remove()}});else{if(e.length===1){var o=e[0];if(o=bo(o)?o:sA(o,bo),o!==null){o.setURL(t),n!==void 0&&o.setTarget(n),i!==null&&o.setRel(i),r!==void 0&&o.setTitle(r);return}}let l=null,s=null;e.forEach(a=>{var u=a.getParent();if(u!==s&&u!==null&&(!Ur.$isElementNode(a)||a.isInline()))if(bo(u))s=u,u.setURL(t),n!==void 0&&u.setTarget(n),i!==null&&s.setRel(i),r!==void 0&&s.setTitle(r);else if(u.is(l)||(l=u,s=cu(t,{rel:i,target:n}),bo(u)?a.getPreviousSibling()===null?u.insertBefore(s):u.insertAfter(s):a.insertBefore(s)),bo(a)){if(!a.is(s)){if(s!==null){u=a.getChildren();for(let c=0;c<u.length;c++)s.append(u[c])}a.remove()}}else s!==null&&s.append(a)})}};const aA=Ei;var fs=aA,xl=fs,uA=Tr,cA=Ft,_l=_e,dA=p;mC.LinkPlugin=function({validateUrl:t}){let[e]=uA.useLexicalComposerContext();return dA.useEffect(()=>{if(!e.hasNodes([xl.LinkNode]))throw Error("LinkPlugin: LinkNode not registered on editor");return cA.mergeRegister(e.registerCommand(xl.TOGGLE_LINK_COMMAND,n=>{if(n===null)return xl.toggleLink(n),!0;if(typeof n=="string")return t===void 0||t(n)?(xl.toggleLink(n),!0):!1;let{url:r,target:i,rel:o,title:l}=n;return xl.toggleLink(r,{rel:o,target:i,title:l}),!0},_l.COMMAND_PRIORITY_LOW),t!==void 0?e.registerCommand(_l.PASTE_COMMAND,n=>{let r=_l.$getSelection();if(!_l.$isRangeSelection(r)||r.isCollapsed()||!(n instanceof ClipboardEvent)||n.clipboardData==null)return!1;let i=n.clipboardData.getData("text");return t(i)?r.getNodes().some(o=>_l.$isElementNode(o))?!1:(e.dispatchCommand(xl.TOGGLE_LINK_COMMAND,i),n.preventDefault(),!0):!1},_l.COMMAND_PRIORITY_LOW):()=>{})},[e,t]),null};const fA=mC;var hA=fA;function pA({ariaActiveDescendant:t,ariaAutoComplete:e,ariaControls:n,ariaDescribedBy:r,ariaExpanded:i,ariaLabel:o,ariaLabelledBy:l,ariaMultiline:s,ariaOwns:a,ariaRequired:u,autoCapitalize:c,className:d,id:f,role:h="textbox",spellCheck:m=!0,style:g,tabIndex:w,"data-testid":v,...y}){const[x]=Tr.useLexicalComposerContext(),[S,b]=p.useState(!1),T=p.useCallback($=>{var L;x.setRootElement($);const O=(L=document.getElementById("val-ui"))==null?void 0:L.shadowRoot;if(O&&"getSelection"in O){x._window=O;return}},[x]);return p.useLayoutEffect(()=>(b(x.isEditable()),x.registerEditableListener($=>{b($)})),[x]),_.jsx("div",{...y,"aria-activedescendant":S?t:void 0,"aria-autocomplete":S?e:"none","aria-controls":S?n:void 0,"aria-describedby":r,"aria-expanded":S&&h==="combobox"?!!i:void 0,"aria-label":o,"aria-labelledby":l,"aria-multiline":s,"aria-owns":S?a:void 0,"aria-readonly":S?void 0:!0,"aria-required":u,autoCapitalize:c,className:d,contentEditable:S,"data-testid":v,id:f,ref:T,role:h,spellCheck:m,style:g,tabIndex:w})}function gA({className:t}){return _.jsx(pA,{className:t})}class Bu extends _e.DecoratorNode{constructor(e,n){super(n),this.__src=e.src,this.__altText=e.altText,this.__width=e.width,this.__height=e.height}static getType(){return"image"}static clone(e){return new Bu({src:e.__src,altText:e.__altText,width:e.__width,height:e.__height})}exportJSON(){return{altText:this.__altText,height:this.__width,src:this.__src,type:"image",version:1,width:this.__width}}static importJSON(e){return yC(e)}createDOM(){return document.createElement("div")}updateDOM(){return!1}decorate(){return _.jsx(mA,{src:this.__src,altText:this.__altText,empty:this.__empty,height:this.__height,nodeKey:this.getKey()})}}function mA(t){return _.jsx("img",{src:t.src})}function yC(t){return new Bu(t)}function vA(){const[t]=Tr.useLexicalComposerContext();return p.useEffect(()=>{t.focus()},[t]),null}const xC=_e.createCommand("INSERT_IMAGE_COMMAND");function yA(){const[t]=Tr.useLexicalComposerContext();return p.useEffect(()=>{if(!t.hasNodes([Bu]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return Ft.mergeRegister(t.registerCommand(xC,e=>{const n=yC(e);return _e.$insertNodes([n]),_e.$isRootOrShadowRoot(n.getParentOrThrow())&&Ft.$wrapNodeInElement(n,_e.$createParagraphNode).selectEnd(),!0},_e.COMMAND_PRIORITY_EDITOR))},[t]),null}const xA=({className:t})=>_.jsxs("svg",{height:12,width:12,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[_.jsx("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),_.jsx("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]}),_A=xA,wA=({className:t})=>_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,width:12,height:12,children:[_.jsx("line",{x1:"19",y1:"4",x2:"10",y2:"4"}),_.jsx("line",{x1:"14",y1:"20",x2:"5",y2:"20"}),_.jsx("line",{x1:"15",y1:"4",x2:"9",y2:"20"})]}),SA=wA,EA=({className:t})=>_.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1",className:t,width:12,height:12,children:_.jsx("path",{fillRule:"evenodd",d:"M13,15 L13,21 C13,21.5522847 12.5522847,22 12,22 C11.4477153,22 11,21.5522847 11,21 L11,15 L13,15 Z M3,13 C2.44771525,13 2,12.5522847 2,12 C2,11.4477153 2.44771525,11 3,11 L21,11 C21.5522847,11 22,11.4477153 22,12 C22,12.5522847 21.5522847,13 21,13 L3,13 Z M19,2 C19.5522847,2 20,2.44771525 20,3 C20,3.55228475 19.5522847,4 19,4 L13,4 L13,9 L11,9 L11,4 L5,4 C4.44771525,4 4,3.55228475 4,3 C4,2.44771525 4.44771525,2 5,2 L19,2 Z"})}),CA=EA,kA=({variant:t="primary",onClick:e,children:n,icon:r,disabled:i=!1})=>_.jsx("button",{disabled:i,className:_f("font-sans font-[12px] tracking-[0.04em] py-1 px-2 rounded whitespace-nowrap group relative text-primary",{"font-bold":t==="primary","bg-background hover:bg-background text-fill disabled:bg-fill disabled:text-background":t==="primary","bg-transparent border border-primary text-primary hover:border-highlight hover:text-highlight disabled:bg-fill disabled:text-background":t!=="primary"}),onClick:e,children:_.jsxs("span",{className:"flex flex-row items-center justify-center gap-2",children:[r&&r,n]})}),$o=kA,bA=({className:t})=>_.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 12 12",xmlns:"http://www.w3.org/2000/svg",className:t,children:[_.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.70733 1.00015L8.7784 6.07121L8.07129 6.77832L3.00022 1.70725L3.70733 1.00015Z",fill:"currentColor"}),_.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.00015 10.4709L8.07121 5.39983L8.77832 6.10693L3.70725 11.178L3.00015 10.4709Z",fill:"currentColor"})]}),$A=bA,_C=re.createContext({get api(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get session(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get theme(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setTheme(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get editMode(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setEditMode(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get highlight(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setHighlight(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get setWindowSize(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")},get windowSize(){throw Error("ValOverlayContext not found. Ensure components are wrapped by ValOverlayProvider!")}});function Lv(){return re.useContext(_C)}const TA=({options:t,onChange:e,label:n,icon:r})=>{const[i,o]=p.useState(!1),l=p.useRef(null),[s,a]=p.useState(0),{windowSize:u}=Lv(),c=()=>{o(!i)},d=(f,h)=>{a(h),e(f),o(!1)};return p.useEffect(()=>{const f=h=>{i&&l.current&&!l.current.contains(h.target)&&o(!1)};return document.addEventListener("click",f),()=>{document.removeEventListener("click",f)}},[]),_.jsx("div",{className:"text-[12px]",ref:l,children:_.jsx($o,{onClick:f=>{f.preventDefault(),c()},icon:_.jsx($A,{className:`rotate-[-90deg] transition-transform duration-150 ease-in-out ${i?"":"rotate-[90deg]"}`}),children:_.jsxs("div",{className:"relative",children:[_.jsxs("span",{className:"flex flex-row items-center justify-center gap-1",children:[n,r&&r]}),i&&_.jsx("div",{className:"absolute -top-[4px] overflow-scroll shadow-lg -left-2 text-primary bg-border w-fit z-overlay",style:{maxHeight:u==null?void 0:u.innerHeight},children:_.jsx("div",{className:"flex flex-col ",children:t==null?void 0:t.map((f,h)=>_.jsx("button",{onClick:m=>{m.preventDefault(),d(f,h)},className:`text-left px-2 py-1 hover:bg-background hover:text-highlight ${h===s&&"font-bold bg-background hover:bg-background truncate"}`,children:f},f))})})]})})})},NA=TA,RA=new TextEncoder;function wC(t){return new Promise((e,n)=>{var o;const r=(o=t.currentTarget.files)==null?void 0:o[0],i=new FileReader;i.addEventListener("load",()=>{const l=i.result;if(typeof l=="string"){const s=new Image;s.addEventListener("load",async()=>{const a=await jn.getSHA256Hash(RA.encode(l));if(s.naturalWidth&&s.naturalHeight){const u=nv(l);e({src:l,width:s.naturalWidth,height:s.naturalHeight,filename:r==null?void 0:r.name,sha256:a,mimeType:u,fileExt:u&&rv(u)})}else e({src:l,filename:r==null?void 0:r.name,sha256:a})}),s.src=l}else n(l?{message:"Unexpected image result type",result:l}:{message:"Empty result"})}),r&&i.readAsDataURL(r)})}function SC(t){const e=t.anchor,n=t.focus,r=t.anchor.getNode(),i=t.focus.getNode();return r===i?r:t.isBackward()?lo.$isAtNodeEnd(n)?r:i:lo.$isAtNodeEnd(e)?r:i}function OA(){const[t]=Tr.useLexicalComposerContext();return p.useEffect(()=>Ft.mergeRegister(t.registerCommand(_e.CLICK_COMMAND,e=>{const n=_e.$getSelection();if(_e.$isRangeSelection(n)){const r=SC(n),i=Ft.$findMatchingParent(r,fs.$isLinkNode);if(fs.$isLinkNode(i)&&(e.metaKey||e.ctrlKey))return window.open(i.getURL(),"_blank"),!0}return!1},_e.COMMAND_PRIORITY_LOW)),[]),null}var EC={exports:{}},PA="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",AA=PA,MA=AA;function CC(){}function kC(){}kC.resetWarningCache=CC;var LA=function(){function t(r,i,o,l,s,a){if(a!==MA){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:kC,resetWarningCache:CC};return n.PropTypes=n,n};EC.exports=LA();var IA=EC.exports;const er=Tu(IA);function Ag(){return Ag=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ag.apply(this,arguments)}function DA(t,e){if(t==null)return{};var n=jA(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function jA(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var Iv=p.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,i=t.size,o=i===void 0?24:i,l=DA(t,["color","size"]);return re.createElement("svg",Ag({ref:e,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),re.createElement("polyline",{points:"20 6 9 17 4 12"}))});Iv.propTypes={color:er.string,size:er.oneOfType([er.string,er.number])};Iv.displayName="Check";const zA=Iv;function Mg(){return Mg=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Mg.apply(this,arguments)}function FA(t,e){if(t==null)return{};var n=BA(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function BA(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var Dv=p.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,i=t.size,o=i===void 0?24:i,l=FA(t,["color","size"]);return re.createElement("svg",Mg({ref:e,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),re.createElement("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),re.createElement("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}))});Dv.propTypes={color:er.string,size:er.oneOfType([er.string,er.number])};Dv.displayName="Link";const UA=Dv;function Lg(){return Lg=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Lg.apply(this,arguments)}function WA(t,e){if(t==null)return{};var n=VA(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function VA(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var jv=p.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,i=t.size,o=i===void 0?24:i,l=WA(t,["color","size"]);return re.createElement("svg",Lg({ref:e,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),re.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),re.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))});jv.propTypes={color:er.string,size:er.oneOfType([er.string,er.number])};jv.displayName="X";const HA=jv,KA=({fontSizes:t,fontsFamilies:e,onEditor:n,colors:r})=>{const[i]=Tr.useLexicalComposerContext();p.useEffect(()=>{n&&n(i)},[i]);const[o,l]=p.useState(i),[s,a]=p.useState(null),[u,c]=p.useState(!1),[d,f]=p.useState(!1),[h,m]=p.useState(!1),[g,w]=p.useState(!1);p.useState("15px"),p.useState("#000"),p.useState("Sans");const[v,y]=p.useState("paragraph");p.useState(!1),p.useState(!1),p.useState("url"),p.useState(null);const[x,S]=p.useState(null),b=P=>{i.dispatchCommand(fs.TOGGLE_LINK_COMMAND,P)},T={paragraph:"Normal",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",number:"Numbered List",bullet:"Bulleted List"},$={};for(const P in T)$[T[P]]=P;const O=p.useCallback(()=>{const P=_e.$getSelection();if(_e.$isRangeSelection(P)){const D=P.anchor.getNode();let B=D.getKey()==="root"?D:Ft.$findMatchingParent(D,k=>{const E=k.getParent();return E!==null&&_e.$isRootOrShadowRoot(E)});B===null&&(B=D.getTopLevelElementOrThrow());const oe=SC(P),H=Ft.$findMatchingParent(oe,fs.$isLinkNode);if(H!==null){const k=H.getURL();S(k)}else S(null);const Z=B.getKey(),C=o.getElementByKey(Z);if(c(P.hasFormat("bold")),f(P.hasFormat("italic")),m(P.hasFormat("strikethrough")),w(P.hasFormat("underline")),C!==null)if(a(Z),ji.$isListNode(B)){const k=Ft.$getNearestNodeOfType(D,ji.ListNode),E=k?k.getListType():B.getListType();y(E)}else{const k=Pa.$isHeadingNode(B)?B.getTag():B.getType();k in T&&y(k)}}},[o]);p.useEffect(()=>Ft.mergeRegister(i.registerUpdateListener(({editorState:P})=>{P.read(()=>{O()})})),[O,o,i]),p.useEffect(()=>i.registerCommand(_e.SELECTION_CHANGE_COMMAND,(P,D)=>(O(),l(D),!1),_e.COMMAND_PRIORITY_CRITICAL),[i,O]);const L=P=>{["h1","h2","h3","h4","h5","h6"].includes(P)?v!==P&&i.update(()=>{const D=_e.$getSelection();_e.$isRangeSelection(D)&&lo.$setBlocksType(D,()=>Pa.$createHeadingNode(P))}):P==="paragraph"&&v!=="paragraph"?i.update(()=>{const D=_e.$getSelection();(_e.$isRangeSelection(D)||_e.DEPRECATED_$isGridSelection(D))&&lo.$setBlocksType(D,()=>_e.$createParagraphNode())}):P==="number"&&v!=="number"?i.dispatchCommand(ji.INSERT_ORDERED_LIST_COMMAND,void 0):P==="bullet"&&v!=="bullet"?i.dispatchCommand(ji.INSERT_UNORDERED_LIST_COMMAND,void 0):i.dispatchCommand(ji.REMOVE_LIST_COMMAND,void 0)};return p.useCallback(()=>{i.update(()=>{const P=_e.$getSelection();if(_e.$isRangeSelection(P)){const D=P.anchor,B=P.focus,oe=P.getNodes();if(D.key===B.key&&D.offset===B.offset)return;oe.forEach((H,Z)=>{_e.$isTextNode(H)?(Z===0&&D.offset!==0&&(H=H.splitText(D.offset)[1]||H),Z===oe.length-1&&(H=H.splitText(B.offset)[0]||H),H.__style!==""&&H.setStyle(""),H.__format!==0&&(H.setFormat(0),Ft.$getNearestBlockElementAncestorOrThrow(H).setFormat(""))):Pa.$isHeadingNode(H)&&H.replace(_e.$createParagraphNode(),!0)})}})},[o]),_.jsxs("div",{className:"sticky top-0 border-b bg-background border-highlight flex flex-col",children:[_.jsxs("div",{className:"flex flex-row gap-1",children:[_.jsx(NA,{options:Object.values(T),label:T[v]??v+" (not supported)",onChange:P=>{L($[P])}}),_.jsx($o,{variant:"primary",onClick:P=>{P.preventDefault(),i.dispatchCommand(_e.FORMAT_TEXT_COMMAND,"bold")},active:u,icon:_.jsx(_A,{className:`${u&&"stroke-[3px]"}`})}),_.jsx($o,{active:h,onClick:P=>{P.preventDefault(),i.dispatchCommand(_e.FORMAT_TEXT_COMMAND,"strikethrough")},icon:_.jsx(CA,{className:`${h&&"stroke-[2px]"}`})}),_.jsx($o,{active:d,onClick:P=>{P.preventDefault(),i.dispatchCommand(_e.FORMAT_TEXT_COMMAND,"italic")},icon:_.jsx(SA,{className:`${d&&"stroke-[3px]"}`})}),_.jsx($o,{active:x!==null,onClick:P=>{P.preventDefault(),S(""),b("")},icon:_.jsx(UA,{width:12,height:12,className:`${x!==null&&"stroke-[3px]"}`})}),_.jsxs("label",{className:"flex items-center justify-center cursor-pointer",children:[_.jsx(mS,{}),_.jsx("input",{type:"file",hidden:!0,onChange:P=>{P.preventDefault(),wC(P).then(D=>{i.dispatchCommand(xC,{...D})}).catch(D=>{console.error("Error reading image",D)})}})]})]}),x!==null&&_.jsxs("div",{className:"flex flex-row p-2",children:[_.jsx("input",{type:"text",placeholder:"Enter URL",className:"w-1/3 text-primary bg-background px-2",value:x,onChange:P=>{P.preventDefault(),S(P.target.value)}}),_.jsx($o,{variant:"primary",onClick:P=>{P.preventDefault(),b(x||null)},icon:_.jsx(zA,{size:14})}),_.jsx($o,{variant:"primary",onClick:P=>{P.preventDefault(),b(null)},icon:_.jsx(HA,{size:14})})]})]})},ZA=KA;function GA(t){console.error(t)}const YA=28,XA=({richtext:t,onEditor:e})=>{const{windowSize:n}=Lv(),i={namespace:"val",editorState:o=>{o.setEditorState(o.parseEditorState({root:zR($S(t))}))},nodes:[Pa.HeadingNode,Bu,ji.ListNode,ji.ListItemNode,fs.LinkNode],theme:{text:{bold:"font-semibold",underline:"underline",italic:"italic",strikethrough:"line-through",underlineStrikethrough:"underline line-through"},list:{listitem:"ml-[20px]",ol:"list-decimal",ul:"list-disc"},heading:{h1:"text-4xl font-bold",h2:"text-3xl font-bold",h3:"text-2xl font-bold",h4:"text-xl font-bold",h5:"text-lg font-bold",h6:"text-md font-bold"},link:"text-highlight underline"},onError:GA};return _.jsxs(JO.LexicalComposer,{initialConfig:i,children:[_.jsx(vA,{}),_.jsx(ZA,{onEditor:e}),_.jsx(JP.RichTextPlugin,{contentEditable:_.jsx("div",{className:"font-sans border-b text-primary border-highlight",style:{minHeight:n!=null&&n.innerHeight?(n==null?void 0:n.innerHeight)-YA:void 0},children:_.jsx(gA,{className:"p-4 outline-none bg-fill"})}),placeholder:_.jsx("div",{className:"",children:"Enter some text..."}),ErrorBoundary:oP}),_.jsx(hA.LinkPlugin,{}),_.jsx(OA,{}),_.jsx(rA.ListPlugin,{}),_.jsx(yA,{}),_.jsx(pP.HistoryPlugin,{})]})};var QA={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const JA=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Kn=(t,e)=>{const n=p.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:o=2,absoluteStrokeWidth:l,children:s,...a},u)=>p.createElement("svg",{ref:u,...QA,width:i,height:i,stroke:r,strokeWidth:l?Number(o)*24/Number(i):o,className:`lucide lucide-${JA(t)}`,...a},[...e.map(([c,d])=>p.createElement(c,d)),...(Array.isArray(s)?s:[s])||[]]));return n.displayName=`${t}`,n},qA=Kn("Check",[["polyline",{points:"20 6 9 17 4 12",key:"10jjfj"}]]),bC=Kn("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),e5=Kn("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),kx=Kn("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]),t5=Kn("Maximize",[["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"}]]),n5=Kn("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]),r5=Kn("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),i5=Kn("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]),o5=Kn("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]),l5=Kn("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),s5=Kn("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]),a5=Kn("Sun",[["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"}]]),u5=Kn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),zv="p-1 border rounded-full shadow border-accent",bx="valbuild:urlBeforeNavigation";function c5({api:t,patches:e,onCommit:n}){const{theme:r,setTheme:i,editMode:o,setEditMode:l,session:s}=Lv();if(s.status==="success"&&s.data.mode==="unauthorized")return _.jsxs($x,{href:t.getLoginUrl(window.location.href),children:[_.jsx("span",{children:"Login"}),_.jsx(kx,{size:18})]});if(s.status==="success"&&!s.data.enabled)return _.jsxs($x,{href:t.getEnableUrl(window.location.href),children:[_.jsx("span",{children:"Enable"}),_.jsx(kx,{size:18})]});const[a,u]=p.useState();return p.useEffect(()=>{let c=0;for(const d in e)c+=e[d].length;u(c)},[e]),_.jsxs(d5,{children:[_.jsx(wc,{active:o==="hover",onClick:()=>{l(c=>c==="hover"?"off":"hover")},children:_.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:o==="hover"?_.jsx(i5,{size:18}):_.jsx(o5,{size:18})})}),_.jsx(wc,{onClick:()=>{i(r==="dark"?"light":"dark")},children:_.jsxs("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:[r==="dark"&&_.jsx(a5,{size:15}),r==="light"&&_.jsx(r5,{size:15})]})}),_.jsx(wc,{active:o==="full",onClick:()=>{if(o!=="full")localStorage.setItem(bx,window.location.href),window.location.href=t.getEditUrl();else if(o==="full"){const c=localStorage.getItem(bx);window.location.href=c||"/"}},children:_.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:o==="full"?_.jsx(n5,{size:15}):_.jsx(t5,{size:15})})}),a!==void 0&&s.status==="success"&&s.data.mode==="proxy"&&_.jsx(wc,{onClick:()=>{a>0?t.postCommit({patches:e}).then(c=>{Lo.isErr(c)?(console.error(c.error),alert("Could not commit patches: "+c.error.message)):(console.log("Committed patches: ",c.value),n())}):alert("No patches to commit")},children:_.jsxs("div",{className:"relative h-[24px] w-[24px] flex justify-center items-center",children:[_.jsx("div",{className:"absolute -right-[10px] -top-[10px] border border-border rounded-full px-1 font-sans text-xs bg-card text-accent",children:a}),_.jsx(s5,{size:18})]})}),_.jsx("a",{className:zv,href:t.getDisableUrl(window.location.href),children:_.jsx("div",{className:"h-[24px] w-[24px] flex justify-center items-center",children:_.jsx(l5,{size:18})})})]})}function $x({href:t,children:e}){return _.jsx("div",{className:"flex flex-row items-center justify-center w-full h-full font-sans border-2 rounded-full gap-x-3 text-primary bg-background border-fill",children:_.jsx("a",{className:zv,href:t,children:_.jsx("div",{className:"flex items-center justify-center px-2 gap-x-2",children:e})})})}function d5({children:t}){return _.jsx("div",{className:"flex flex-row items-center justify-center w-full h-full px-2 py-2 font-sans border-2 rounded-full gap-x-3 text-primary bg-background border-fill",children:t})}function wc({active:t,onClick:e,children:n}){return _.jsx("button",{className:_f(zv,{"bg-accent drop-shadow-[0px_0px_12px_rgba(56,205,152,0.60)]":t}),onClick:e,children:n})}function f5(t,e){const[n,r]=p.useState({}),[i,o]=p.useState(0);return p.useEffect(()=>{t.status==="success"&&t.data.mode==="proxy"&&e.getPatches({}).then(l=>{if(Lo.isOk(l)){const s={};for(const a in l.value)s[a]=l.value[a].map(u=>u.patch_id);r(s)}else console.error("Could not load patches",l.error)})},[t,i]),{patches:n,setPatchResetId:o}}function h5(t="dark"){const[e,n]=p.useState(t);return p.useEffect(()=>{localStorage.getItem("val-theme")==="light"?n("light"):localStorage.getItem("val-theme")==="dark"||window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?n("dark"):window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches&&n("light");const r=i=>{localStorage.getItem("val-theme")||n(i.matches?"dark":"light")};return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",r),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",r)}},[]),[e,r=>{localStorage.setItem("val-theme",r),n(r)}]}var De;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const o={};for(const l of i)o[l]=l;return o},t.getValidEnumValues=i=>{const o=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),l={};for(const s of o)l[s]=i[s];return t.objectValues(l)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const l in i)Object.prototype.hasOwnProperty.call(i,l)&&o.push(l);return o},t.find=(i,o)=>{for(const l of i)if(o(l))return l},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(l=>typeof l=="string"?`'${l}'`:l).join(o)}t.joinValues=r,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(De||(De={}));var Ig;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Ig||(Ig={}));const q=De.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zi=t=>{switch(typeof t){case"undefined":return q.undefined;case"string":return q.string;case"number":return isNaN(t)?q.nan:q.number;case"boolean":return q.boolean;case"function":return q.function;case"bigint":return q.bigint;case"symbol":return q.symbol;case"object":return Array.isArray(t)?q.array:t===null?q.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?q.promise:typeof Map<"u"&&t instanceof Map?q.map:typeof Set<"u"&&t instanceof Set?q.set:typeof Date<"u"&&t instanceof Date?q.date:q.object;default:return q.unknown}},V=De.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"]),p5=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class wr extends Error{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}get errors(){return this.issues}format(e){const n=e||function(o){return o.message},r={_errors:[]},i=o=>{for(const l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)r._errors.push(n(l));else{let s=r,a=0;for(;a<l.path.length;){const u=l.path[a];a===l.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(n(l))):s[u]=s[u]||{_errors:[]},s=s[u],a++}}};return i(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,De.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}wr.create=t=>new wr(t);const du=(t,e)=>{let n;switch(t.code){case V.invalid_type:t.received===q.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case V.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,De.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${De.joinValues(t.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${De.joinValues(t.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${De.joinValues(t.options)}, received '${t.received}'`;break;case V.invalid_arguments:n="Invalid function arguments";break;case V.invalid_return_type:n="Invalid function return type";break;case V.invalid_date:n="Invalid date";break;case V.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}"`:De.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case V.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==="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 V.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 V.custom:n="Invalid input";break;case V.invalid_intersection_types:n="Intersection results could not be merged";break;case V.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case V.not_finite:n="Number must be finite";break;default:n=e.defaultError,De.assertNever(t)}return{message:n}};let $C=du;function g5(t){$C=t}function Fd(){return $C}const Bd=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,o=[...n,...i.path||[]],l={...i,path:o};let s="";const a=r.filter(u=>!!u).slice().reverse();for(const u of a)s=u(l,{data:e,defaultError:s}).message;return{...i,path:o,message:i.message||s}},m5=[];function te(t,e){const n=Bd({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Fd(),du].filter(r=>!!r)});t.common.issues.push(n)}class on{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 i of n){if(i.status==="aborted")return ye;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n)r.push({key:await i.key,value:await i.value});return on.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:o,value:l}=i;if(o.status==="aborted"||l.status==="aborted")return ye;o.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||i.alwaysSet)&&(r[o.value]=l.value)}return{status:e.value,value:r}}}const ye=Object.freeze({status:"aborted"}),TC=t=>({status:"dirty",value:t}),yn=t=>({status:"valid",value:t}),Dg=t=>t.status==="aborted",jg=t=>t.status==="dirty",fu=t=>t.status==="valid",Ud=t=>typeof Promise<"u"&&t instanceof Promise;var fe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(fe||(fe={}));class Hr{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Tx=(t,e)=>{if(fu(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 wr(t.common.issues);return this._error=n,this._error}}};function xe(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=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:i}:{errorMap:(l,s)=>l.code!=="invalid_type"?{message:s.defaultError}:typeof s.data>"u"?{message:r??s.defaultError}:{message:n??s.defaultError},description:i}}class Ce{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)}get description(){return this._def.description}_getType(e){return zi(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:zi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new on,ctx:{common:e.parent.common,data:e.data,parsedType:zi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Ud(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){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zi(e)},o=this._parseSync({data:e,path:i.path,parent:i});return Tx(i,o)}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:zi(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(Ud(i)?i:Promise.resolve(i));return Tx(r,o)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const l=e(i),s=()=>o.addIssue({code:V.custom,...r(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(a=>a?!0:(s(),!1)):l?!0:(s(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new kr({schema:this,typeName:he.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ci.create(this,this._def)}nullable(){return Qo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Sr.create(this,this._def)}promise(){return ps.create(this,this._def)}or(e){return mu.create([this,e],this._def)}and(e){return vu.create(this,e,this._def)}transform(e){return new kr({...xe(this._def),schema:this,typeName:he.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Su({...xe(this._def),innerType:this,defaultValue:n,typeName:he.ZodDefault})}brand(){return new RC({typeName:he.ZodBranded,type:this,...xe(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Kd({...xe(this._def),innerType:this,catchValue:n,typeName:he.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Uu.create(this,e)}readonly(){return Gd.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const v5=/^c[^\s-]{8,}$/i,y5=/^[a-z][a-z0-9]*$/,x5=/^[0-9A-HJKMNP-TV-Z]{26}$/,_5=/^[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,w5=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,S5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let zh;const E5=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,C5=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,k5=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function b5(t,e){return!!((e==="v4"||!e)&&E5.test(t)||(e==="v6"||!e)&&C5.test(t))}class yr extends Ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){const o=this._getOrReturnCtx(e);return te(o,{code:V.invalid_type,expected:q.string,received:o.parsedType}),ye}const r=new on;let i;for(const o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),te(i,{code:V.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),te(i,{code:V.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const l=e.data.length>o.value,s=e.data.length<o.value;(l||s)&&(i=this._getOrReturnCtx(e,i),l?te(i,{code:V.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):s&&te(i,{code:V.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")w5.test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"email",code:V.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")zh||(zh=new RegExp(S5,"u")),zh.test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"emoji",code:V.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")_5.test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"uuid",code:V.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")v5.test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"cuid",code:V.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")y5.test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"cuid2",code:V.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")x5.test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"ulid",code:V.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),te(i,{validation:"url",code:V.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"regex",code:V.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),te(i,{code:V.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),te(i,{code:V.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),te(i,{code:V.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?k5(o).test(e.data)||(i=this._getOrReturnCtx(e,i),te(i,{code:V.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="ip"?b5(e.data,o.version)||(i=this._getOrReturnCtx(e,i),te(i,{validation:"ip",code:V.invalid_string,message:o.message}),r.dirty()):De.assertNever(o);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:V.invalid_string,...fe.errToObj(r)})}_addCheck(e){return new yr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...fe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...fe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...fe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...fe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...fe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...fe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...fe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...fe.errToObj(e)})}datetime(e){var n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,...fe.errToObj(e==null?void 0:e.message)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...fe.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...fe.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...fe.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...fe.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...fe.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...fe.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...fe.errToObj(n)})}nonempty(e){return this.min(1,fe.errToObj(e))}trim(){return new yr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new yr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new yr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}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 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 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}}yr.create=t=>{var e;return new yr({checks:[],typeName:he.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...xe(t)})};function $5(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(t.toFixed(i).replace(".","")),l=parseInt(e.toFixed(i).replace(".",""));return o%l/Math.pow(10,i)}class ao extends Ce{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)!==q.number){const o=this._getOrReturnCtx(e);return te(o,{code:V.invalid_type,expected:q.number,received:o.parsedType}),ye}let r;const i=new on;for(const o of this._def.checks)o.kind==="int"?De.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:V.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?$5(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:V.not_finite,message:o.message}),i.dirty()):De.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,fe.toString(n))}gt(e,n){return this.setLimit("min",e,!1,fe.toString(n))}lte(e,n){return this.setLimit("max",e,!0,fe.toString(n))}lt(e,n){return this.setLimit("max",e,!1,fe.toString(n))}setLimit(e,n,r,i){return new ao({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:fe.toString(i)}]})}_addCheck(e){return new ao({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:fe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:fe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:fe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:fe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:fe.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:fe.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:fe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:fe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:fe.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"&&De.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)}}ao.create=t=>new ao({checks:[],typeName:he.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...xe(t)});class uo extends Ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==q.bigint){const o=this._getOrReturnCtx(e);return te(o,{code:V.invalid_type,expected:q.bigint,received:o.parsedType}),ye}let r;const i=new on;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):De.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,fe.toString(n))}gt(e,n){return this.setLimit("min",e,!1,fe.toString(n))}lte(e,n){return this.setLimit("max",e,!0,fe.toString(n))}lt(e,n){return this.setLimit("max",e,!1,fe.toString(n))}setLimit(e,n,r,i){return new uo({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:fe.toString(i)}]})}_addCheck(e){return new uo({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:fe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:fe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:fe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:fe.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:fe.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}}uo.create=t=>{var e;return new uo({checks:[],typeName:he.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...xe(t)})};class hu extends Ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){const r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:q.boolean,received:r.parsedType}),ye}return yn(e.data)}}hu.create=t=>new hu({typeName:he.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...xe(t)});class Yo extends Ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){const o=this._getOrReturnCtx(e);return te(o,{code:V.invalid_type,expected:q.date,received:o.parsedType}),ye}if(isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return te(o,{code:V.invalid_date}),ye}const r=new on;let i;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),te(i,{code:V.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),te(i,{code:V.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):De.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Yo({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:fe.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:fe.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}}Yo.create=t=>new Yo({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:he.ZodDate,...xe(t)});class Wd extends Ce{_parse(e){if(this._getType(e)!==q.symbol){const r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:q.symbol,received:r.parsedType}),ye}return yn(e.data)}}Wd.create=t=>new Wd({typeName:he.ZodSymbol,...xe(t)});class pu extends Ce{_parse(e){if(this._getType(e)!==q.undefined){const r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:q.undefined,received:r.parsedType}),ye}return yn(e.data)}}pu.create=t=>new pu({typeName:he.ZodUndefined,...xe(t)});class gu extends Ce{_parse(e){if(this._getType(e)!==q.null){const r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:q.null,received:r.parsedType}),ye}return yn(e.data)}}gu.create=t=>new gu({typeName:he.ZodNull,...xe(t)});class hs extends Ce{constructor(){super(...arguments),this._any=!0}_parse(e){return yn(e.data)}}hs.create=t=>new hs({typeName:he.ZodAny,...xe(t)});class zo extends Ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return yn(e.data)}}zo.create=t=>new zo({typeName:he.ZodUnknown,...xe(t)});class gi extends Ce{_parse(e){const n=this._getOrReturnCtx(e);return te(n,{code:V.invalid_type,expected:q.never,received:n.parsedType}),ye}}gi.create=t=>new gi({typeName:he.ZodNever,...xe(t)});class Vd extends Ce{_parse(e){if(this._getType(e)!==q.undefined){const r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:q.void,received:r.parsedType}),ye}return yn(e.data)}}Vd.create=t=>new Vd({typeName:he.ZodVoid,...xe(t)});class Sr extends Ce{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==q.array)return te(n,{code:V.invalid_type,expected:q.array,received:n.parsedType}),ye;if(i.exactLength!==null){const l=n.data.length>i.exactLength.value,s=n.data.length<i.exactLength.value;(l||s)&&(te(n,{code:l?V.too_big:V.too_small,minimum:s?i.exactLength.value:void 0,maximum:l?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(te(n,{code:V.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(te(n,{code:V.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((l,s)=>i.type._parseAsync(new Hr(n,l,n.path,s)))).then(l=>on.mergeArray(r,l));const o=[...n.data].map((l,s)=>i.type._parseSync(new Hr(n,l,n.path,s)));return on.mergeArray(r,o)}get element(){return this._def.type}min(e,n){return new Sr({...this._def,minLength:{value:e,message:fe.toString(n)}})}max(e,n){return new Sr({...this._def,maxLength:{value:e,message:fe.toString(n)}})}length(e,n){return new Sr({...this._def,exactLength:{value:e,message:fe.toString(n)}})}nonempty(e){return this.min(1,e)}}Sr.create=(t,e)=>new Sr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:he.ZodArray,...xe(e)});function kl(t){if(t instanceof ct){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=ci.create(kl(r))}return new ct({...t._def,shape:()=>e})}else return t instanceof Sr?new Sr({...t._def,type:kl(t.element)}):t instanceof ci?ci.create(kl(t.unwrap())):t instanceof Qo?Qo.create(kl(t.unwrap())):t instanceof Kr?Kr.create(t.items.map(e=>kl(e))):t}class ct extends Ce{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=De.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==q.object){const u=this._getOrReturnCtx(e);return te(u,{code:V.invalid_type,expected:q.object,received:u.parsedType}),ye}const{status:r,ctx:i}=this._processInputParams(e),{shape:o,keys:l}=this._getCached(),s=[];if(!(this._def.catchall instanceof gi&&this._def.unknownKeys==="strip"))for(const u in i.data)l.includes(u)||s.push(u);const a=[];for(const u of l){const c=o[u],d=i.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new Hr(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof gi){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of s)a.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")s.length>0&&(te(i,{code:V.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of s){const d=i.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new Hr(i,d,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of a){const d=await c.key;u.push({key:d,value:await c.value,alwaysSet:c.alwaysSet})}return u}).then(u=>on.mergeObjectSync(r,u)):on.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return fe.errToObj,new ct({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o,l,s;const a=(l=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&l!==void 0?l:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=fe.errToObj(e).message)!==null&&s!==void 0?s:a}:{message:a}}}:{}})}strip(){return new ct({...this._def,unknownKeys:"strip"})}passthrough(){return new ct({...this._def,unknownKeys:"passthrough"})}extend(e){return new ct({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ct({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:he.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new ct({...this._def,catchall:e})}pick(e){const n={};return De.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new ct({...this._def,shape:()=>n})}omit(e){const n={};return De.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new ct({...this._def,shape:()=>n})}deepPartial(){return kl(this)}partial(e){const n={};return De.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}),new ct({...this._def,shape:()=>n})}required(e){const n={};return De.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof ci;)o=o._def.innerType;n[r]=o}}),new ct({...this._def,shape:()=>n})}keyof(){return NC(De.objectKeys(this.shape))}}ct.create=(t,e)=>new ct({shape:()=>t,unknownKeys:"strip",catchall:gi.create(),typeName:he.ZodObject,...xe(e)});ct.strictCreate=(t,e)=>new ct({shape:()=>t,unknownKeys:"strict",catchall:gi.create(),typeName:he.ZodObject,...xe(e)});ct.lazycreate=(t,e)=>new ct({shape:t,unknownKeys:"strip",catchall:gi.create(),typeName:he.ZodObject,...xe(e)});class mu extends Ce{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(o){for(const s of o)if(s.result.status==="valid")return s.result;for(const s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const l=o.map(s=>new wr(s.ctx.common.issues));return te(n,{code:V.invalid_union,unionErrors:l}),ye}if(n.common.async)return Promise.all(r.map(async o=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(i);{let o;const l=[];for(const a of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=a._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&l.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const s=l.map(a=>new wr(a));return te(n,{code:V.invalid_union,unionErrors:s}),ye}}get options(){return this._def.options}}mu.create=(t,e)=>new mu({options:t,typeName:he.ZodUnion,...xe(e)});const Hc=t=>t instanceof xu?Hc(t.schema):t instanceof kr?Hc(t.innerType()):t instanceof _u?[t.value]:t instanceof co?t.options:t instanceof wu?Object.keys(t.enum):t instanceof Su?Hc(t._def.innerType):t instanceof pu?[void 0]:t instanceof gu?[null]:null;class If extends Ce{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==q.object)return te(n,{code:V.invalid_type,expected:q.object,received:n.parsedType}),ye;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(te(n,{code:V.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ye)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const i=new Map;for(const o of n){const l=Hc(o.shape[e]);if(!l)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of l){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,o)}}return new If({typeName:he.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...xe(r)})}}function zg(t,e){const n=zi(t),r=zi(e);if(t===e)return{valid:!0,data:t};if(n===q.object&&r===q.object){const i=De.objectKeys(e),o=De.objectKeys(t).filter(s=>i.indexOf(s)!==-1),l={...t,...e};for(const s of o){const a=zg(t[s],e[s]);if(!a.valid)return{valid:!1};l[s]=a.data}return{valid:!0,data:l}}else if(n===q.array&&r===q.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let o=0;o<t.length;o++){const l=t[o],s=e[o],a=zg(l,s);if(!a.valid)return{valid:!1};i.push(a.data)}return{valid:!0,data:i}}else return n===q.date&&r===q.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class vu extends Ce{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(o,l)=>{if(Dg(o)||Dg(l))return ye;const s=zg(o.value,l.value);return s.valid?((jg(o)||jg(l))&&n.dirty(),{status:n.value,value:s.data}):(te(r,{code:V.invalid_intersection_types}),ye)};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(([o,l])=>i(o,l)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}vu.create=(t,e,n)=>new vu({left:t,right:e,typeName:he.ZodIntersection,...xe(n)});class Kr extends Ce{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.array)return te(r,{code:V.invalid_type,expected:q.array,received:r.parsedType}),ye;if(r.data.length<this._def.items.length)return te(r,{code:V.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ye;!this._def.rest&&r.data.length>this._def.items.length&&(te(r,{code:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((l,s)=>{const a=this._def.items[s]||this._def.rest;return a?a._parse(new Hr(r,l,r.path,s)):null}).filter(l=>!!l);return r.common.async?Promise.all(o).then(l=>on.mergeArray(n,l)):on.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new Kr({...this._def,rest:e})}}Kr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Kr({items:t,typeName:he.ZodTuple,rest:null,...xe(e)})};class yu extends Ce{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!==q.object)return te(r,{code:V.invalid_type,expected:q.object,received:r.parsedType}),ye;const i=[],o=this._def.keyType,l=this._def.valueType;for(const s in r.data)i.push({key:o._parse(new Hr(r,s,r.path,s)),value:l._parse(new Hr(r,r.data[s],r.path,s))});return r.common.async?on.mergeObjectAsync(n,i):on.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Ce?new yu({keyType:e,valueType:n,typeName:he.ZodRecord,...xe(r)}):new yu({keyType:yr.create(),valueType:e,typeName:he.ZodRecord,...xe(n)})}}class Hd extends Ce{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!==q.map)return te(r,{code:V.invalid_type,expected:q.map,received:r.parsedType}),ye;const i=this._def.keyType,o=this._def.valueType,l=[...r.data.entries()].map(([s,a],u)=>({key:i._parse(new Hr(r,s,r.path,[u,"key"])),value:o._parse(new Hr(r,a,r.path,[u,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const a of l){const u=await a.key,c=await a.value;if(u.status==="aborted"||c.status==="aborted")return ye;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const a of l){const u=a.key,c=a.value;if(u.status==="aborted"||c.status==="aborted")return ye;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}}}}Hd.create=(t,e,n)=>new Hd({valueType:e,keyType:t,typeName:he.ZodMap,...xe(n)});class Xo extends Ce{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.set)return te(r,{code:V.invalid_type,expected:q.set,received:r.parsedType}),ye;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(te(r,{code:V.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(te(r,{code:V.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function l(a){const u=new Set;for(const c of a){if(c.status==="aborted")return ye;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const s=[...r.data.values()].map((a,u)=>o._parse(new Hr(r,a,r.path,u)));return r.common.async?Promise.all(s).then(a=>l(a)):l(s)}min(e,n){return new Xo({...this._def,minSize:{value:e,message:fe.toString(n)}})}max(e,n){return new Xo({...this._def,maxSize:{value:e,message:fe.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Xo.create=(t,e)=>new Xo({valueType:t,minSize:null,maxSize:null,typeName:he.ZodSet,...xe(e)});class Ql extends Ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==q.function)return te(n,{code:V.invalid_type,expected:q.function,received:n.parsedType}),ye;function r(s,a){return Bd({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Fd(),du].filter(u=>!!u),issueData:{code:V.invalid_arguments,argumentsError:a}})}function i(s,a){return Bd({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Fd(),du].filter(u=>!!u),issueData:{code:V.invalid_return_type,returnTypeError:a}})}const o={errorMap:n.common.contextualErrorMap},l=n.data;if(this._def.returns instanceof ps){const s=this;return yn(async function(...a){const u=new wr([]),c=await s._def.args.parseAsync(a,o).catch(h=>{throw u.addIssue(r(a,h)),u}),d=await Reflect.apply(l,this,c);return await s._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{const s=this;return yn(function(...a){const u=s._def.args.safeParse(a,o);if(!u.success)throw new wr([r(a,u.error)]);const c=Reflect.apply(l,this,u.data),d=s._def.returns.safeParse(c,o);if(!d.success)throw new wr([i(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ql({...this._def,args:Kr.create(e).rest(zo.create())})}returns(e){return new Ql({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new Ql({args:e||Kr.create([]).rest(zo.create()),returns:n||zo.create(),typeName:he.ZodFunction,...xe(r)})}}class xu extends Ce{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})}}xu.create=(t,e)=>new xu({getter:t,typeName:he.ZodLazy,...xe(e)});class _u extends Ce{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return te(n,{received:n.data,code:V.invalid_literal,expected:this._def.value}),ye}return{status:"valid",value:e.data}}get value(){return this._def.value}}_u.create=(t,e)=>new _u({value:t,typeName:he.ZodLiteral,...xe(e)});function NC(t,e){return new co({values:t,typeName:he.ZodEnum,...xe(e)})}class co extends Ce{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return te(n,{expected:De.joinValues(r),received:n.parsedType,code:V.invalid_type}),ye}if(this._def.values.indexOf(e.data)===-1){const n=this._getOrReturnCtx(e),r=this._def.values;return te(n,{received:n.data,code:V.invalid_enum_value,options:r}),ye}return yn(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){return co.create(e)}exclude(e){return co.create(this.options.filter(n=>!e.includes(n)))}}co.create=NC;class wu extends Ce{_parse(e){const n=De.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==q.string&&r.parsedType!==q.number){const i=De.objectValues(n);return te(r,{expected:De.joinValues(i),received:r.parsedType,code:V.invalid_type}),ye}if(n.indexOf(e.data)===-1){const i=De.objectValues(n);return te(r,{received:r.data,code:V.invalid_enum_value,options:i}),ye}return yn(e.data)}get enum(){return this._def.values}}wu.create=(t,e)=>new wu({values:t,typeName:he.ZodNativeEnum,...xe(e)});class ps extends Ce{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==q.promise&&n.common.async===!1)return te(n,{code:V.invalid_type,expected:q.promise,received:n.parsedType}),ye;const r=n.parsedType===q.promise?n.data:Promise.resolve(n.data);return yn(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ps.create=(t,e)=>new ps({type:t,typeName:he.ZodPromise,...xe(e)});class kr extends Ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===he.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:l=>{te(r,l),l.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const l=i.transform(r.data,o);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(l).then(s=>this._def.schema._parseAsync({data:s,path:r.path,parent:r})):this._def.schema._parseSync({data:l,path:r.path,parent:r})}if(i.type==="refinement"){const l=s=>{const a=i.refinement(s,o);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ye:(s.status==="dirty"&&n.dirty(),l(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?ye:(s.status==="dirty"&&n.dirty(),l(s.value).then(()=>({status:n.value,value:s.value}))))}if(i.type==="transform")if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!fu(l))return l;const s=i.transform(l.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>fu(l)?Promise.resolve(i.transform(l.value,o)).then(s=>({status:n.value,value:s})):l);De.assertNever(i)}}kr.create=(t,e,n)=>new kr({schema:t,typeName:he.ZodEffects,effect:e,...xe(n)});kr.createWithPreprocess=(t,e,n)=>new kr({schema:e,effect:{type:"preprocess",transform:t},typeName:he.ZodEffects,...xe(n)});class ci extends Ce{_parse(e){return this._getType(e)===q.undefined?yn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ci.create=(t,e)=>new ci({innerType:t,typeName:he.ZodOptional,...xe(e)});class Qo extends Ce{_parse(e){return this._getType(e)===q.null?yn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Qo.create=(t,e)=>new Qo({innerType:t,typeName:he.ZodNullable,...xe(e)});class Su extends Ce{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===q.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Su.create=(t,e)=>new Su({innerType:t,typeName:he.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...xe(e)});class Kd extends Ce{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ud(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new wr(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new wr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Kd.create=(t,e)=>new Kd({innerType:t,typeName:he.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...xe(e)});class Zd extends Ce{_parse(e){if(this._getType(e)!==q.nan){const r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:q.nan,received:r.parsedType}),ye}return{status:"valid",value:e.data}}}Zd.create=t=>new Zd({typeName:he.ZodNaN,...xe(t)});const T5=Symbol("zod_brand");class RC extends Ce{_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 Uu extends Ce{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?ye:o.status==="dirty"?(n.dirty(),TC(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ye:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new Uu({in:e,out:n,typeName:he.ZodPipeline})}}class Gd extends Ce{_parse(e){const n=this._def.innerType._parse(e);return fu(n)&&(n.value=Object.freeze(n.value)),n}}Gd.create=(t,e)=>new Gd({innerType:t,typeName:he.ZodReadonly,...xe(e)});const OC=(t,e={},n)=>t?hs.create().superRefine((r,i)=>{var o,l;if(!t(r)){const s=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,a=(l=(o=s.fatal)!==null&&o!==void 0?o:n)!==null&&l!==void 0?l:!0,u=typeof s=="string"?{message:s}:s;i.addIssue({code:"custom",...u,fatal:a})}}):hs.create(),N5={object:ct.lazycreate};var he;(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"})(he||(he={}));const R5=(t,e={message:`Input not instance of ${t.name}`})=>OC(n=>n instanceof t,e),PC=yr.create,AC=ao.create,O5=Zd.create,P5=uo.create,MC=hu.create,A5=Yo.create,M5=Wd.create,L5=pu.create,I5=gu.create,D5=hs.create,j5=zo.create,z5=gi.create,F5=Vd.create,B5=Sr.create,U5=ct.create,W5=ct.strictCreate,V5=mu.create,H5=If.create,K5=vu.create,Z5=Kr.create,G5=yu.create,Y5=Hd.create,X5=Xo.create,Q5=Ql.create,J5=xu.create,q5=_u.create,e3=co.create,t3=wu.create,n3=ps.create,Nx=kr.create,r3=ci.create,i3=Qo.create,o3=kr.createWithPreprocess,l3=Uu.create,s3=()=>PC().optional(),a3=()=>AC().optional(),u3=()=>MC().optional(),c3={string:t=>yr.create({...t,coerce:!0}),number:t=>ao.create({...t,coerce:!0}),boolean:t=>hu.create({...t,coerce:!0}),bigint:t=>uo.create({...t,coerce:!0}),date:t=>Yo.create({...t,coerce:!0})},d3=ye;var Cn=Object.freeze({__proto__:null,defaultErrorMap:du,setErrorMap:g5,getErrorMap:Fd,makeIssue:Bd,EMPTY_PATH:m5,addIssueToContext:te,ParseStatus:on,INVALID:ye,DIRTY:TC,OK:yn,isAborted:Dg,isDirty:jg,isValid:fu,isAsync:Ud,get util(){return De},get objectUtil(){return Ig},ZodParsedType:q,getParsedType:zi,ZodType:Ce,ZodString:yr,ZodNumber:ao,ZodBigInt:uo,ZodBoolean:hu,ZodDate:Yo,ZodSymbol:Wd,ZodUndefined:pu,ZodNull:gu,ZodAny:hs,ZodUnknown:zo,ZodNever:gi,ZodVoid:Vd,ZodArray:Sr,ZodObject:ct,ZodUnion:mu,ZodDiscriminatedUnion:If,ZodIntersection:vu,ZodTuple:Kr,ZodRecord:yu,ZodMap:Hd,ZodSet:Xo,ZodFunction:Ql,ZodLazy:xu,ZodLiteral:_u,ZodEnum:co,ZodNativeEnum:wu,ZodPromise:ps,ZodEffects:kr,ZodTransformer:kr,ZodOptional:ci,ZodNullable:Qo,ZodDefault:Su,ZodCatch:Kd,ZodNaN:Zd,BRAND:T5,ZodBranded:RC,ZodPipeline:Uu,ZodReadonly:Gd,custom:OC,Schema:Ce,ZodSchema:Ce,late:N5,get ZodFirstPartyTypeKind(){return he},coerce:c3,any:D5,array:B5,bigint:P5,boolean:MC,date:A5,discriminatedUnion:H5,effect:Nx,enum:e3,function:Q5,instanceof:R5,intersection:K5,lazy:J5,literal:q5,map:Y5,nan:O5,nativeEnum:t3,never:z5,null:I5,nullable:i3,number:AC,object:U5,oboolean:u3,onumber:a3,optional:r3,ostring:s3,pipeline:l3,preprocess:o3,promise:n3,record:G5,set:X5,strictObject:W5,string:PC,symbol:M5,transformer:Nx,tuple:Z5,undefined:L5,union:V5,unknown:j5,void:F5,NEVER:d3,ZodIssueCode:V,quotelessJson:p5,ZodError:wr});const f3=Cn.union([Cn.object({id:Cn.string(),mode:Cn.literal("proxy"),full_name:Cn.string().optional().nullable(),username:Cn.string().optional().nullable(),avatar_url:Cn.string().url().optional().nullable(),enabled:Cn.boolean()}),Cn.object({mode:Cn.literal("local"),enabled:Cn.boolean().optional()}),Cn.object({mode:Cn.literal("unauthorized"),enabled:Cn.boolean().optional()})]);function h3(t){const[e,n]=p.useState({status:"not-asked"}),[r,i]=p.useState(0);return p.useEffect(()=>{n({status:"loading"}),t.getSession().then(async o=>{try{if(Lo.isOk(o)){const l=o.value;n({status:"success",data:f3.parse(l)})}else o.error.statusCode===401?n({status:"success",data:{mode:"unauthorized"}}):r<3?setTimeout(()=>{i(r+1)},200*r):n({status:"error",error:"Could not fetch session"})}catch(l){console.error("Could not authorize:",l),n({status:"error",error:"Got an error while trying to get session"})}})},[r]),e}const Rx=t=>typeof t=="boolean"?"".concat(t):t===0?"0":t,Ox=uS,p3=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return Ox(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=e,l=Object.keys(i).map(u=>{const c=n==null?void 0:n[u],d=o==null?void 0:o[u];if(c===null)return null;const f=Rx(c)||Rx(d);return i[u][f]}),s=n&&Object.entries(n).reduce((u,c)=>{let[d,f]=c;return f===void 0||(u[d]=f),u},{}),a=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:d,className:f,...h}=c;return Object.entries(h).every(m=>{let[g,w]=m;return Array.isArray(w)?w.includes({...o,...s}[g]):{...o,...s}[g]===w})?[...u,d,f]:u},[]);return Ox(t,l,a,n==null?void 0:n.class,n==null?void 0:n.className)},g3=p3("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ms=p.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...i},o)=>{const l=r?as:"button";return _.jsx(l,{className:xt(g3({variant:e,size:n,className:t})),ref:o,...i})});Ms.displayName="Button";const Fv=p.forwardRef(({className:t,type:e,...n},r)=>_.jsx("input",{type:e,className:xt("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...n}));Fv.displayName="Input";function LC(t){const e=t+"CollectionProvider",[n,r]=ol(e),[i,o]=n(e,{collectionRef:{current:null},itemMap:new Map}),l=h=>{const{scope:m,children:g}=h,w=re.useRef(null),v=re.useRef(new Map).current;return re.createElement(i,{scope:m,itemMap:v,collectionRef:w},g)},s=t+"CollectionSlot",a=re.forwardRef((h,m)=>{const{scope:g,children:w}=h,v=o(s,g),y=st(m,v.collectionRef);return re.createElement(as,{ref:y},w)}),u=t+"CollectionItemSlot",c="data-radix-collection-item",d=re.forwardRef((h,m)=>{const{scope:g,children:w,...v}=h,y=re.useRef(null),x=st(m,y),S=o(u,g);return re.useEffect(()=>(S.itemMap.set(y,{ref:y,...v}),()=>void S.itemMap.delete(y))),re.createElement(as,{[c]:"",ref:x},w)});function f(h){const m=o(t+"CollectionConsumer",h);return re.useCallback(()=>{const w=m.collectionRef.current;if(!w)return[];const v=Array.from(w.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((S,b)=>v.indexOf(S.ref.current)-v.indexOf(b.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:l,Slot:a,ItemSlot:d},f,r]}function m3(t,e=globalThis==null?void 0:globalThis.document){const n=en(t);p.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r),()=>e.removeEventListener("keydown",r)},[n,e])}const Fg="dismissableLayer.update",v3="dismissableLayer.pointerDownOutside",y3="dismissableLayer.focusOutside";let Px;const x3=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_3=p.forwardRef((t,e)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:l,onInteractOutside:s,onDismiss:a,...u}=t,c=p.useContext(x3),[d,f]=p.useState(null),h=(n=d==null?void 0:d.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,m]=p.useState({}),g=st(e,O=>f(O)),w=Array.from(c.layers),[v]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=w.indexOf(v),x=d?w.indexOf(d):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,b=x>=y,T=w3(O=>{const L=O.target,P=[...c.branches].some(D=>D.contains(L));!b||P||(o==null||o(O),s==null||s(O),O.defaultPrevented||a==null||a())},h),$=S3(O=>{const L=O.target;[...c.branches].some(D=>D.contains(L))||(l==null||l(O),s==null||s(O),O.defaultPrevented||a==null||a())},h);return m3(O=>{x===c.layers.size-1&&(i==null||i(O),!O.defaultPrevented&&a&&(O.preventDefault(),a()))},h),p.useEffect(()=>{if(d)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Px=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),Ax(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Px)}},[d,h,r,c]),p.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),Ax())},[d,c]),p.useEffect(()=>{const O=()=>m({});return document.addEventListener(Fg,O),()=>document.removeEventListener(Fg,O)},[]),p.createElement(Ke.div,ie({},u,{ref:g,style:{pointerEvents:S?b?"auto":"none":void 0,...t.style},onFocusCapture:nt(t.onFocusCapture,$.onFocusCapture),onBlurCapture:nt(t.onBlurCapture,$.onBlurCapture),onPointerDownCapture:nt(t.onPointerDownCapture,T.onPointerDownCapture)}))});function w3(t,e=globalThis==null?void 0:globalThis.document){const n=en(t),r=p.useRef(!1),i=p.useRef(()=>{});return p.useEffect(()=>{const o=s=>{if(s.target&&!r.current){let c=function(){IC(v3,n,u,{discrete:!0})};var a=c;const u={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=c,e.addEventListener("click",i.current,{once:!0})):c()}else e.removeEventListener("click",i.current);r.current=!1},l=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),e.removeEventListener("pointerdown",o),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function S3(t,e=globalThis==null?void 0:globalThis.document){const n=en(t),r=p.useRef(!1);return p.useEffect(()=>{const i=o=>{o.target&&!r.current&&IC(y3,n,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ax(){const t=new CustomEvent(Fg);document.dispatchEvent(t)}function IC(t,e,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?t2(i,o):i.dispatchEvent(o)}let Fh=0;function E3(){p.useEffect(()=>{var t,e;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(t=n[0])!==null&&t!==void 0?t:Mx()),document.body.insertAdjacentElement("beforeend",(e=n[1])!==null&&e!==void 0?e:Mx()),Fh++,()=>{Fh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),Fh--}},[])}function Mx(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",t}const Bh="focusScope.autoFocusOnMount",Uh="focusScope.autoFocusOnUnmount",Lx={bubbles:!1,cancelable:!0},C3=p.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...l}=t,[s,a]=p.useState(null),u=en(i),c=en(o),d=p.useRef(null),f=st(e,g=>a(g)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let y=function(T){if(h.paused||!s)return;const $=T.target;s.contains($)?d.current=$:Oi(d.current,{select:!0})},x=function(T){if(h.paused||!s)return;const $=T.relatedTarget;$!==null&&(s.contains($)||Oi(d.current,{select:!0}))},S=function(T){if(document.activeElement===document.body)for(const O of T)O.removedNodes.length>0&&Oi(s)};var g=y,w=x,v=S;document.addEventListener("focusin",y),document.addEventListener("focusout",x);const b=new MutationObserver(S);return s&&b.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),b.disconnect()}}},[r,s,h.paused]),p.useEffect(()=>{if(s){Dx.add(h);const g=document.activeElement;if(!s.contains(g)){const v=new CustomEvent(Bh,Lx);s.addEventListener(Bh,u),s.dispatchEvent(v),v.defaultPrevented||(k3(R3(DC(s)),{select:!0}),document.activeElement===g&&Oi(s))}return()=>{s.removeEventListener(Bh,u),setTimeout(()=>{const v=new CustomEvent(Uh,Lx);s.addEventListener(Uh,c),s.dispatchEvent(v),v.defaultPrevented||Oi(g??document.body,{select:!0}),s.removeEventListener(Uh,c),Dx.remove(h)},0)}}},[s,u,c,h]);const m=p.useCallback(g=>{if(!n&&!r||h.paused)return;const w=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(w&&v){const y=g.currentTarget,[x,S]=b3(y);x&&S?!g.shiftKey&&v===S?(g.preventDefault(),n&&Oi(x,{select:!0})):g.shiftKey&&v===x&&(g.preventDefault(),n&&Oi(S,{select:!0})):v===y&&g.preventDefault()}},[n,r,h.paused]);return p.createElement(Ke.div,ie({tabIndex:-1},l,{ref:f,onKeyDown:m}))});function k3(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Oi(r,{select:e}),document.activeElement!==n)return}function b3(t){const e=DC(t),n=Ix(e,t),r=Ix(e.reverse(),t);return[n,r]}function DC(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Ix(t,e){for(const n of t)if(!$3(n,{upTo:e}))return n}function $3(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}function T3(t){return t instanceof HTMLInputElement&&"select"in t}function Oi(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&T3(t)&&e&&t.select()}}const Dx=N3();function N3(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=jx(t,e),t.unshift(e)},remove(e){var n;t=jx(t,e),(n=t[0])===null||n===void 0||n.resume()}}}function jx(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function R3(t){return t.filter(e=>e.tagName!=="A")}const O3=M_.useId||(()=>{});let P3=0;function Df(t){const[e,n]=p.useState(O3());return Un(()=>{t||n(r=>r??String(P3++))},[t]),t||(e?`radix-${e}`:"")}const A3=["top","right","bottom","left"],fo=Math.min,Ln=Math.max,Yd=Math.round,Sc=Math.floor,ho=t=>({x:t,y:t}),M3={left:"right",right:"left",bottom:"top",top:"bottom"},L3={start:"end",end:"start"};function Bg(t,e,n){return Ln(t,fo(e,n))}function mi(t,e){return typeof t=="function"?t(e):t}function vi(t){return t.split("-")[0]}function Ls(t){return t.split("-")[1]}function Bv(t){return t==="x"?"y":"x"}function Uv(t){return t==="y"?"height":"width"}function Is(t){return["top","bottom"].includes(vi(t))?"y":"x"}function Wv(t){return Bv(Is(t))}function I3(t,e,n){n===void 0&&(n=!1);const r=Ls(t),i=Wv(t),o=Uv(i);let l=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(l=Xd(l)),[l,Xd(l)]}function D3(t){const e=Xd(t);return[Ug(t),e,Ug(e)]}function Ug(t){return t.replace(/start|end/g,e=>L3[e])}function j3(t,e,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],l=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?o:l;default:return[]}}function z3(t,e,n,r){const i=Ls(t);let o=j3(vi(t),n==="start",r);return i&&(o=o.map(l=>l+"-"+i),e&&(o=o.concat(o.map(Ug)))),o}function Xd(t){return t.replace(/left|right|bottom|top/g,e=>M3[e])}function F3(t){return{top:0,right:0,bottom:0,left:0,...t}}function jC(t){return typeof t!="number"?F3(t):{top:t,right:t,bottom:t,left:t}}function Qd(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function zx(t,e,n){let{reference:r,floating:i}=t;const o=Is(e),l=Wv(e),s=Uv(l),a=vi(e),u=o==="y",c=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2;let h;switch(a){case"top":h={x:c,y:r.y-i.height};break;case"bottom":h={x:c,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-i.width,y:d};break;default:h={x:r.x,y:r.y}}switch(Ls(e)){case"start":h[l]-=f*(n&&u?-1:1);break;case"end":h[l]+=f*(n&&u?-1:1);break}return h}const B3=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:l}=n,s=o.filter(Boolean),a=await(l.isRTL==null?void 0:l.isRTL(e));let u=await l.getElementRects({reference:t,floating:e,strategy:i}),{x:c,y:d}=zx(u,r,a),f=r,h={},m=0;for(let g=0;g<s.length;g++){const{name:w,fn:v}=s[g],{x:y,y:x,data:S,reset:b}=await v({x:c,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:h,rects:u,platform:l,elements:{reference:t,floating:e}});if(c=y??c,d=x??d,h={...h,[w]:{...h[w],...S}},b&&m<=50){m++,typeof b=="object"&&(b.placement&&(f=b.placement),b.rects&&(u=b.rects===!0?await l.getElementRects({reference:t,floating:e,strategy:i}):b.rects),{x:c,y:d}=zx(u,f,a)),g=-1;continue}}return{x:c,y:d,placement:f,strategy:i,middlewareData:h}};async function Eu(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:o,rects:l,elements:s,strategy:a}=t,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=mi(e,t),m=jC(h),w=s[f?d==="floating"?"reference":"floating":d],v=Qd(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(w)))==null||n?w:w.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:a})),y=d==="floating"?{...l.floating,x:r,y:i}:l.reference,x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(s.floating)),S=await(o.isElement==null?void 0:o.isElement(x))?await(o.getScale==null?void 0:o.getScale(x))||{x:1,y:1}:{x:1,y:1},b=Qd(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({rect:y,offsetParent:x,strategy:a}):y);return{top:(v.top-b.top+m.top)/S.y,bottom:(b.bottom-v.bottom+m.bottom)/S.y,left:(v.left-b.left+m.left)/S.x,right:(b.right-v.right+m.right)/S.x}}const Fx=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:l,elements:s,middlewareData:a}=e,{element:u,padding:c=0}=mi(t,e)||{};if(u==null)return{};const d=jC(c),f={x:n,y:r},h=Wv(i),m=Uv(h),g=await l.getDimensions(u),w=h==="y",v=w?"top":"left",y=w?"bottom":"right",x=w?"clientHeight":"clientWidth",S=o.reference[m]+o.reference[h]-f[h]-o.floating[m],b=f[h]-o.reference[h],T=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u));let $=T?T[x]:0;(!$||!await(l.isElement==null?void 0:l.isElement(T)))&&($=s.floating[x]||o.floating[m]);const O=S/2-b/2,L=$/2-g[m]/2-1,P=fo(d[v],L),D=fo(d[y],L),B=P,oe=$-g[m]-D,H=$/2-g[m]/2+O,Z=Bg(B,H,oe),C=!a.arrow&&Ls(i)!=null&&H!=Z&&o.reference[m]/2-(H<B?P:D)-g[m]/2<0,k=C?H<B?H-B:H-oe:0;return{[h]:f[h]+k,data:{[h]:Z,centerOffset:H-Z-k,...C&&{alignmentOffset:k}},reset:C}}}),U3=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:o,rects:l,initialPlacement:s,platform:a,elements:u}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...w}=mi(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const v=vi(i),y=vi(s)===s,x=await(a.isRTL==null?void 0:a.isRTL(u.floating)),S=f||(y||!g?[Xd(s)]:D3(s));!f&&m!=="none"&&S.push(...z3(s,g,m,x));const b=[s,...S],T=await Eu(e,w),$=[];let O=((r=o.flip)==null?void 0:r.overflows)||[];if(c&&$.push(T[v]),d){const B=I3(i,l,x);$.push(T[B[0]],T[B[1]])}if(O=[...O,{placement:i,overflows:$}],!$.every(B=>B<=0)){var L,P;const B=(((L=o.flip)==null?void 0:L.index)||0)+1,oe=b[B];if(oe)return{data:{index:B,overflows:O},reset:{placement:oe}};let H=(P=O.filter(Z=>Z.overflows[0]<=0).sort((Z,C)=>Z.overflows[1]-C.overflows[1])[0])==null?void 0:P.placement;if(!H)switch(h){case"bestFit":{var D;const Z=(D=O.map(C=>[C.placement,C.overflows.filter(k=>k>0).reduce((k,E)=>k+E,0)]).sort((C,k)=>C[1]-k[1])[0])==null?void 0:D[0];Z&&(H=Z);break}case"initialPlacement":H=s;break}if(i!==H)return{reset:{placement:H}}}return{}}}};function Bx(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ux(t){return A3.some(e=>t[e]>=0)}const W3=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=mi(t,e);switch(r){case"referenceHidden":{const o=await Eu(e,{...i,elementContext:"reference"}),l=Bx(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Ux(l)}}}case"escaped":{const o=await Eu(e,{...i,altBoundary:!0}),l=Bx(o,n.floating);return{data:{escapedOffsets:l,escaped:Ux(l)}}}default:return{}}}}};async function V3(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),l=vi(n),s=Ls(n),a=Is(n)==="y",u=["left","top"].includes(l)?-1:1,c=o&&a?-1:1,d=mi(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&typeof m=="number"&&(h=s==="end"?m*-1:m),a?{x:h*c,y:f*u}:{x:f*u,y:h*c}}const H3=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){const{x:n,y:r}=e,i=await V3(e,t);return{x:n+i.x,y:r+i.y,data:i}}}},K3=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:s={fn:w=>{let{x:v,y}=w;return{x:v,y}}},...a}=mi(t,e),u={x:n,y:r},c=await Eu(e,a),d=Is(vi(i)),f=Bv(d);let h=u[f],m=u[d];if(o){const w=f==="y"?"top":"left",v=f==="y"?"bottom":"right",y=h+c[w],x=h-c[v];h=Bg(y,h,x)}if(l){const w=d==="y"?"top":"left",v=d==="y"?"bottom":"right",y=m+c[w],x=m-c[v];m=Bg(y,m,x)}const g=s.fn({...e,[f]:h,[d]:m});return{...g,data:{x:g.x-n,y:g.y-r}}}}},Z3=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:o,middlewareData:l}=e,{offset:s=0,mainAxis:a=!0,crossAxis:u=!0}=mi(t,e),c={x:n,y:r},d=Is(i),f=Bv(d);let h=c[f],m=c[d];const g=mi(s,e),w=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(a){const x=f==="y"?"height":"width",S=o.reference[f]-o.floating[x]+w.mainAxis,b=o.reference[f]+o.reference[x]-w.mainAxis;h<S?h=S:h>b&&(h=b)}if(u){var v,y;const x=f==="y"?"width":"height",S=["top","left"].includes(vi(i)),b=o.reference[d]-o.floating[x]+(S&&((v=l.offset)==null?void 0:v[d])||0)+(S?0:w.crossAxis),T=o.reference[d]+o.reference[x]+(S?0:((y=l.offset)==null?void 0:y[d])||0)-(S?w.crossAxis:0);m<b?m=b:m>T&&(m=T)}return{[f]:h,[d]:m}}}},G3=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:i,elements:o}=e,{apply:l=()=>{},...s}=mi(t,e),a=await Eu(e,s),u=vi(n),c=Ls(n),d=Is(n)==="y",{width:f,height:h}=r.floating;let m,g;u==="top"||u==="bottom"?(m=u,g=c===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(g=u,m=c==="end"?"top":"bottom");const w=h-a[m],v=f-a[g],y=!e.middlewareData.shift;let x=w,S=v;if(d){const T=f-a.left-a.right;S=c||y?fo(v,T):T}else{const T=h-a.top-a.bottom;x=c||y?fo(w,T):T}if(y&&!c){const T=Ln(a.left,0),$=Ln(a.right,0),O=Ln(a.top,0),L=Ln(a.bottom,0);d?S=f-2*(T!==0||$!==0?T+$:Ln(a.left,a.right)):x=h-2*(O!==0||L!==0?O+L:Ln(a.top,a.bottom))}await l({...e,availableWidth:S,availableHeight:x});const b=await i.getDimensions(o.floating);return f!==b.width||h!==b.height?{reset:{rects:!0}}:{}}}};function po(t){return zC(t)?(t.nodeName||"").toLowerCase():"#document"}function Fn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ci(t){var e;return(e=(zC(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function zC(t){return t instanceof Node||t instanceof Fn(t).Node}function yi(t){return t instanceof Element||t instanceof Fn(t).Element}function Zr(t){return t instanceof HTMLElement||t instanceof Fn(t).HTMLElement}function Wx(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Fn(t).ShadowRoot}function Wu(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=ir(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function Y3(t){return["table","td","th"].includes(po(t))}function Vv(t){const e=Hv(),n=ir(t);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function X3(t){let e=gs(t);for(;Zr(e)&&!jf(e);){if(Vv(e))return e;e=gs(e)}return null}function Hv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function jf(t){return["html","body","#document"].includes(po(t))}function ir(t){return Fn(t).getComputedStyle(t)}function zf(t){return yi(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function gs(t){if(po(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Wx(t)&&t.host||Ci(t);return Wx(e)?e.host:e}function FC(t){const e=gs(t);return jf(e)?t.ownerDocument?t.ownerDocument.body:t.body:Zr(e)&&Wu(e)?e:FC(e)}function Cu(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=FC(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),l=Fn(i);return o?e.concat(l,l.visualViewport||[],Wu(i)?i:[],l.frameElement&&n?Cu(l.frameElement):[]):e.concat(i,Cu(i,[],n))}function BC(t){const e=ir(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Zr(t),o=i?t.offsetWidth:n,l=i?t.offsetHeight:r,s=Yd(n)!==o||Yd(r)!==l;return s&&(n=o,r=l),{width:n,height:r,$:s}}function Kv(t){return yi(t)?t:t.contextElement}function Jl(t){const e=Kv(t);if(!Zr(e))return ho(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=BC(e);let l=(o?Yd(n.width):n.width)/r,s=(o?Yd(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!s||!Number.isFinite(s))&&(s=1),{x:l,y:s}}const Q3=ho(0);function UC(t){const e=Fn(t);return!Hv()||!e.visualViewport?Q3:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function J3(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Fn(t)?!1:e}function Jo(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=Kv(t);let l=ho(1);e&&(r?yi(r)&&(l=Jl(r)):l=Jl(t));const s=J3(o,n,r)?UC(o):ho(0);let a=(i.left+s.x)/l.x,u=(i.top+s.y)/l.y,c=i.width/l.x,d=i.height/l.y;if(o){const f=Fn(o),h=r&&yi(r)?Fn(r):r;let m=f.frameElement;for(;m&&r&&h!==f;){const g=Jl(m),w=m.getBoundingClientRect(),v=ir(m),y=w.left+(m.clientLeft+parseFloat(v.paddingLeft))*g.x,x=w.top+(m.clientTop+parseFloat(v.paddingTop))*g.y;a*=g.x,u*=g.y,c*=g.x,d*=g.y,a+=y,u+=x,m=Fn(m).frameElement}}return Qd({width:c,height:d,x:a,y:u})}function q3(t){let{rect:e,offsetParent:n,strategy:r}=t;const i=Zr(n),o=Ci(n);if(n===o)return e;let l={scrollLeft:0,scrollTop:0},s=ho(1);const a=ho(0);if((i||!i&&r!=="fixed")&&((po(n)!=="body"||Wu(o))&&(l=zf(n)),Zr(n))){const u=Jo(n);s=Jl(n),a.x=u.x+n.clientLeft,a.y=u.y+n.clientTop}return{width:e.width*s.x,height:e.height*s.y,x:e.x*s.x-l.scrollLeft*s.x+a.x,y:e.y*s.y-l.scrollTop*s.y+a.y}}function eM(t){return Array.from(t.getClientRects())}function WC(t){return Jo(Ci(t)).left+zf(t).scrollLeft}function tM(t){const e=Ci(t),n=zf(t),r=t.ownerDocument.body,i=Ln(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Ln(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+WC(t);const s=-n.scrollTop;return ir(r).direction==="rtl"&&(l+=Ln(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:l,y:s}}function nM(t,e){const n=Fn(t),r=Ci(t),i=n.visualViewport;let o=r.clientWidth,l=r.clientHeight,s=0,a=0;if(i){o=i.width,l=i.height;const u=Hv();(!u||u&&e==="fixed")&&(s=i.offsetLeft,a=i.offsetTop)}return{width:o,height:l,x:s,y:a}}function rM(t,e){const n=Jo(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=Zr(t)?Jl(t):ho(1),l=t.clientWidth*o.x,s=t.clientHeight*o.y,a=i*o.x,u=r*o.y;return{width:l,height:s,x:a,y:u}}function Vx(t,e,n){let r;if(e==="viewport")r=nM(t,n);else if(e==="document")r=tM(Ci(t));else if(yi(e))r=rM(e,n);else{const i=UC(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return Qd(r)}function VC(t,e){const n=gs(t);return n===e||!yi(n)||jf(n)?!1:ir(n).position==="fixed"||VC(n,e)}function iM(t,e){const n=e.get(t);if(n)return n;let r=Cu(t,[],!1).filter(s=>yi(s)&&po(s)!=="body"),i=null;const o=ir(t).position==="fixed";let l=o?gs(t):t;for(;yi(l)&&!jf(l);){const s=ir(l),a=Vv(l);!a&&s.position==="fixed"&&(i=null),(o?!a&&!i:!a&&s.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Wu(l)&&!a&&VC(t,l))?r=r.filter(c=>c!==l):i=s,l=gs(l)}return e.set(t,r),r}function oM(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const l=[...n==="clippingAncestors"?iM(e,this._c):[].concat(n),r],s=l[0],a=l.reduce((u,c)=>{const d=Vx(e,c,i);return u.top=Ln(d.top,u.top),u.right=fo(d.right,u.right),u.bottom=fo(d.bottom,u.bottom),u.left=Ln(d.left,u.left),u},Vx(e,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function lM(t){return BC(t)}function sM(t,e,n){const r=Zr(e),i=Ci(e),o=n==="fixed",l=Jo(t,!0,o,e);let s={scrollLeft:0,scrollTop:0};const a=ho(0);if(r||!r&&!o)if((po(e)!=="body"||Wu(i))&&(s=zf(e)),r){const u=Jo(e,!0,o,e);a.x=u.x+e.clientLeft,a.y=u.y+e.clientTop}else i&&(a.x=WC(i));return{x:l.left+s.scrollLeft-a.x,y:l.top+s.scrollTop-a.y,width:l.width,height:l.height}}function Hx(t,e){return!Zr(t)||ir(t).position==="fixed"?null:e?e(t):t.offsetParent}function HC(t,e){const n=Fn(t);if(!Zr(t))return n;let r=Hx(t,e);for(;r&&Y3(r)&&ir(r).position==="static";)r=Hx(r,e);return r&&(po(r)==="html"||po(r)==="body"&&ir(r).position==="static"&&!Vv(r))?n:r||X3(t)||n}const aM=async function(t){let{reference:e,floating:n,strategy:r}=t;const i=this.getOffsetParent||HC,o=this.getDimensions;return{reference:sM(e,await i(n),r),floating:{x:0,y:0,...await o(n)}}};function uM(t){return ir(t).direction==="rtl"}const cM={convertOffsetParentRelativeRectToViewportRelativeRect:q3,getDocumentElement:Ci,getClippingRect:oM,getOffsetParent:HC,getElementRects:aM,getClientRects:eM,getDimensions:lM,getScale:Jl,isElement:yi,isRTL:uM};function dM(t,e){let n=null,r;const i=Ci(t);function o(){clearTimeout(r),n&&n.disconnect(),n=null}function l(s,a){s===void 0&&(s=!1),a===void 0&&(a=1),o();const{left:u,top:c,width:d,height:f}=t.getBoundingClientRect();if(s||e(),!d||!f)return;const h=Sc(c),m=Sc(i.clientWidth-(u+d)),g=Sc(i.clientHeight-(c+f)),w=Sc(u),y={rootMargin:-h+"px "+-m+"px "+-g+"px "+-w+"px",threshold:Ln(0,fo(1,a))||1};let x=!0;function S(b){const T=b[0].intersectionRatio;if(T!==a){if(!x)return l();T?l(!1,T):r=setTimeout(()=>{l(!1,1e-7)},100)}x=!1}try{n=new IntersectionObserver(S,{...y,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,y)}n.observe(t)}return l(!0),o}function fM(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=Kv(t),c=i||o?[...u?Cu(u):[],...Cu(e)]:[];c.forEach(v=>{i&&v.addEventListener("scroll",n,{passive:!0}),o&&v.addEventListener("resize",n)});const d=u&&s?dM(u,n):null;let f=-1,h=null;l&&(h=new ResizeObserver(v=>{let[y]=v;y&&y.target===u&&h&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{h&&h.observe(e)})),n()}),u&&!a&&h.observe(u),h.observe(e));let m,g=a?Jo(t):null;a&&w();function w(){const v=Jo(t);g&&(v.x!==g.x||v.y!==g.y||v.width!==g.width||v.height!==g.height)&&n(),g=v,m=requestAnimationFrame(w)}return n(),()=>{c.forEach(v=>{i&&v.removeEventListener("scroll",n),o&&v.removeEventListener("resize",n)}),d&&d(),h&&h.disconnect(),h=null,a&&cancelAnimationFrame(m)}}const hM=(t,e,n)=>{const r=new Map,i={platform:cM,...n},o={...i.platform,_c:r};return B3(t,e,{...i,platform:o})},pM=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Fx({element:r.current,padding:i}).fn(n):{}:r?Fx({element:r,padding:i}).fn(n):{}}}};var Kc=typeof document<"u"?p.useLayoutEffect:p.useEffect;function Jd(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,i;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(!Jd(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&t.$$typeof)&&!Jd(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function KC(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Kx(t,e){const n=KC(t);return Math.round(e*n)/n}function Zx(t){const e=p.useRef(t);return Kc(()=>{e.current=t}),e}function gM(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:l}={},transform:s=!0,whileElementsMounted:a,open:u}=t,[c,d]=p.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=p.useState(r);Jd(f,r)||h(r);const[m,g]=p.useState(null),[w,v]=p.useState(null),y=p.useCallback(C=>{C!=T.current&&(T.current=C,g(C))},[g]),x=p.useCallback(C=>{C!==$.current&&($.current=C,v(C))},[v]),S=o||m,b=l||w,T=p.useRef(null),$=p.useRef(null),O=p.useRef(c),L=Zx(a),P=Zx(i),D=p.useCallback(()=>{if(!T.current||!$.current)return;const C={placement:e,strategy:n,middleware:f};P.current&&(C.platform=P.current),hM(T.current,$.current,C).then(k=>{const E={...k,isPositioned:!0};B.current&&!Jd(O.current,E)&&(O.current=E,Gr.flushSync(()=>{d(E)}))})},[f,e,n,P]);Kc(()=>{u===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,d(C=>({...C,isPositioned:!1})))},[u]);const B=p.useRef(!1);Kc(()=>(B.current=!0,()=>{B.current=!1}),[]),Kc(()=>{if(S&&(T.current=S),b&&($.current=b),S&&b){if(L.current)return L.current(S,b,D);D()}},[S,b,D,L]);const oe=p.useMemo(()=>({reference:T,floating:$,setReference:y,setFloating:x}),[y,x]),H=p.useMemo(()=>({reference:S,floating:b}),[S,b]),Z=p.useMemo(()=>{const C={position:n,left:0,top:0};if(!H.floating)return C;const k=Kx(H.floating,c.x),E=Kx(H.floating,c.y);return s?{...C,transform:"translate("+k+"px, "+E+"px)",...KC(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:E}},[n,s,H.floating,c.x,c.y]);return p.useMemo(()=>({...c,update:D,refs:oe,elements:H,floatingStyles:Z}),[c,D,oe,H,Z])}function ZC(t){const[e,n]=p.useState(void 0);return Un(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let l,s;if("borderBoxSize"in o){const a=o.borderBoxSize,u=Array.isArray(a)?a[0]:a;l=u.inlineSize,s=u.blockSize}else l=t.offsetWidth,s=t.offsetHeight;n({width:l,height:s})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}const GC="Popper",[YC,XC]=ol(GC),[mM,QC]=YC(GC),vM=t=>{const{__scopePopper:e,children:n}=t,[r,i]=p.useState(null);return p.createElement(mM,{scope:e,anchor:r,onAnchorChange:i},n)},yM="PopperAnchor",xM=p.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,o=QC(yM,n),l=p.useRef(null),s=st(e,l);return p.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||l.current)}),r?null:p.createElement(Ke.div,ie({},i,{ref:s}))}),JC="PopperContent",[_M,RD]=YC(JC),wM=p.forwardRef((t,e)=>{var n,r,i,o,l,s,a,u;const{__scopePopper:c,side:d="bottom",sideOffset:f=0,align:h="center",alignOffset:m=0,arrowPadding:g=0,avoidCollisions:w=!0,collisionBoundary:v=[],collisionPadding:y=0,sticky:x="partial",hideWhenDetached:S=!1,updatePositionStrategy:b="optimized",onPlaced:T,...$}=t,O=QC(JC,c),[L,P]=p.useState(null),D=st(e,Sn=>P(Sn)),[B,oe]=p.useState(null),H=ZC(B),Z=(n=H==null?void 0:H.width)!==null&&n!==void 0?n:0,C=(r=H==null?void 0:H.height)!==null&&r!==void 0?r:0,k=d+(h!=="center"?"-"+h:""),E=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},A=Array.isArray(v)?v:[v],N=A.length>0,F={padding:E,boundary:A.filter(SM),altBoundary:N},{refs:K,floatingStyles:de,placement:se,isPositioned:Ae,middlewareData:Ne}=gM({strategy:"fixed",placement:k,whileElementsMounted:(...Sn)=>fM(...Sn,{animationFrame:b==="always"}),elements:{reference:O.anchor},middleware:[H3({mainAxis:f+C,alignmentAxis:m}),w&&K3({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?Z3():void 0,...F}),w&&U3({...F}),G3({...F,apply:({elements:Sn,rects:lr,availableWidth:ze,availableHeight:Tt})=>{const{width:at,height:ln}=lr.reference,En=Sn.floating.style;En.setProperty("--radix-popper-available-width",`${ze}px`),En.setProperty("--radix-popper-available-height",`${Tt}px`),En.setProperty("--radix-popper-anchor-width",`${at}px`),En.setProperty("--radix-popper-anchor-height",`${ln}px`)}}),B&&pM({element:B,padding:g}),EM({arrowWidth:Z,arrowHeight:C}),S&&W3({strategy:"referenceHidden",...F})]}),[Q,je]=qC(se),be=en(T);Un(()=>{Ae&&(be==null||be())},[Ae,be]);const Re=(i=Ne.arrow)===null||i===void 0?void 0:i.x,we=(o=Ne.arrow)===null||o===void 0?void 0:o.y,Ie=((l=Ne.arrow)===null||l===void 0?void 0:l.centerOffset)!==0,[Qe,Wt]=p.useState();return Un(()=>{L&&Wt(window.getComputedStyle(L).zIndex)},[L]),p.createElement("div",{ref:K.setFloating,"data-radix-popper-content-wrapper":"",style:{...de,transform:Ae?de.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Qe,"--radix-popper-transform-origin":[(s=Ne.transformOrigin)===null||s===void 0?void 0:s.x,(a=Ne.transformOrigin)===null||a===void 0?void 0:a.y].join(" ")},dir:t.dir},p.createElement(_M,{scope:c,placedSide:Q,onArrowChange:oe,arrowX:Re,arrowY:we,shouldHideArrow:Ie},p.createElement(Ke.div,ie({"data-side":Q,"data-align":je},$,{ref:D,style:{...$.style,animation:Ae?void 0:"none",opacity:(u=Ne.hide)!==null&&u!==void 0&&u.referenceHidden?0:void 0}}))))});function SM(t){return t!==null}const EM=t=>({name:"transformOrigin",options:t,fn(e){var n,r,i,o,l;const{placement:s,rects:a,middlewareData:u}=e,d=((n=u.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,f=d?0:t.arrowWidth,h=d?0:t.arrowHeight,[m,g]=qC(s),w={start:"0%",center:"50%",end:"100%"}[g],v=((r=(i=u.arrow)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)+f/2,y=((o=(l=u.arrow)===null||l===void 0?void 0:l.y)!==null&&o!==void 0?o:0)+h/2;let x="",S="";return m==="bottom"?(x=d?w:`${v}px`,S=`${-h}px`):m==="top"?(x=d?w:`${v}px`,S=`${a.floating.height+h}px`):m==="right"?(x=`${-h}px`,S=d?w:`${y}px`):m==="left"&&(x=`${a.floating.width+h}px`,S=d?w:`${y}px`),{data:{x,y:S}}}});function qC(t){const[e,n="center"]=t.split("-");return[e,n]}const CM=vM,kM=xM,bM=wM,$M=p.forwardRef((t,e)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...i}=t;return r?jw.createPortal(p.createElement(Ke.div,ie({},i,{ref:e})),r):null});function ms({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=TM({defaultProp:e,onChange:n}),o=t!==void 0,l=o?t:r,s=en(n),a=p.useCallback(u=>{if(o){const d=typeof u=="function"?u(t):u;d!==t&&s(d)}else i(u)},[o,t,i,s]);return[l,a]}function TM({defaultProp:t,onChange:e}){const n=p.useState(t),[r]=n,i=p.useRef(r),o=en(e);return p.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}function ek(t){const e=p.useRef({value:t,previous:t});return p.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}const NM=p.forwardRef((t,e)=>p.createElement(Ke.span,ie({},t,{ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}})));var RM=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},wl=new WeakMap,Ec=new WeakMap,Cc={},Wh=0,tk=function(t){return t&&(t.host||tk(t.parentNode))},OM=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=tk(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})},PM=function(t,e,n,r){var i=OM(e,Array.isArray(t)?t:[t]);Cc[n]||(Cc[n]=new WeakMap);var o=Cc[n],l=[],s=new Set,a=new Set(i),u=function(d){!d||s.has(d)||(s.add(d),u(d.parentNode))};i.forEach(u);var c=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(f){if(s.has(f))c(f);else{var h=f.getAttribute(r),m=h!==null&&h!=="false",g=(wl.get(f)||0)+1,w=(o.get(f)||0)+1;wl.set(f,g),o.set(f,w),l.push(f),g===1&&m&&Ec.set(f,!0),w===1&&f.setAttribute(n,"true"),m||f.setAttribute(r,"true")}})};return c(e),s.clear(),Wh++,function(){l.forEach(function(d){var f=wl.get(d)-1,h=o.get(d)-1;wl.set(d,f),o.set(d,h),f||(Ec.has(d)||d.removeAttribute(r),Ec.delete(d)),h||d.removeAttribute(n)}),Wh--,Wh||(wl=new WeakMap,wl=new WeakMap,Ec=new WeakMap,Cc={})}},AM=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=e||RM(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),PM(r,i,n,"aria-hidden")):function(){return null}},Lr=function(){return Lr=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Lr.apply(this,arguments)};function nk(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 i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function MM(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}var Zc="right-scroll-bar-position",Gc="width-before-scroll-bar",LM="with-scroll-bars-hidden",IM="--removed-body-scroll-bar-size";function DM(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function jM(t,e){var n=p.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}function zM(t,e){return jM(e||null,function(n){return t.forEach(function(r){return DM(r,n)})})}function FM(t){return t}function BM(t,e){e===void 0&&(e=FM);var n=[],r=!1,i={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(o){var l=e(o,r);return n.push(l),function(){n=n.filter(function(s){return s!==l})}},assignSyncMedium:function(o){for(r=!0;n.length;){var l=n;n=[],l.forEach(o)}n={push:function(s){return o(s)},filter:function(){return n}}},assignMedium:function(o){r=!0;var l=[];if(n.length){var s=n;n=[],s.forEach(o),l=n}var a=function(){var c=l;l=[],c.forEach(o)},u=function(){return Promise.resolve().then(a)};u(),n={push:function(c){l.push(c),u()},filter:function(c){return l=l.filter(c),n}}}};return i}function UM(t){t===void 0&&(t={});var e=BM(null);return e.options=Lr({async:!0,ssr:!1},t),e}var rk=function(t){var e=t.sideCar,n=nk(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 p.createElement(r,Lr({},n))};rk.isSideCarExport=!0;function WM(t,e){return t.useMedium(e),rk}var ik=UM(),Vh=function(){},Ff=p.forwardRef(function(t,e){var n=p.useRef(null),r=p.useState({onScrollCapture:Vh,onWheelCapture:Vh,onTouchMoveCapture:Vh}),i=r[0],o=r[1],l=t.forwardProps,s=t.children,a=t.className,u=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,h=t.noIsolation,m=t.inert,g=t.allowPinchZoom,w=t.as,v=w===void 0?"div":w,y=nk(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),x=f,S=zM([n,e]),b=Lr(Lr({},y),i);return p.createElement(p.Fragment,null,c&&p.createElement(x,{sideCar:ik,removeScrollBar:u,shards:d,noIsolation:h,inert:m,setCallbacks:o,allowPinchZoom:!!g,lockRef:n}),l?p.cloneElement(p.Children.only(s),Lr(Lr({},b),{ref:S})):p.createElement(v,Lr({},b,{className:a,ref:S}),s))});Ff.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ff.classNames={fullWidth:Gc,zeroRight:Zc};var Gx,VM=function(){if(Gx)return Gx;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function HM(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=VM();return e&&t.setAttribute("nonce",e),t}function KM(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function ZM(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var GM=function(){var t=0,e=null;return{add:function(n){t==0&&(e=HM())&&(KM(e,n),ZM(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},YM=function(){var t=GM();return function(e,n){p.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},ok=function(){var t=YM(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},XM={left:0,top:0,right:0,gap:0},Hh=function(t){return parseInt(t||"",10)||0},QM=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[Hh(n),Hh(r),Hh(i)]},JM=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return XM;var e=QM(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])}},qM=ok(),e4=function(t,e,n,r){var i=t.left,o=t.top,l=t.right,s=t.gap;return n===void 0&&(n="margin"),`
|
|
130
130
|
.`.concat(LM,` {
|
|
131
131
|
overflow: hidden `).concat(r,`;
|
|
132
132
|
padding-right: `).concat(s,"px ").concat(r,`;
|