@puddle-code/cli 0.0.32 → 0.0.33
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/CHANGELOG.md +3 -13
- package/dist/index.js +24 -3
- package/dist/public/assets/Dashboard-D0B3Kact.js +1 -0
- package/dist/public/assets/{EditorTabClose-fAutR9L2.js → EditorTabClose-DH-LS9Zv.js} +1 -1
- package/dist/public/assets/LazyTerminal-SW0c7j8t.js +2 -0
- package/dist/public/assets/{ModelRefcount-MJz59mka.js → ModelRefcount-BO6Mp87O.js} +1 -1
- package/dist/public/assets/{PaneEditorBody-DGqg_4uR.js → PaneEditorBody-_zHVXavR.js} +2 -2
- package/dist/public/assets/SettingsDialog-DvUCRTKI.js +1 -0
- package/dist/public/assets/Terminal-MrMvzcuc.js +117 -0
- package/dist/public/assets/Workspace-CNchP0lE.js +7 -0
- package/dist/public/assets/{buffer-store-bK5Xpj6d.js → buffer-store-5mtYW1Xq.js} +2 -2
- package/dist/public/assets/context-menu-7ErbVngu.js +1 -0
- package/dist/public/assets/{cssMode-DfLbNQ92.js → cssMode-DgxyyatT.js} +1 -1
- package/dist/public/assets/editor-context-CJ-O2xj0.js +1 -0
- package/dist/public/assets/{editor-sync-Cc36ZLyi.js → editor-sync-CCVhpCCj.js} +1 -1
- package/dist/public/assets/hotkeys-BJ9IivRE.js +73 -0
- package/dist/public/assets/{htmlMode-Decw-wtn.js → htmlMode-CsnCJ5rN.js} +1 -1
- package/dist/public/assets/index-D9bGlq8g.js +10 -0
- package/dist/public/assets/{jsonMode-vNCk8wN_.js → jsonMode-Bm5_kMyH.js} +1 -1
- package/dist/public/assets/session-seed-CXqY3vWw.js +1 -0
- package/dist/public/assets/ssh-mode-nM399PS5.js +1 -0
- package/dist/public/assets/{tsMode-XcRZTbul.js → tsMode-D76dymM5.js} +1 -1
- package/dist/public/index.html +3 -4
- package/package.json +1 -1
- package/dist/public/assets/Dashboard-CaIw594e.js +0 -1
- package/dist/public/assets/LazyTerminal-Cv4MivyB.js +0 -2
- package/dist/public/assets/SettingsDialog-Ck6AFRjw.js +0 -1
- package/dist/public/assets/Terminal-BtsgoMqj.js +0 -117
- package/dist/public/assets/Workspace-BaIcmmwi.js +0 -7
- package/dist/public/assets/api-BJeOJuGe.js +0 -73
- package/dist/public/assets/context-menu-CLWmCX87.js +0 -1
- package/dist/public/assets/editor-context-Cz5G4UVr.js +0 -1
- package/dist/public/assets/hotkeys-BrRVXikm.js +0 -1
- package/dist/public/assets/index-IEQHp8h9.js +0 -10
- package/dist/public/assets/session-seed-mKf0bRzJ.js +0 -1
- package/dist/public/assets/ssh-mode-DFHbi7WV.js +0 -1
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n}from"./jsx-runtime-ffCh33zF.js";var r=e(t(),1),i=e(n(),1);function a(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var o=e=>{switch(e){case`success`:return l;case`info`:return d;case`warning`:return u;case`error`:return f;default:return null}},s=Array(12).fill(0),c=({visible:e,className:t})=>r.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},r.createElement(`div`,{className:`sonner-spinner`},s.map((e,t)=>r.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),l=r.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},r.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),u=r.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},r.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),d=r.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},r.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),f=r.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},r.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),p=r.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},r.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),r.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),ee=()=>{let[e,t]=r.useState(document.hidden);return r.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},te=1,m=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:te++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0||e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let i=Promise.resolve(e instanceof Function?e():e),a=n!==void 0,o,s=i.then(async e=>{if(o=[`resolve`,e],r.isValidElement(e))a=!1,this.create({id:n,type:`default`,message:e});else if(re(e)&&!e.ok){a=!1;let i=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,o=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,s=typeof i==`object`&&!r.isValidElement(i)?i:{message:i};this.create({id:n,type:`error`,description:o,...s})}else if(e instanceof Error){a=!1;let i=typeof t.error==`function`?await t.error(e):t.error,o=typeof t.description==`function`?await t.description(e):t.description,s=typeof i==`object`&&!r.isValidElement(i)?i:{message:i};this.create({id:n,type:`error`,description:o,...s})}else if(t.success!==void 0){a=!1;let i=typeof t.success==`function`?await t.success(e):t.success,o=typeof t.description==`function`?await t.description(e):t.description,s=typeof i==`object`&&!r.isValidElement(i)?i:{message:i};this.create({id:n,type:`success`,description:o,...s})}}).catch(async e=>{if(o=[`reject`,e],t.error!==void 0){a=!1;let i=typeof t.error==`function`?await t.error(e):t.error,o=typeof t.description==`function`?await t.description(e):t.description,s=typeof i==`object`&&!r.isValidElement(i)?i:{message:i};this.create({id:n,type:`error`,description:o,...s})}}).finally(()=>{a&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),c=()=>new Promise((e,t)=>s.then(()=>o[0]===`reject`?t(o[1]):e(o[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(e,t)=>{let n=t?.id||te++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},ne=(e,t)=>{let n=t?.id||te++;return m.addToast({title:e,...t,id:n}),n},re=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,h=Object.assign(ne,{success:m.success,info:m.info,warning:m.warning,error:m.error,custom:m.custom,message:m.message,promise:m.promise,dismiss:m.dismiss,loading:m.loading},{getHistory:()=>m.toasts,getToasts:()=>m.getActiveToasts()});a(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function ie(e){return e.label!==void 0}var ae=3,oe=`24px`,se=`16px`,ce=4e3,le=356,ue=14,de=45,fe=200;function g(...e){return e.filter(Boolean).join(` `)}function pe(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var me=e=>{let{invert:t,toast:n,unstyled:i,interacting:a,setHeights:s,visibleToasts:l,heights:u,index:d,toasts:f,expanded:te,removeToast:m,defaultRichColors:ne,closeButton:re,style:h,cancelButtonStyle:ae,actionButtonStyle:oe,className:se=``,descriptionClassName:le=``,duration:ue,position:me,gap:he,expandByDefault:ge,classNames:_,icons:v,closeButtonAriaLabel:_e=`Close toast`}=e,[y,ve]=r.useState(null),[ye,b]=r.useState(null),[x,S]=r.useState(!1),[be,C]=r.useState(!1),[xe,Se]=r.useState(!1),[Ce,we]=r.useState(!1),[Te,Ee]=r.useState(!1),[De,w]=r.useState(0),[Oe,T]=r.useState(0),ke=r.useRef(n.duration||ue||ce),Ae=r.useRef(null),E=r.useRef(null),je=d===0,Me=d+1<=l,D=n.type,O=n.dismissible!==!1,Ne=n.className||``,Pe=n.descriptionClassName||``,k=r.useMemo(()=>u.findIndex(e=>e.toastId===n.id)||0,[u,n.id]),A=r.useMemo(()=>n.closeButton??re,[n.closeButton,re]),Fe=r.useMemo(()=>n.duration||ue||ce,[n.duration,ue]),Ie=r.useRef(0),Le=r.useRef(0),Re=r.useRef(0),ze=r.useRef(null),[Be,Ve]=me.split(`-`),He=r.useMemo(()=>u.reduce((e,t,n)=>n>=k?e:e+t.height,0),[u,k]),Ue=ee(),We=n.invert||t,Ge=D===`loading`;Le.current=r.useMemo(()=>k*he+He,[k,He]),r.useEffect(()=>{ke.current=Fe},[Fe]),r.useEffect(()=>{S(!0)},[]),r.useEffect(()=>{let e=E.current;if(e){let t=e.getBoundingClientRect().height;return T(t),s(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>s(e=>e.filter(e=>e.toastId!==n.id))}},[s,n.id]),r.useLayoutEffect(()=>{if(!x)return;let e=E.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,T(r),s(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[x,n.title,n.description,s,n.id,n.jsx,n.action,n.cancel]);let j=r.useCallback(()=>{C(!0),w(Le.current),s(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{m(n)},fe)},[n,m,s,Le]);r.useEffect(()=>{if(n.promise&&D===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return te||a||Ue?(()=>{if(Re.current<Ie.current){let e=new Date().getTime()-Ie.current;ke.current-=e}Re.current=new Date().getTime()})():ke.current!==1/0&&(Ie.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),j()},ke.current)),()=>clearTimeout(e)},[te,a,n,D,Ue,j]),r.useEffect(()=>{n.delete&&(j(),n.onDismiss==null||n.onDismiss.call(n,n))},[j,n.delete]);function Ke(){return v?.loading?r.createElement(`div`,{className:g(_?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":D===`loading`},v.loading):r.createElement(c,{className:g(_?.loader,n?.classNames?.loader),visible:D===`loading`})}let M=n.icon||v?.[D]||o(D);return r.createElement(`li`,{tabIndex:0,ref:E,className:g(se,Ne,_?.toast,n?.classNames?.toast,_?.default,_?.[D],n?.classNames?.[D]),"data-sonner-toast":``,"data-rich-colors":n.richColors??ne,"data-styled":!(n.jsx||n.unstyled||i),"data-mounted":x,"data-promise":!!n.promise,"data-swiped":Te,"data-removed":be,"data-visible":Me,"data-y-position":Be,"data-x-position":Ve,"data-index":d,"data-front":je,"data-swiping":xe,"data-dismissible":O,"data-type":D,"data-invert":We,"data-swipe-out":Ce,"data-swipe-direction":ye,"data-expanded":!!(te||ge&&x),"data-testid":n.testId,style:{"--index":d,"--toasts-before":d,"--z-index":f.length-d,"--offset":`${be?De:Le.current}px`,"--initial-height":ge?`auto`:`${Oe}px`,...h,...n.style},onDragEnd:()=>{Se(!1),ve(null),ze.current=null},onPointerDown:e=>{e.button!==2&&(Ge||!O||(Ae.current=new Date,w(Le.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(Se(!0),ze.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(Ce||!O)return;ze.current=null;let e=Number(E.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(E.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-Ae.current?.getTime(),i=y===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=de||a>.11){w(Le.current),n.onDismiss==null||n.onDismiss.call(n,n),b(y===`x`?e>0?`right`:`left`:t>0?`down`:`up`),j(),we(!0);return}else{var o,s;(o=E.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=E.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}Ee(!1),Se(!1),ve(null)},onPointerMove:t=>{var n,r;if(!ze.current||!O||window.getSelection()?.toString().length>0)return;let i=t.clientY-ze.current.y,a=t.clientX-ze.current.x,o=e.swipeDirections??pe(me);!y&&(Math.abs(a)>1||Math.abs(i)>1)&&ve(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(y===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(y===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&Ee(!0),(n=E.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=E.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},A&&!n.jsx&&D!==`loading`?r.createElement(`button`,{"aria-label":_e,"data-disabled":Ge,"data-close-button":!0,onClick:Ge||!O?()=>{}:()=>{j(),n.onDismiss==null||n.onDismiss.call(n,n)},className:g(_?.closeButton,n?.classNames?.closeButton)},v?.close??p):null,(D||n.icon||n.promise)&&n.icon!==null&&(v?.[D]!==null||n.icon)?r.createElement(`div`,{"data-icon":``,className:g(_?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Ke():null,n.type===`loading`?null:M):null,r.createElement(`div`,{"data-content":``,className:g(_?.content,n?.classNames?.content)},r.createElement(`div`,{"data-title":``,className:g(_?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?r.createElement(`div`,{"data-description":``,className:g(le,Pe,_?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),r.isValidElement(n.cancel)?n.cancel:n.cancel&&ie(n.cancel)?r.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||ae,onClick:e=>{ie(n.cancel)&&O&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),j())},className:g(_?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,r.isValidElement(n.action)?n.action:n.action&&ie(n.action)?r.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||oe,onClick:e=>{ie(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&j())},className:g(_?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function he(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function ge(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?se:oe;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var _=r.forwardRef(function(e,t){let{id:n,invert:a,position:o=`bottom-right`,hotkey:s=[`altKey`,`KeyT`],expand:c,closeButton:l,className:u,offset:d,mobileOffset:f,theme:p=`light`,richColors:ee,duration:te,style:ne,visibleToasts:re=ae,toastOptions:h,dir:ie=he(),gap:oe=ue,icons:se,containerAriaLabel:ce=`Notifications`}=e,[de,fe]=r.useState([]),g=r.useMemo(()=>n?de.filter(e=>e.toasterId===n):de.filter(e=>!e.toasterId),[de,n]),pe=r.useMemo(()=>Array.from(new Set([o].concat(g.filter(e=>e.position).map(e=>e.position)))),[g,o]),[_,v]=r.useState([]),[_e,y]=r.useState(!1),[ve,ye]=r.useState(!1),[b,x]=r.useState(p===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:p),S=r.useRef(null),be=s.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),C=r.useRef(null),xe=r.useRef(!1),Se=r.useCallback(e=>{fe(t=>(t.find(t=>t.id===e.id)?.delete||m.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return r.useEffect(()=>m.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{fe(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{i.flushSync(()=>{fe(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[de]),r.useEffect(()=>{if(p!==`system`){x(p);return}if(p===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?x(`dark`):x(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{x(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{x(e?`dark`:`light`)}catch(e){console.error(e)}})}},[p]),r.useEffect(()=>{de.length<=1&&y(!1)},[de]),r.useEffect(()=>{let e=e=>{if(s.every(t=>e[t]||e.code===t)){var t;y(!0),(t=S.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===S.current||S.current?.contains(document.activeElement))&&y(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[s]),r.useEffect(()=>{if(S.current)return()=>{C.current&&(C.current.focus({preventScroll:!0}),C.current=null,xe.current=!1)}},[S.current]),r.createElement(`section`,{ref:t,"aria-label":`${ce} ${be}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},pe.map((t,n)=>{let[i,o]=t.split(`-`);return g.length?r.createElement(`ol`,{key:t,dir:ie===`auto`?he():ie,tabIndex:-1,ref:S,className:u,"data-sonner-toaster":!0,"data-sonner-theme":b,"data-y-position":i,"data-x-position":o,style:{"--front-toast-height":`${_[0]?.height||0}px`,"--width":`${le}px`,"--gap":`${oe}px`,...ne,...ge(d,f)},onBlur:e=>{xe.current&&!e.currentTarget.contains(e.relatedTarget)&&(xe.current=!1,C.current&&=(C.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||xe.current||(xe.current=!0,C.current=e.relatedTarget)},onMouseEnter:()=>y(!0),onMouseMove:()=>y(!0),onMouseLeave:()=>{ve||y(!1)},onDragEnd:()=>y(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||ye(!0)},onPointerUp:()=>ye(!1)},g.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>r.createElement(me,{key:n.id,icons:se,index:i,toast:n,defaultRichColors:ee,duration:h?.duration??te,className:h?.className,descriptionClassName:h?.descriptionClassName,invert:a,visibleToasts:re,closeButton:h?.closeButton??l,interacting:ve,position:t,style:h?.style,unstyled:h?.unstyled,classNames:h?.classNames,cancelButtonStyle:h?.cancelButtonStyle,actionButtonStyle:h?.actionButtonStyle,closeButtonAriaLabel:h?.closeButtonAriaLabel,removeToast:Se,toasts:g.filter(e=>e.position==n.position),heights:_.filter(e=>e.position==n.position),setHeights:v,expandByDefault:c,gap:oe,expanded:_e,swipeDirections:e.swipeDirections}))):null}))});function v(e){let t=new Set;return{get:()=>localStorage.getItem(e),set(n){n===null?localStorage.removeItem(e):localStorage.setItem(e,n);for(let e of t)e()},subscribe(e){return t.add(e),()=>t.delete(e)}}}var _e=v(`puddle.token`);function y(){let e=/[#&]token=([0-9a-fA-F]+)/.exec(window.location.hash);if(!e)return;_e.set(e[1]);let t=new URL(window.location.href);t.hash=``,history.replaceState(null,``,t)}function ve(){_e.set(null)}var ye;function b(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var x=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},S=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ye=globalThis).__zod_globalConfig??(ye.__zod_globalConfig={});var be=globalThis.__zod_globalConfig;function C(e){return e&&Object.assign(be,e),be}function xe(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Se(e,t){return typeof t==`bigint`?t.toString():t}function Ce(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function we(e){return e==null}function Te(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ee(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var De=Symbol(`evaluating`);function w(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==De)return r===void 0&&(r=De,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Oe(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function T(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ke(e){return JSON.stringify(e)}function Ae(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var E=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function je(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Me=Ce(()=>{if(be.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function D(e){if(je(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(je(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function O(e){return D(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Ne=new Set([`string`,`number`,`symbol`]);function Pe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function k(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function A(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Fe(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Ie={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Le(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return k(e,T(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Oe(this,`shape`,e),e},checks:[]}))}function Re(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return k(e,T(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Oe(this,`shape`,r),r},checks:[]}))}function ze(e,t){if(!D(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return k(e,T(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Oe(this,`shape`,n),n}}))}function Be(e,t){if(!D(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return k(e,T(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Oe(this,`shape`,n),n}}))}function Ve(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return k(e,T(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Oe(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function He(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return k(t,T(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Oe(this,`shape`,i),i},checks:[]}))}function Ue(e,t,n){return k(t,T(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Oe(this,`shape`,i),i}}))}function We(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ge(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function j(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ke(e){return typeof e==`string`?e:e?.message}function M(e,t,n){let r=e.message?e.message:Ke(e.inst?._zod.def?.error?.(e))??Ke(t?.error?.(e))??Ke(n.customError?.(e))??Ke(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function qe(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Je(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ye=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Se,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Xe=b(`$ZodError`,Ye),Ze=b(`$ZodError`,Ye,{Parent:Error});function Qe(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function $e(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var et=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new x;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>M(e,a,C())));throw E(t,i?.callee),t}return o.value},tt=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>M(e,a,C())));throw E(t,i?.callee),t}return o.value},nt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new x;return a.issues.length?{success:!1,error:new(e??Xe)(a.issues.map(e=>M(e,i,C())))}:{success:!0,data:a.value}},rt=nt(Ze),it=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>M(e,i,C())))}:{success:!0,data:a.value}},at=it(Ze),ot=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return et(e)(t,n,i)},st=e=>(t,n,r)=>et(e)(t,n,r),ct=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return tt(e)(t,n,i)},lt=e=>async(t,n,r)=>tt(e)(t,n,r),ut=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return nt(e)(t,n,i)},dt=e=>(t,n,r)=>nt(e)(t,n,r),ft=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return it(e)(t,n,i)},pt=e=>async(t,n,r)=>it(e)(t,n,r),mt=/^[cC][0-9a-z]{6,}$/,ht=/^[0-9a-z]+$/,gt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,_t=/^[0-9a-vA-V]{20}$/,vt=/^[A-Za-z0-9]{27}$/,yt=/^[a-zA-Z0-9_-]{21}$/,bt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,xt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,St=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ct=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,wt=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Tt(){return new RegExp(wt,`u`)}var Et=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Dt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ot=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,kt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,At=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,jt=/^[A-Za-z0-9_-]*$/,Mt=/^https?$/,Nt=/^\+[1-9]\d{6,14}$/,Pt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Ft=RegExp(`^${Pt}$`);function It(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Lt(e){return RegExp(`^${It(e)}$`)}function Rt(e){let t=It({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Pt}T(?:${r})$`)}var zt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Bt=/^-?\d+$/,Vt=/^-?\d+(?:\.\d+)?$/,Ht=/^(?:true|false)$/i,Ut=/^[^A-Z]*$/,Wt=/^[^a-z]*$/,N=b(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Gt={number:`number`,bigint:`bigint`,object:`date`},Kt=b(`$ZodCheckLessThan`,(e,t)=>{N.init(e,t);let n=Gt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qt=b(`$ZodCheckGreaterThan`,(e,t)=>{N.init(e,t);let n=Gt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jt=b(`$ZodCheckMultipleOf`,(e,t)=>{N.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Ee(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Yt=b(`$ZodCheckNumberFormat`,(e,t)=>{N.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ie[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Bt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Xt=b(`$ZodCheckMaxLength`,(e,t)=>{var n;N.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!we(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=qe(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Zt=b(`$ZodCheckMinLength`,(e,t)=>{var n;N.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!we(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=qe(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Qt=b(`$ZodCheckLengthEquals`,(e,t)=>{var n;N.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!we(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=qe(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),$t=b(`$ZodCheckStringFormat`,(e,t)=>{var n,r;N.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),en=b(`$ZodCheckRegex`,(e,t)=>{$t.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),tn=b(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ut,$t.init(e,t)}),nn=b(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Wt,$t.init(e,t)}),rn=b(`$ZodCheckIncludes`,(e,t)=>{N.init(e,t);let n=Pe(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),an=b(`$ZodCheckStartsWith`,(e,t)=>{N.init(e,t);let n=RegExp(`^${Pe(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),on=b(`$ZodCheckEndsWith`,(e,t)=>{N.init(e,t);let n=RegExp(`.*${Pe(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),sn=b(`$ZodCheckOverwrite`,(e,t)=>{N.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),cn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
2
|
-
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
3
|
-
`))}},ln={major:4,minor:4,patch:3},P=b(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ln;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=We(e),i;for(let a of t){if(a._zod.def.when){if(Ge(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new x;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=We(e,t))});else{if(e.issues.length===t)continue;r||=We(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(We(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new x;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new x;return o.then(e=>t(e,r,a))}return t(o,r,a)}}w(e,`~standard`,()=>({validate:t=>{try{let n=rt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return at(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),un=b(`$ZodString`,(e,t)=>{P.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??zt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),F=b(`$ZodStringFormat`,(e,t)=>{$t.init(e,t),un.init(e,t)}),dn=b(`$ZodGUID`,(e,t)=>{t.pattern??=xt,F.init(e,t)}),fn=b(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=St(e)}else t.pattern??=St();F.init(e,t)}),pn=b(`$ZodEmail`,(e,t)=>{t.pattern??=Ct,F.init(e,t)}),mn=b(`$ZodURL`,(e,t)=>{F.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Mt.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),hn=b(`$ZodEmoji`,(e,t)=>{t.pattern??=Tt(),F.init(e,t)}),gn=b(`$ZodNanoID`,(e,t)=>{t.pattern??=yt,F.init(e,t)}),_n=b(`$ZodCUID`,(e,t)=>{t.pattern??=mt,F.init(e,t)}),vn=b(`$ZodCUID2`,(e,t)=>{t.pattern??=ht,F.init(e,t)}),yn=b(`$ZodULID`,(e,t)=>{t.pattern??=gt,F.init(e,t)}),bn=b(`$ZodXID`,(e,t)=>{t.pattern??=_t,F.init(e,t)}),xn=b(`$ZodKSUID`,(e,t)=>{t.pattern??=vt,F.init(e,t)}),Sn=b(`$ZodISODateTime`,(e,t)=>{t.pattern??=Rt(t),F.init(e,t)}),Cn=b(`$ZodISODate`,(e,t)=>{t.pattern??=Ft,F.init(e,t)}),wn=b(`$ZodISOTime`,(e,t)=>{t.pattern??=Lt(t),F.init(e,t)}),Tn=b(`$ZodISODuration`,(e,t)=>{t.pattern??=bt,F.init(e,t)}),En=b(`$ZodIPv4`,(e,t)=>{t.pattern??=Et,F.init(e,t),e._zod.bag.format=`ipv4`}),Dn=b(`$ZodIPv6`,(e,t)=>{t.pattern??=Dt,F.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),On=b(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Ot,F.init(e,t)}),kn=b(`$ZodCIDRv6`,(e,t)=>{t.pattern??=kt,F.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function An(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var jn=b(`$ZodBase64`,(e,t)=>{t.pattern??=At,F.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{An(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Mn(e){if(!jt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return An(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Nn=b(`$ZodBase64URL`,(e,t)=>{t.pattern??=jt,F.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Mn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Pn=b(`$ZodE164`,(e,t)=>{t.pattern??=Nt,F.init(e,t)});function Fn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var In=b(`$ZodJWT`,(e,t)=>{F.init(e,t),e._zod.check=n=>{Fn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Ln=b(`$ZodNumber`,(e,t)=>{P.init(e,t),e._zod.pattern=e._zod.bag.pattern??Vt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Rn=b(`$ZodNumberFormat`,(e,t)=>{Yt.init(e,t),Ln.init(e,t)}),zn=b(`$ZodBoolean`,(e,t)=>{P.init(e,t),e._zod.pattern=Ht,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Bn=b(`$ZodUnknown`,(e,t)=>{P.init(e,t),e._zod.parse=e=>e}),Vn=b(`$ZodNever`,(e,t)=>{P.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Hn(e,t,n){e.issues.length&&t.issues.push(...j(n,e.issues)),t.value[n]=e.value}var Un=b(`$ZodArray`,(e,t)=>{P.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Hn(t,n,e))):Hn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Wn(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...j(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Gn(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Fe(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Kn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Wn(e,n,i,t,u,d))):Wn(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var qn=b(`$ZodObject`,(e,t)=>{if(P.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=Ce(()=>Gn(t));w(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=je,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Wn(n,t,e,s,r,i))):Wn(a,t,e,s,r,i)}return i?Kn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Jn=b(`$ZodObjectJIT`,(e,t)=>{qn.init(e,t);let n=e._zod.parse,r=Ce(()=>Gn(t)),i=e=>{let t=new cn([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=ke(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=ke(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
4
|
-
if (${n}.issues.length) {
|
|
5
|
-
if (${o} in input) {
|
|
6
|
-
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
7
|
-
...iss,
|
|
8
|
-
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
9
|
-
})));
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (${n}.value === undefined) {
|
|
14
|
-
if (${o} in input) {
|
|
15
|
-
newResult[${o}] = undefined;
|
|
16
|
-
}
|
|
17
|
-
} else {
|
|
18
|
-
newResult[${o}] = ${n}.value;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
`):c?t.write(`
|
|
22
|
-
if (${n}.issues.length) {
|
|
23
|
-
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
24
|
-
...iss,
|
|
25
|
-
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
26
|
-
})));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (${n}.value === undefined) {
|
|
30
|
-
if (${o} in input) {
|
|
31
|
-
newResult[${o}] = undefined;
|
|
32
|
-
}
|
|
33
|
-
} else {
|
|
34
|
-
newResult[${o}] = ${n}.value;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
`):t.write(`
|
|
38
|
-
const ${n}_present = ${o} in input;
|
|
39
|
-
if (${n}.issues.length) {
|
|
40
|
-
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
41
|
-
...iss,
|
|
42
|
-
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
43
|
-
})));
|
|
44
|
-
}
|
|
45
|
-
if (!${n}_present && !${n}.issues.length) {
|
|
46
|
-
payload.issues.push({
|
|
47
|
-
code: "invalid_type",
|
|
48
|
-
expected: "nonoptional",
|
|
49
|
-
input: undefined,
|
|
50
|
-
path: [${o}]
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (${n}_present) {
|
|
55
|
-
if (${n}.value === undefined) {
|
|
56
|
-
newResult[${o}] = undefined;
|
|
57
|
-
} else {
|
|
58
|
-
newResult[${o}] = ${n}.value;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=je,s=!be.jitless,c=s&&Me.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Kn([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Yn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!We(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>M(e,r,C())))}),t)}var Xn=b(`$ZodUnion`,(e,t)=>{P.init(e,t),w(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),w(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),w(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),w(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Te(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Yn(t,r,e,i)):Yn(o,r,e,i)}}),Zn=b(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Xn.init(e,t);let n=e._zod.parse;w(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Ce(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!je(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Qn=b(`$ZodIntersection`,(e,t)=>{P.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>er(e,t,n)):er(e,i,a)}});function $n(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(D(e)&&D(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=$n(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=$n(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function er(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),We(e))return e;let o=$n(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var tr=b(`$ZodRecord`,(e,t)=>{P.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!D(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>M(e,r,C())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...j(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...j(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Vt.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>M(e,r,C())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...j(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...j(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),nr=b(`$ZodEnum`,(e,t)=>{P.init(e,t);let n=xe(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Ne.has(typeof e)).map(e=>typeof e==`string`?Pe(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),rr=b(`$ZodLiteral`,(e,t)=>{if(P.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Pe(e):e?Pe(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),ir=b(`$ZodTransform`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new S(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new x;return n.value=i,n.fallback=!0,n}});function ar(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var or=b(`$ZodOptional`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,w(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),w(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Te(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>ar(e,r)):ar(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),sr=b(`$ZodExactOptional`,(e,t)=>{or.init(e,t),w(e._zod,`values`,()=>t.innerType._zod.values),w(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),cr=b(`$ZodNullable`,(e,t)=>{P.init(e,t),w(e._zod,`optin`,()=>t.innerType._zod.optin),w(e._zod,`optout`,()=>t.innerType._zod.optout),w(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Te(e.source)}|null)$`):void 0}),w(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),lr=b(`$ZodDefault`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,w(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>ur(e,t)):ur(r,t)}});function ur(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var dr=b(`$ZodPrefault`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,w(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),fr=b(`$ZodNonOptional`,(e,t)=>{P.init(e,t),w(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>pr(t,e)):pr(i,e)}});function pr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var mr=b(`$ZodCatch`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,w(e._zod,`optout`,()=>t.innerType._zod.optout),w(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>M(e,n,C()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>M(e,n,C()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),hr=b(`$ZodPipe`,(e,t)=>{P.init(e,t),w(e._zod,`values`,()=>t.in._zod.values),w(e._zod,`optin`,()=>t.in._zod.optin),w(e._zod,`optout`,()=>t.out._zod.optout),w(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>gr(e,t.in,n)):gr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>gr(e,t.out,n)):gr(r,t.out,n)}});function gr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var _r=b(`$ZodReadonly`,(e,t)=>{P.init(e,t),w(e._zod,`propValues`,()=>t.innerType._zod.propValues),w(e._zod,`values`,()=>t.innerType._zod.values),w(e._zod,`optin`,()=>t.innerType?._zod?.optin),w(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(vr):vr(r)}});function vr(e){return e.value=Object.freeze(e.value),e}var yr=b(`$ZodLazy`,(e,t)=>{P.init(e,t),w(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),w(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),w(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),w(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),w(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),br=b(`$ZodCustom`,(e,t)=>{N.init(e,t),P.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>xr(t,n,r,e));xr(i,n,r,e)}});function xr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Je(e))}}var Sr,Cr=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function wr(){return new Cr}(Sr=globalThis).__zod_globalRegistry??(Sr.__zod_globalRegistry=wr());var Tr=globalThis.__zod_globalRegistry;function Er(e,t){return new e({type:`string`,...A(t)})}function Dr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...A(t)})}function Or(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...A(t)})}function kr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...A(t)})}function Ar(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...A(t)})}function jr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...A(t)})}function Mr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...A(t)})}function Nr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...A(t)})}function Pr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...A(t)})}function Fr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...A(t)})}function Ir(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...A(t)})}function Lr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...A(t)})}function Rr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...A(t)})}function zr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...A(t)})}function Br(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...A(t)})}function Vr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...A(t)})}function Hr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...A(t)})}function Ur(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...A(t)})}function Wr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...A(t)})}function Gr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...A(t)})}function Kr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...A(t)})}function qr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...A(t)})}function Jr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...A(t)})}function Yr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...A(t)})}function Xr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...A(t)})}function Zr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...A(t)})}function Qr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...A(t)})}function $r(e,t){return new e({type:`number`,checks:[],...A(t)})}function ei(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...A(t)})}function ti(e,t){return new e({type:`boolean`,...A(t)})}function ni(e){return new e({type:`unknown`})}function ri(e,t){return new e({type:`never`,...A(t)})}function ii(e,t){return new Kt({check:`less_than`,...A(t),value:e,inclusive:!1})}function ai(e,t){return new Kt({check:`less_than`,...A(t),value:e,inclusive:!0})}function oi(e,t){return new qt({check:`greater_than`,...A(t),value:e,inclusive:!1})}function si(e,t){return new qt({check:`greater_than`,...A(t),value:e,inclusive:!0})}function ci(e,t){return new Jt({check:`multiple_of`,...A(t),value:e})}function li(e,t){return new Xt({check:`max_length`,...A(t),maximum:e})}function ui(e,t){return new Zt({check:`min_length`,...A(t),minimum:e})}function di(e,t){return new Qt({check:`length_equals`,...A(t),length:e})}function fi(e,t){return new en({check:`string_format`,format:`regex`,...A(t),pattern:e})}function pi(e){return new tn({check:`string_format`,format:`lowercase`,...A(e)})}function mi(e){return new nn({check:`string_format`,format:`uppercase`,...A(e)})}function hi(e,t){return new rn({check:`string_format`,format:`includes`,...A(t),includes:e})}function gi(e,t){return new an({check:`string_format`,format:`starts_with`,...A(t),prefix:e})}function _i(e,t){return new on({check:`string_format`,format:`ends_with`,...A(t),suffix:e})}function vi(e){return new sn({check:`overwrite`,tx:e})}function yi(e){return vi(t=>t.normalize(e))}function bi(){return vi(e=>e.trim())}function xi(){return vi(e=>e.toLowerCase())}function Si(){return vi(e=>e.toUpperCase())}function Ci(){return vi(e=>Ae(e))}function wi(e,t,n){return new e({type:`array`,element:t,...A(n)})}function Ti(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...A(n)})}function Ei(e,t){let n=Di(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Je(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Je(r))}},e(t.value,t)),t);return n}function Di(e,t){let n=new N({check:`custom`,...A(t)});return n._zod.check=e,n}function Oi(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Tr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function I(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,I(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&L(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ki(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
63
|
-
|
|
64
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Ai(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Mi(t,`input`,e.processors),output:Mi(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function L(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return L(r.element,n);if(r.type===`set`)return L(r.valueType,n);if(r.type===`lazy`)return L(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return L(r.innerType,n);if(r.type===`intersection`)return L(r.left,n)||L(r.right,n);if(r.type===`record`||r.type===`map`)return L(r.keyType,n)||L(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:L(r.in,n)||L(r.out,n);if(r.type===`object`){for(let e in r.shape)if(L(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(L(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(L(e,n))return!0;return!!(r.rest&&L(r.rest,n))}return!1}var ji=(e,t={})=>n=>{let r=Oi({...n,processors:t});return I(e,r),ki(r,e),Ai(r,e)},Mi=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Oi({...i??{},target:a,io:t,processors:n});return I(e,o),ki(o,e),Ai(o,e)},Ni={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Pi=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ni[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Fi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Ii=(e,t,n,r)=>{n.type=`boolean`},Li=(e,t,n,r)=>{n.not={}},Ri=(e,t,n,r)=>{let i=e._zod.def,a=xe(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},zi=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Bi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Vi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Hi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=I(a.element,t,{...r,path:[...r.path,`items`]})},Ui=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=I(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=I(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Wi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>I(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Gi=(e,t,n,r)=>{let i=e._zod.def,a=I(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=I(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ki=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=I(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=I(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=I(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},qi=(e,t,n,r)=>{let i=e._zod.def,a=I(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ji=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Yi=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Xi=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Zi=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Qi=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;I(o,t,r);let s=t.seen.get(e);s.ref=o},$i=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ea=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ta=(e,t,n,r)=>{let i=e._zod.innerType;I(i,t,r);let a=t.seen.get(e);a.ref=i},na=b(`ZodISODateTime`,(e,t)=>{Sn.init(e,t),V.init(e,t)});function ra(e){return Yr(na,e)}var ia=b(`ZodISODate`,(e,t)=>{Cn.init(e,t),V.init(e,t)});function aa(e){return Xr(ia,e)}var oa=b(`ZodISOTime`,(e,t)=>{wn.init(e,t),V.init(e,t)});function sa(e){return Zr(oa,e)}var ca=b(`ZodISODuration`,(e,t)=>{Tn.init(e,t),V.init(e,t)});function la(e){return Qr(ca,e)}var R=b(`ZodError`,(e,t)=>{Xe.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>$e(e,t)},flatten:{value:t=>Qe(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Se,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Se,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),ua=et(R),da=tt(R),fa=nt(R),pa=it(R),ma=ot(R),ha=st(R),ga=ct(R),_a=lt(R),va=ut(R),ya=dt(R),ba=ft(R),xa=pt(R),Sa=new WeakMap;function Ca(e,t,n){let r=Object.getPrototypeOf(e),i=Sa.get(r);if(i||(i=new Set,Sa.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var z=b(`ZodType`,(e,t)=>(P.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Mi(e,`input`),output:Mi(e,`output`)}}),e.toJSONSchema=ji(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>ua(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>fa(e,t,n),e.parseAsync=async(t,n)=>da(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>pa(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ma(e,t,n),e.decode=(t,n)=>ha(e,t,n),e.encodeAsync=async(t,n)=>ga(e,t,n),e.decodeAsync=async(t,n)=>_a(e,t,n),e.safeEncode=(t,n)=>va(e,t,n),e.safeDecode=(t,n)=>ya(e,t,n),e.safeEncodeAsync=async(t,n)=>ba(e,t,n),e.safeDecodeAsync=async(t,n)=>xa(e,t,n),Ca(e,`ZodType`,{check(...e){let t=this.def;return this.clone(T(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return k(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Lo(e,t))},superRefine(e,t){return this.check(Ro(e,t))},overwrite(e){return this.check(vi(e))},optional(){return _o(this)},exactOptional(){return yo(this)},nullable(){return xo(this)},nullish(){return _o(xo(this))},nonoptional(e){return Do(this,e)},array(){return W(this)},or(e){return io([this,e])},and(e){return co(this,e)},transform(e){return jo(this,ho(e))},default(e){return Co(this,e)},prefault(e){return To(this,e)},catch(e){return ko(this,e)},pipe(e){return jo(this,e)},readonly(){return No(this)},describe(e){let t=this.clone();return Tr.add(t,{description:e}),t},meta(...e){if(e.length===0)return Tr.get(this);let t=this.clone();return Tr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Tr.get(e)?.description},configurable:!0}),e)),wa=b(`_ZodString`,(e,t)=>{un.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Ca(e,`_ZodString`,{regex(...e){return this.check(fi(...e))},includes(...e){return this.check(hi(...e))},startsWith(...e){return this.check(gi(...e))},endsWith(...e){return this.check(_i(...e))},min(...e){return this.check(ui(...e))},max(...e){return this.check(li(...e))},length(...e){return this.check(di(...e))},nonempty(...e){return this.check(ui(1,...e))},lowercase(e){return this.check(pi(e))},uppercase(e){return this.check(mi(e))},trim(){return this.check(bi())},normalize(...e){return this.check(yi(...e))},toLowerCase(){return this.check(xi())},toUpperCase(){return this.check(Si())},slugify(){return this.check(Ci())}})}),Ta=b(`ZodString`,(e,t)=>{un.init(e,t),wa.init(e,t),e.email=t=>e.check(Dr(Ea,t)),e.url=t=>e.check(Nr(Aa,t)),e.jwt=t=>e.check(Jr(Ga,t)),e.emoji=t=>e.check(Pr(ja,t)),e.guid=t=>e.check(Or(Da,t)),e.uuid=t=>e.check(kr(Oa,t)),e.uuidv4=t=>e.check(Ar(Oa,t)),e.uuidv6=t=>e.check(jr(Oa,t)),e.uuidv7=t=>e.check(Mr(Oa,t)),e.nanoid=t=>e.check(Fr(Ma,t)),e.guid=t=>e.check(Or(Da,t)),e.cuid=t=>e.check(Ir(Na,t)),e.cuid2=t=>e.check(Lr(Pa,t)),e.ulid=t=>e.check(Rr(Fa,t)),e.base64=t=>e.check(Gr(Ha,t)),e.base64url=t=>e.check(Kr(Ua,t)),e.xid=t=>e.check(zr(Ia,t)),e.ksuid=t=>e.check(Br(La,t)),e.ipv4=t=>e.check(Vr(Ra,t)),e.ipv6=t=>e.check(Hr(za,t)),e.cidrv4=t=>e.check(Ur(Ba,t)),e.cidrv6=t=>e.check(Wr(Va,t)),e.e164=t=>e.check(qr(Wa,t)),e.datetime=t=>e.check(ra(t)),e.date=t=>e.check(aa(t)),e.time=t=>e.check(sa(t)),e.duration=t=>e.check(la(t))});function B(e){return Er(Ta,e)}var V=b(`ZodStringFormat`,(e,t)=>{F.init(e,t),wa.init(e,t)}),Ea=b(`ZodEmail`,(e,t)=>{pn.init(e,t),V.init(e,t)}),Da=b(`ZodGUID`,(e,t)=>{dn.init(e,t),V.init(e,t)}),Oa=b(`ZodUUID`,(e,t)=>{fn.init(e,t),V.init(e,t)});function ka(e){return kr(Oa,e)}var Aa=b(`ZodURL`,(e,t)=>{mn.init(e,t),V.init(e,t)}),ja=b(`ZodEmoji`,(e,t)=>{hn.init(e,t),V.init(e,t)}),Ma=b(`ZodNanoID`,(e,t)=>{gn.init(e,t),V.init(e,t)}),Na=b(`ZodCUID`,(e,t)=>{_n.init(e,t),V.init(e,t)}),Pa=b(`ZodCUID2`,(e,t)=>{vn.init(e,t),V.init(e,t)}),Fa=b(`ZodULID`,(e,t)=>{yn.init(e,t),V.init(e,t)}),Ia=b(`ZodXID`,(e,t)=>{bn.init(e,t),V.init(e,t)}),La=b(`ZodKSUID`,(e,t)=>{xn.init(e,t),V.init(e,t)}),Ra=b(`ZodIPv4`,(e,t)=>{En.init(e,t),V.init(e,t)}),za=b(`ZodIPv6`,(e,t)=>{Dn.init(e,t),V.init(e,t)}),Ba=b(`ZodCIDRv4`,(e,t)=>{On.init(e,t),V.init(e,t)}),Va=b(`ZodCIDRv6`,(e,t)=>{kn.init(e,t),V.init(e,t)}),Ha=b(`ZodBase64`,(e,t)=>{jn.init(e,t),V.init(e,t)}),Ua=b(`ZodBase64URL`,(e,t)=>{Nn.init(e,t),V.init(e,t)}),Wa=b(`ZodE164`,(e,t)=>{Pn.init(e,t),V.init(e,t)}),Ga=b(`ZodJWT`,(e,t)=>{In.init(e,t),V.init(e,t)}),Ka=b(`ZodNumber`,(e,t)=>{Ln.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),Ca(e,`ZodNumber`,{gt(e,t){return this.check(oi(e,t))},gte(e,t){return this.check(si(e,t))},min(e,t){return this.check(si(e,t))},lt(e,t){return this.check(ii(e,t))},lte(e,t){return this.check(ai(e,t))},max(e,t){return this.check(ai(e,t))},int(e){return this.check(Ja(e))},safe(e){return this.check(Ja(e))},positive(e){return this.check(oi(0,e))},nonnegative(e){return this.check(si(0,e))},negative(e){return this.check(ii(0,e))},nonpositive(e){return this.check(ai(0,e))},multipleOf(e,t){return this.check(ci(e,t))},step(e,t){return this.check(ci(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function H(e){return $r(Ka,e)}var qa=b(`ZodNumberFormat`,(e,t)=>{Rn.init(e,t),Ka.init(e,t)});function Ja(e){return ei(qa,e)}var Ya=b(`ZodBoolean`,(e,t)=>{zn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r)});function U(e){return ti(Ya,e)}var Xa=b(`ZodUnknown`,(e,t)=>{Bn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Za(){return ni(Xa)}var Qa=b(`ZodNever`,(e,t)=>{Vn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Li(e,t,n,r)});function $a(e){return ri(Qa,e)}var eo=b(`ZodArray`,(e,t)=>{Un.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(e,t,n,r),e.element=t.element,Ca(e,`ZodArray`,{min(e,t){return this.check(ui(e,t))},nonempty(e){return this.check(ui(1,e))},max(e,t){return this.check(li(e,t))},length(e,t){return this.check(di(e,t))},unwrap(){return this.element}})});function W(e,t){return wi(eo,e,t)}var to=b(`ZodObject`,(e,t)=>{Jn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ui(e,t,n,r),w(e,`shape`,()=>t.shape),Ca(e,`ZodObject`,{keyof(){return K(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Za()})},loose(){return this.clone({...this._zod.def,catchall:Za()})},strict(){return this.clone({...this._zod.def,catchall:$a()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ze(this,e)},safeExtend(e){return Be(this,e)},merge(e){return Ve(this,e)},pick(e){return Le(this,e)},omit(e){return Re(this,e)},partial(...e){return He(go,this,e[0])},required(...e){return Ue(Eo,this,e[0])}})});function G(e,t){return new to({type:`object`,shape:e??{},...A(t)})}function no(e,t){return new to({type:`object`,shape:e,catchall:Za(),...A(t)})}var ro=b(`ZodUnion`,(e,t)=>{Xn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wi(e,t,n,r),e.options=t.options});function io(e,t){return new ro({type:`union`,options:e,...A(t)})}var ao=b(`ZodDiscriminatedUnion`,(e,t)=>{ro.init(e,t),Zn.init(e,t)});function oo(e,t,n){return new ao({type:`union`,options:t,discriminator:e,...A(n)})}var so=b(`ZodIntersection`,(e,t)=>{Qn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gi(e,t,n,r)});function co(e,t){return new so({type:`intersection`,left:e,right:t})}var lo=b(`ZodRecord`,(e,t)=>{tr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ki(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function uo(e,t,n){return!t||!t._zod?new lo({type:`record`,keyType:B(),valueType:e,...A(t)}):new lo({type:`record`,keyType:e,valueType:t,...A(n)})}var fo=b(`ZodEnum`,(e,t)=>{nr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ri(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new fo({...t,checks:[],...A(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new fo({...t,checks:[],...A(r),entries:i})}});function K(e,t){return new fo({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...A(t)})}var po=b(`ZodLiteral`,(e,t)=>{rr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function q(e,t){return new po({type:`literal`,values:Array.isArray(e)?e:[e],...A(t)})}var mo=b(`ZodTransform`,(e,t)=>{ir.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new S(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Je(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Je(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function ho(e){return new mo({type:`transform`,transform:e})}var go=b(`ZodOptional`,(e,t)=>{or.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ea(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _o(e){return new go({type:`optional`,innerType:e})}var vo=b(`ZodExactOptional`,(e,t)=>{sr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ea(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yo(e){return new vo({type:`optional`,innerType:e})}var bo=b(`ZodNullable`,(e,t)=>{cr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xo(e){return new bo({type:`nullable`,innerType:e})}var So=b(`ZodDefault`,(e,t)=>{lr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Co(e,t){return new So({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():O(t)}})}var wo=b(`ZodPrefault`,(e,t)=>{dr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function To(e,t){return new wo({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():O(t)}})}var Eo=b(`ZodNonOptional`,(e,t)=>{fr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ji(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Do(e,t){return new Eo({type:`nonoptional`,innerType:e,...A(t)})}var Oo=b(`ZodCatch`,(e,t)=>{mr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ko(e,t){return new Oo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Ao=b(`ZodPipe`,(e,t)=>{hr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qi(e,t,n,r),e.in=t.in,e.out=t.out});function jo(e,t){return new Ao({type:`pipe`,in:e,out:t})}var Mo=b(`ZodReadonly`,(e,t)=>{_r.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$i(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function No(e){return new Mo({type:`readonly`,innerType:e})}var Po=b(`ZodLazy`,(e,t)=>{yr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ta(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Fo(e){return new Po({type:`lazy`,getter:e})}var Io=b(`ZodCustom`,(e,t)=>{br.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(e,t,n,r)});function Lo(e,t={}){return Ti(Io,e,t)}function Ro(e,t){return Ei(e,t)}var zo=G({error:G({code:B(),message:B()})}),J=ra({offset:!0}),Y=H().int().positive(),X=ka(),Z=B().regex(/^[0-9a-f]{10}$/),Q=B().regex(/^[0-9a-f]{10}$/);G({version:B(),protocol:G({major:H().int().nonnegative(),minor:H().int().nonnegative()})}),G({nonce:B().min(16),state:K([`working`,`waiting_input`])});var $={port:H().int().min(1).max(65535),autoResume:U(),fetchIntervalMinutes:H().int().min(1),logMaxBytes:H().int().min(64*1024),replayBytes:H().int().min(1024),uiStateRetentionDays:H().int().min(1),agentPath:B(),displayName:B().max(64)};G({port:$.port.default(7434),autoResume:$.autoResume.default(!1),fetchIntervalMinutes:$.fetchIntervalMinutes.default(15),logMaxBytes:$.logMaxBytes.default(10*1024*1024),replayBytes:$.replayBytes.default(256*1024),uiStateRetentionDays:$.uiStateRetentionDays.default(90),agentPath:$.agentPath.default(`~/.local/bin:~/bin:/opt/homebrew/bin:/usr/local/bin`),displayName:$.displayName.default(``)}),G($).partial(),G({entries:W(G({path:B(),name:B(),is_git:U()}))}),G({username:B(),hostname:B(),home:B(),displayName:B().optional()});var Bo=B().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/,`letters, digits, dot, underscore and hyphen only`),Vo=`puddle/`,Ho=`[puddle onboarding] This is a freshly created git worktree for this task. Before starting, set up the environment:
|
|
65
|
-
|
|
66
|
-
1. Standing setup rules for this repository (user-authored):
|
|
67
|
-
{{rules}}
|
|
68
|
-
|
|
69
|
-
2. Inspect the codebase for setup requirements (README, CONTRIBUTING, lockfiles, .tool-versions, pyproject.toml, package.json, …).
|
|
70
|
-
3. Apply what the rules above settle without asking. Ask the user about anything they leave open, stating trade-offs where relevant (e.g. a symlinked .venv saves gigabytes per worktree, but parallel sessions then share mutable dependency state).
|
|
71
|
-
4. If the user states a standing rule for all future worktrees ("always…", "never…", "from now on…"), write the complete updated rules to \`.puddle/onboarding-notes.md\` in this worktree — full replacement, user-owned prose; record their decision, don't invent policy.
|
|
72
|
-
|
|
73
|
-
Then proceed with the task below (or await instructions if none is given).`,Uo=`[puddle] You are joining an existing branch and worktree that other agents may be working in concurrently. Files can change underneath you, so re-check the working tree before you act, and avoid disruptive git operations (resetting, force-pushing, or deleting the branch) that would disrupt work already in progress by others.`,Wo=`This session was interrupted (daemon or machine restart). Processes you started are gone; re-verify your environment before continuing.`,Go=[[`name`,`the resolved display name: user rename, else agent name, else sequence, else id`],[`title`,`the user rename override only (empty when unset)`],[`agentName`,`the agent's own session name (empty when the agent has not named it)`],[`sequence`,`the terminal-title name the process set (empty when it set none)`],[`branch`,`the git branch`],[`cwd`,`the worktree directory's name`],[`id`,`the first 8 characters of the session id`],[`status`,`the session status (running, waiting_input, …)`],[`agent`,`the agent type (empty for terminal sessions)`],[`separator`,`an em dash that appears only between two non-empty neighbours`]],Ko="${name}",qo=[`navy`,`gold`,`blue`,`green`,`red`,`violet`,`cyan`];G({id:Q,name:Bo,branch_prefix:B(),icon:B().nullable().default(null),icon_colour:B().nullable().default(null),created_at:J}),G({name:Bo,branch_prefix:B().max(64).optional()}),G({name:Bo.optional(),branch_prefix:B().max(64).optional(),icon:B().max(64).nullable().optional(),icon_colour:B().max(32).nullable().optional()});var Jo=no({baseBranch:B().optional(),separateBranch:U().optional(),separateWorktree:U().optional()}),Yo=no({agent:Jo.optional(),terminal:Jo.optional()});no({allowSkipPermissions:U().default(!1),captureSessionEnv:U().default(!0),onboardingTemplate:B().optional(),concurrentTemplate:B().optional(),restartTemplate:B().optional(),tabTitleTemplate:B().optional(),projectOrder:W(B()).optional(),sessionDefaults:Yo.optional(),hotkeys:uo(B(),B()).optional()}),uo(B(),Za());var Xo=B().regex(/^untitled-\d+\.md$/);G({name:Xo}),G({name:Xo,content:B(),mtime_ms:H()}),G({content:B()}),G({mtime_ms:H()}),G({id:Y,profile_id:Q,agent_type:B(),label:B(),config_dir:B(),skip_permissions_default:U(),logged_in:U(),created_at:J}),G({profile_id:Q,agent_type:B().min(1),label:Bo,skip_permissions_default:U().optional(),import_dir:B().min(1).optional()}),G({label:Bo.optional(),skip_permissions_default:U().optional()}),G({stream:B(),term:B(),hint:B().optional()}),no({account_id:Y,logged_in:U(),session_count:H().int().nonnegative(),active_session_count:H().int().nonnegative(),last_activity_at:J.nullable(),agent_usage:G({input_tokens:H().int().nonnegative(),output_tokens:H().int().nonnegative(),cache_read_input_tokens:H().int().nonnegative(),cache_creation_input_tokens:H().int().nonnegative(),message_count:H().int().nonnegative()}).nullable(),live_usage:G({captured_at:J,context_used_percentage:H().nullable(),total_cost_usd:H().nullable(),model:B().nullable()}).nullable(),subscription:G({windows:W(G({key:B(),label:B(),used_percentage:H(),resets:B().nullable()}))}).nullable()}),G({id:B(),display_name:B(),capabilities:G({resume:U(),skip_permissions:U()}),binary:B().optional(),available:U().optional()}),G({id:Y,path:B(),default_base_branch:B(),onboarding_notes:B().nullable(),fetch_enabled:U(),last_fetched_at:J.nullable()}).extend({orphan_worktrees:W(B())}),G({path:B().min(1),default_base_branch:B().min(1).optional(),onboarding_notes:B().nullable().optional(),fetch_enabled:U().optional()}),G({branches:W(G({name:B(),is_session:U(),session_title:B().nullable()}))});var Zo=G({path:B(),branch:B().nullable(),is_primary:U(),dirty:U().optional(),local_only:U().optional()}),Qo=G({name:B(),local_only:U()});G({worktrees:W(Zo),orphan_branches:W(Qo)}),G({default_base_branch:B().min(1).optional(),onboarding_notes:B().nullable().optional(),fetch_enabled:U().optional()});var $o=K([`starting`,`running`,`waiting_input`,`exited`,`interrupted`,`archived`]),es=K([`agent`,`terminal`]),ts=G({id:X,project_id:Z,account_id:Y.nullable(),worktree_path:B(),base_branch:B(),branch:B(),separate_branch:U(),kind:es,agent_type:B().nullable(),agent_session_ref:B().nullable(),title:B().nullable(),agent_title:B().nullable().optional(),osc_title:B().nullable().optional(),status:$o,cwd:B().nullable().optional(),skip_permissions:U(),created_at:J,updated_at:J,last_activity_at:J.nullable(),worktree_missing:U().optional(),stale_running:U().optional(),git_summary:G({ahead:H().int().nonnegative(),behind:H().int().nonnegative(),dirty_files:H().int().nonnegative()}).nullable().optional()});G({project_id:Z,account_id:Y.optional(),kind:es.optional(),base_branch:B().min(1).optional(),branch:B().min(1).max(200).optional(),separate_branch:U().optional(),separate_worktree:U().optional(),join_worktree:B().optional(),cwd:B().optional(),title:B().min(1).max(200).optional(),prompt:B().optional(),skip_permissions:U().optional()}),G({title:B().max(200)}),G({account_id:Y}),G({account_id:Y}),G({vars:W(G({name:B(),bytes:H().int().nonnegative()}))}),G({cleared:H().int().nonnegative()}),G({force:U().default(!1),delete_branch:U().default(!1)});var ns=B().min(1).max(5),rs=G({id:Z,profile_id:Q,repo_id:Y,name:B(),abbrev:ns.nullable().default(null),archived:U().default(!1),created_at:J,updated_at:J});G({profile_id:Q,repo_id:Y,name:B().min(1).max(100),abbrev:ns.optional()}),G({name:B().min(1).max(100).optional(),abbrev:ns.optional(),archived:U().optional()}),G({project:rs,sessions:W(ts)});var is=K([`project`,`profile`]);G({id:Y,profile_id:Q,scope:is,project_id:Z.nullable(),title:B().nullable(),body:B(),tags:W(B()),agent_type:B().nullable(),position:H(),created_at:J,updated_at:J}),G({profile_id:Q,scope:is,project_id:Z.optional(),title:B().max(200).optional(),body:B().min(1),tags:W(B()).optional(),agent_type:B().optional()}),G({scope:is.optional(),project_id:Z.nullable().optional(),title:B().max(200).nullable().optional(),body:B().min(1).optional(),tags:W(B()).optional(),agent_type:B().nullable().optional(),position:H().optional()});var as=`00000000-0000-0000-0000-000000000000`,os=G({session:X,path:B(),kind:K([`file`,`diff`,`commit`,`external`,`untitled`]).optional(),sha:B().optional(),root:B().optional(),view:K([`source`,`preview`]).optional()}),ss=oo(`type`,[G({type:q(`editor`),tab:os}),G({type:q(`terminal`),session:X})]),cs=G({kind:q(`leaf`),id:B(),tabs:W(ss).default([]),activeKey:B().nullable().default(null),previewKey:B().nullable().default(null)}),ls=Fo(()=>oo(`kind`,[cs,G({kind:q(`split`),id:B(),direction:K([`row`,`col`]),children:W(ls),sizes:W(H())})])),us=no({layout_tree:ls.nullable().default(null),active_session:X.nullable().default(null),layout_ref:Y.nullable().default(null)}),ds=no({session_tabs:W(X).default([]),active_session:X.nullable().default(null),editor_tabs:W(os).default([]),layout:no({}).default({}),explorer_pin:X.nullable().default(null),active_editor_tab:os.nullable().default(null),explorer_open:U().default(!0),sidebar_mode:K([`files`,`diff`,`history`,`changes`,`search`,`worktrees`]).default(`files`),sidebar_collapsed:U().default(!1),sessions_collapsed:U().default(!1),right_panel:K([`sessions`,`scratchpad`]).optional(),session_order:W(X).default([]),layout_tree:ls.nullable().default(null),layout_mode:K([`profile`,`project`]).optional(),project_layouts:uo(B(),us).default({}),layout_ref:Y.nullable().default(null)});G({ui_state:ds}),G({ui_state:ds,updated_at:J});var fs=K([`project`,`profile`]);G({id:Y,profile_id:Q,scope:fs,project_id:Z.nullable(),name:B(),layout_tree:ls.nullable(),active_session:X.nullable(),created_at:J,updated_at:J}),G({profile_id:Q,scope:fs,project_id:Z.optional(),name:B().min(1).max(200),layout_tree:ls.nullable(),active_session:X.nullable().optional()}),G({name:B().min(1).max(200).optional(),layout_tree:ls.nullable().optional(),active_session:X.nullable().optional()});var ps=K([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]);G({mime:ps,data:B().min(1)}),G({path:B()}),G({path:B(),line:H().int().nullable()});var ms=G({name:B(),type:K([`file`,`dir`,`symlink`]),size:H().int().nonnegative().nullable(),symlink:U().default(!1)});G({path:B(),entries:W(ms)}),G({path:B(),content:B().nullable(),binary:U(),size:H().int().nonnegative(),mtime_ms:H()}),G({content:B(),expected_mtime_ms:H().optional()}),G({path:B(),mtime_ms:H(),size:H().int().nonnegative()}),G({files:W(G({path:B(),size:H().int().nonnegative()}))}),G({path:B().min(1),kind:K([`file`,`dir`])}),G({from:B().min(1),to:B().min(1)}),G({from:B().min(1),to:B().min(1)}),G({path:B().min(1)}),G({ok:q(!0),path:B()});var hs=K([`added`,`modified`,`deleted`,`renamed`]),gs=G({path:B(),status:hs,old_path:B().nullable()});G({against:B(),base_ref:B().nullable(),entries:W(gs)});var _s=K([`untracked`,`modified`,`added`,`deleted`,`renamed`,`conflicted`,`ignored`]);G({entries:W(G({path:B(),status:_s}))}),G({path:B(),ref:B(),content:B().nullable(),binary:U()});var vs=G({sha:B(),subject:B(),author_name:B(),author_email:B(),authored_at:J,parents:W(B()).optional()});G({commits:W(vs),has_more:U()}),G({commit:vs.extend({body:B()}),parents:W(B()),files:W(gs)});var ys=G({line:H().int().positive(),text:B()}),bs=G({path:B(),matches:W(ys)});G({query:B(),files:W(B()),content:W(bs),truncated:U()}),G({ports:W(G({port:H().int().min(1).max(65535),pid:H().int(),command:B(),address:B()})),scanned_at:J});var xs=G({status:q(`refreshing`)}),Ss=B().regex(/^(agent|shell-[0-9]+)$/),Cs=`home`,ws={cols:H().int().min(2).max(1e3),rows:H().int().min(2).max(500)};oo(`t`,[G({t:q(`auth`),token:B()}),G({t:q(`attach`),session:B(),term:Ss,...ws}),G({t:q(`stdin`),session:B(),term:Ss,data:B()}),G({t:q(`resize`),session:B(),term:Ss,...ws}),G({t:q(`detach`),session:B(),term:Ss}),G({t:q(`spawn-shell`),session:B()}),G({t:q(`kill-shell`),session:B(),term:Ss}),G({t:q(`subscribe-status`)})]);var Ts=class extends Error{status;code;constructor(e,t,n){super(n),this.status=e,this.code=t,this.name=`ApiError`}};async function Es(e,t,n){let r=_e.get(),i=await fetch(t,{method:e,headers:{...r?{authorization:`Bearer ${r}`}:{},...n===void 0?{}:{"content-type":`application/json`}},body:n===void 0?void 0:JSON.stringify(n)});if(i.status===401)throw ve(),new Ts(401,`unauthorised`,`invalid or expired token`);if(i.status!==204){if(!i.ok){let n=zo.safeParse(await i.json().catch(()=>null));throw n.success?new Ts(i.status,n.data.error.code,n.data.error.message):new Ts(i.status,`unknown`,`${e} ${t} failed with ${i.status}`)}return await i.json()}}function Ds(){let e=_e.get();return e?{authorization:`Bearer ${e}`}:{}}async function Os(e,t,n){let r=await fetch(t,{...n,method:e,headers:{...Ds(),...n?.headers}});if(r.status===401)throw ve(),new Ts(401,`unauthorised`,`invalid or expired token`);if(!r.ok){let n=zo.safeParse(await r.json().catch(()=>null));throw n.success?new Ts(r.status,n.data.error.code,n.data.error.message):new Ts(r.status,`unknown`,`${e} ${t} failed with ${r.status}`)}return r}export{h as S,Go as _,Cs as a,v as b,as as c,Vo as d,Uo as f,qo as g,Ko as h,Ds as i,ss as l,Wo as m,Es as n,xs as o,Ho as p,Os as r,ps as s,Ts as t,ds as u,y as v,_ as x,_e as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{A as r,C as i,E as a,O as o,S as s,T as c,_ as l,b as u,d,f,j as p,m,p as h,v as g,w as _,x as ee,y as v}from"./dialog-B43iKmfK.js";import{_t as y,ft as b,gt as te,ht as x,mt as S,pt as C,vt as w}from"./LazyTerminal-Cv4MivyB.js";import{t as T}from"./utils-B6KiDbIe.js";import{t as E}from"./createLucideIcon-DyMAgLa3.js";import{n as D,r as O,t as ne}from"./dist-i-QevsUb.js";var k=E(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),A=E(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]);function re(e){let t=Date.parse(e.created_at);return Number.isNaN(t)?0:t}function j(e,t){let n=new Map(t.map((e,t)=>[e,t])),r=[],i=[];for(let t of e)(n.has(t.id)?r:i).push(t);return r.sort((e,t)=>n.get(e.id)-n.get(t.id)),i.sort((e,t)=>re(t)-re(e)),[...i,...r]}function M(e,t,n){if(t===n)return[...e];let r=e.filter(e=>e!==t),i=r.indexOf(n);return i===-1?[...e]:(r.splice(i,0,t),r)}function N(e,t,n){if(t===n)return null;let r=e.find(e=>e.sessions.some(e=>e.id===t));if(!r||!r.sessions.some(e=>e.id===n))return null;let i=e.flatMap(e=>e.sessions.map(e=>e.id)),a=M(i,t,n);return a.some((e,t)=>e!==i[t])?a:null}function ie(e,t){let n=new Set(e);return[...e,...t.filter(e=>!n.has(e))]}var P=e(t(),1),F=!1;function ae(){let[e,t]=P.useState(F);return P.useEffect(()=>{F||(F=!0,t(!0))},[]),e}var I=P.useSyncExternalStore;function oe(){return()=>{}}function se(){return I(oe,()=>!0,()=>!1)}var ce=typeof I==`function`?se:ae,L=n(),le=`rovingFocusGroup.onEntryFocus`,ue={bubbles:!1,cancelable:!0},R=`RovingFocusGroup`,[de,fe,pe]=D(R),[me,he]=o(R,[pe]),[ge,_e]=me(R),ve=P.forwardRef((e,t)=>(0,L.jsx)(de.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,L.jsx)(de.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,L.jsx)(ye,{...e,ref:t})})}));ve.displayName=R;var ye=P.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:a,loop:o=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:m=!1,...h}=e,g=P.useRef(null),ee=r(t,g),v=ne(s),[y,b]=l({prop:c,defaultProp:u??null,onChange:d,caller:R}),[te,x]=P.useState(!1),S=i(f),C=fe(n),w=P.useRef(!1),[T,E]=P.useState(0);return P.useEffect(()=>{let e=g.current;if(e)return e.addEventListener(le,S),()=>e.removeEventListener(le,S)},[S]),(0,L.jsx)(ge,{scope:n,orientation:a,dir:v,loop:o,currentTabStopId:y,onItemFocus:P.useCallback(e=>b(e),[b]),onItemShiftTab:P.useCallback(()=>x(!0),[]),onFocusableItemAdd:P.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:P.useCallback(()=>E(e=>e-1),[]),children:(0,L.jsx)(_.div,{tabIndex:te||T===0?-1:0,"data-orientation":a,...h,ref:ee,style:{outline:`none`,...e.style},onMouseDown:p(e.onMouseDown,()=>{w.current=!0}),onFocus:p(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!te){let t=new CustomEvent(le,ue);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=C().filter(e=>e.focusable);Te([e.find(e=>e.active),e.find(e=>e.id===y),...e].filter(Boolean).map(e=>e.ref.current),m)}}w.current=!1}),onBlur:p(e.onBlur,()=>x(!1))})})}),be=`RovingFocusGroupItem`,xe=P.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=u(),l=a||c,d=_e(be,n),f=d.currentTabStopId===l,m=fe(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=d,y=ce();return ee(()=>{if(!(!y||!r))return h(),()=>g()},[y,r,h,g]),P.useEffect(()=>{if(!(y||!r))return h(),()=>g()},[y,r,h,g]),(0,L.jsx)(de.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,L.jsx)(_.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...s,ref:t,onMouseDown:p(e.onMouseDown,e=>{r?d.onItemFocus(l):e.preventDefault()}),onFocus:p(e.onFocus,()=>d.onItemFocus(l)),onKeyDown:p(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){d.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=we(e,d.orientation,d.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=m().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=d.loop?Ee(n,r+1):n.slice(r+1)}setTimeout(()=>Te(n))}}),children:typeof o==`function`?o({isCurrentTabStop:f,hasTabStop:v!=null}):o})})});xe.displayName=be;var Se={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Ce(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function we(e,t,n){let r=Ce(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Se[r]}function Te(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Ee(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var De=ve,Oe=xe,ke=[`Enter`,` `],Ae=[`ArrowDown`,`PageUp`,`Home`],je=[`ArrowUp`,`PageDown`,`End`],Me=[...Ae,...je],Ne={ltr:[...ke,`ArrowRight`],rtl:[...ke,`ArrowLeft`]},Pe={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},z=`Menu`,[B,Fe,Ie]=D(z),[V,Le]=o(z,[Ie,w,he]),H=w(),Re=he(),[ze,U]=V(z),[Be,W]=V(z),Ve=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:o,modal:s=!0}=e,c=H(t),[l,u]=P.useState(null),d=P.useRef(!1),f=i(o),p=ne(a);return P.useEffect(()=>{let e=()=>{d.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>d.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),P.useEffect(()=>{if(!n)return;let e=()=>f(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,f]),(0,L.jsx)(y,{...c,children:(0,L.jsx)(ze,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:u,children:(0,L.jsx)(Be,{scope:t,onClose:P.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:p,modal:s,children:r})})})};Ve.displayName=z;var He=`MenuAnchor`,Ue=P.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=H(n);return(0,L.jsx)(S,{...i,...r,ref:t})});Ue.displayName=He;var We=`MenuPortal`,[Ge,Ke]=V(We,{forceMount:void 0}),qe=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=U(We,t);return(0,L.jsx)(Ge,{scope:t,forceMount:n,children:(0,L.jsx)(g,{present:n||a.open,children:(0,L.jsx)(v,{asChild:!0,container:i,children:r})})})};qe.displayName=We;var G=`MenuContent`,[Je,Ye]=V(G),Xe=P.forwardRef((e,t)=>{let n=Ke(G,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=U(G,e.__scopeMenu),o=W(G,e.__scopeMenu);return(0,L.jsx)(B.Provider,{scope:e.__scopeMenu,children:(0,L.jsx)(g,{present:r||a.open,children:(0,L.jsx)(B.Slot,{scope:e.__scopeMenu,children:o.modal?(0,L.jsx)(Ze,{...i,ref:t}):(0,L.jsx)(Qe,{...i,ref:t})})})})}),Ze=P.forwardRef((e,t)=>{let n=U(G,e.__scopeMenu),i=P.useRef(null),a=r(t,i);return P.useEffect(()=>{let e=i.current;if(e)return d(e)},[]),(0,L.jsx)(et,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:p(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Qe=P.forwardRef((e,t)=>{let n=U(G,e.__scopeMenu);return(0,L.jsx)(et,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),$e=a(`MenuContent.ScrollLock`),et=P.forwardRef((e,t)=>{let{__scopeMenu:n,loop:i=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:c,disableOutsidePointerEvents:l,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:g,onFocusOutside:_,onInteractOutside:ee,onDismiss:v,disableOutsideScroll:y,...b}=e,x=U(G,n),S=W(G,n),C=H(n),w=Re(n),T=Fe(n),[E,D]=P.useState(null),O=P.useRef(null),ne=r(t,O,x.onContentChange),k=P.useRef(0),A=P.useRef(``),re=P.useRef(0),j=P.useRef(null),M=P.useRef(`right`),N=P.useRef(0),ie=y?f:P.Fragment,F=y?{as:$e,allowPinchZoom:!0}:void 0,ae=e=>{let t=A.current+e,n=T().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Pt(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){A.current=t,window.clearTimeout(k.current),t!==``&&(k.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};P.useEffect(()=>()=>window.clearTimeout(k.current),[]),h();let I=P.useCallback(e=>M.current===j.current?.side&&It(e,j.current?.area),[]);return(0,L.jsx)(Je,{scope:n,searchRef:A,onItemEnter:P.useCallback(e=>{I(e)&&e.preventDefault()},[I]),onItemLeave:P.useCallback(e=>{I(e)||(O.current?.focus(),D(null))},[I]),onTriggerLeave:P.useCallback(e=>{I(e)&&e.preventDefault()},[I]),pointerGraceTimerRef:re,onPointerGraceIntentChange:P.useCallback(e=>{j.current=e},[]),children:(0,L.jsx)(ie,{...F,children:(0,L.jsx)(m,{asChild:!0,trapped:a,onMountAutoFocus:p(o,e=>{e.preventDefault(),O.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:(0,L.jsx)(s,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:g,onFocusOutside:_,onInteractOutside:ee,onDismiss:v,children:(0,L.jsx)(De,{asChild:!0,...w,dir:S.dir,orientation:`vertical`,loop:i,currentTabStopId:E,onCurrentTabStopIdChange:D,onEntryFocus:p(u,e=>{S.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,L.jsx)(te,{role:`menu`,"aria-orientation":`vertical`,"data-state":At(x.open),"data-radix-menu-content":``,dir:S.dir,...C,...b,ref:ne,style:{outline:`none`,...b.style},onKeyDown:p(b.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ae(e.key));let i=O.current;if(e.target!==i||!Me.includes(e.key))return;e.preventDefault();let a=T().filter(e=>!e.disabled).map(e=>e.ref.current);je.includes(e.key)&&a.reverse(),Mt(a)}),onBlur:p(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(k.current),A.current=``)}),onPointerMove:p(e.onPointerMove,X(e=>{let t=e.target,n=N.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>N.current?`right`:`left`;M.current=t,N.current=e.clientX}}))})})})})})})});Xe.displayName=G;var tt=`MenuGroup`,nt=P.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,L.jsx)(_.div,{role:`group`,...r,ref:t})});nt.displayName=tt;var rt=`MenuLabel`,it=P.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,L.jsx)(_.div,{...r,ref:t})});it.displayName=rt;var K=`MenuItem`,at=`menu.itemSelect`,q=P.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:i,...a}=e,o=P.useRef(null),s=W(K,e.__scopeMenu),l=Ye(K,e.__scopeMenu),u=r(t,o),d=P.useRef(!1),f=()=>{let e=o.current;if(!n&&e){let t=new CustomEvent(at,{bubbles:!0,cancelable:!0});e.addEventListener(at,e=>i?.(e),{once:!0}),c(e,t),t.defaultPrevented?d.current=!1:s.onClose()}};return(0,L.jsx)(ot,{...a,ref:u,disabled:n,onClick:p(e.onClick,f),onPointerDown:t=>{e.onPointerDown?.(t),d.current=!0},onPointerUp:p(e.onPointerUp,e=>{d.current||e.currentTarget?.click()}),onKeyDown:p(e.onKeyDown,e=>{n||e.target!==e.currentTarget||l.searchRef.current!==``&&e.key===` `||ke.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});q.displayName=K;var ot=P.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:i=!1,textValue:a,...o}=e,s=Ye(K,n),c=Re(n),l=P.useRef(null),u=r(t,l),[d,f]=P.useState(!1),[m,h]=P.useState(``);return P.useEffect(()=>{let e=l.current;e&&h((e.textContent??``).trim())},[o.children]),(0,L.jsx)(B.ItemSlot,{scope:n,disabled:i,textValue:a??m,children:(0,L.jsx)(Oe,{asChild:!0,...c,focusable:!i,children:(0,L.jsx)(_.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,...o,ref:u,onPointerMove:p(e.onPointerMove,X(e=>{i?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:p(e.onPointerLeave,X(e=>s.onItemLeave(e))),onFocus:p(e.onFocus,()=>f(!0)),onBlur:p(e.onBlur,()=>f(!1))})})})}),st=`MenuCheckboxItem`,ct=P.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,L.jsx)(gt,{scope:e.__scopeMenu,checked:n,children:(0,L.jsx)(q,{role:`menuitemcheckbox`,"aria-checked":Y(n)?`mixed`:n,...i,ref:t,"data-state":jt(n),onSelect:p(i.onSelect,()=>r?.(Y(n)?!0:!n),{checkForDefaultPrevented:!1})})})});ct.displayName=st;var lt=`MenuRadioGroup`,[ut,dt]=V(lt,{value:void 0,onValueChange:()=>{}}),ft=P.forwardRef((e,t)=>{let{value:n,onValueChange:r,...a}=e,o=i(r);return(0,L.jsx)(ut,{scope:e.__scopeMenu,value:n,onValueChange:o,children:(0,L.jsx)(nt,{...a,ref:t})})});ft.displayName=lt;var pt=`MenuRadioItem`,mt=P.forwardRef((e,t)=>{let{value:n,...r}=e,i=dt(pt,e.__scopeMenu),a=n===i.value;return(0,L.jsx)(gt,{scope:e.__scopeMenu,checked:a,children:(0,L.jsx)(q,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":jt(a),onSelect:p(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});mt.displayName=pt;var ht=`MenuItemIndicator`,[gt,_t]=V(ht,{checked:!1}),vt=P.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=_t(ht,n);return(0,L.jsx)(g,{present:r||Y(a.checked)||a.checked===!0,children:(0,L.jsx)(_.span,{...i,ref:t,"data-state":jt(a.checked)})})});vt.displayName=ht;var yt=`MenuSeparator`,bt=P.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,L.jsx)(_.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});bt.displayName=yt;var xt=`MenuArrow`,St=P.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=H(n);return(0,L.jsx)(x,{...i,...r,ref:t})});St.displayName=xt;var Ct=`MenuSub`,[wt,Tt]=V(Ct),Et=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:a}=e,o=U(Ct,t),s=H(t),[c,l]=P.useState(null),[d,f]=P.useState(null),p=i(a);return P.useEffect(()=>(o.open===!1&&p(!1),()=>p(!1)),[o.open,p]),(0,L.jsx)(y,{...s,children:(0,L.jsx)(ze,{scope:t,open:r,onOpenChange:p,content:d,onContentChange:f,children:(0,L.jsx)(wt,{scope:t,contentId:u(),triggerId:u(),trigger:c,onTriggerChange:l,children:n})})})};Et.displayName=Ct;var J=`MenuSubTrigger`,Dt=P.forwardRef((e,t)=>{let n=U(J,e.__scopeMenu),i=W(J,e.__scopeMenu),a=Tt(J,e.__scopeMenu),o=Ye(J,e.__scopeMenu),s=P.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:e.__scopeMenu},d=P.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);P.useEffect(()=>d,[d]),P.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),l(null)}},[c,l]);let f=r(t,a.onTriggerChange);return(0,L.jsx)(Ue,{asChild:!0,...u,children:(0,L.jsx)(ot,{id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?a.contentId:void 0,"data-state":At(n.open),...e,ref:f,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:p(e.onPointerMove,X(t=>{o.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:p(e.onPointerLeave,X(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,a=i?-5:5,s=t[i?`left`:`right`],l=t[i?`right`:`left`];o.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:p(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||o.searchRef.current!==``&&t.key===` `||Ne[i.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Dt.displayName=J;var Ot=`MenuSubContent`,kt=P.forwardRef((e,t)=>{let n=Ke(G,e.__scopeMenu),{forceMount:i=n.forceMount,align:a=`start`,...o}=e,s=U(G,e.__scopeMenu),c=W(G,e.__scopeMenu),l=Tt(Ot,e.__scopeMenu),u=P.useRef(null),d=r(t,u);return(0,L.jsx)(B.Provider,{scope:e.__scopeMenu,children:(0,L.jsx)(g,{present:i||s.open,children:(0,L.jsx)(B.Slot,{scope:e.__scopeMenu,children:(0,L.jsx)(et,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:d,align:a,side:c.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&u.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:p(e.onFocusOutside,e=>{e.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:p(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:p(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Pe[c.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})});kt.displayName=Ot;function At(e){return e?`open`:`closed`}function Y(e){return e===`indeterminate`}function jt(e){return Y(e)?`indeterminate`:e?`checked`:`unchecked`}function Mt(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Nt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Pt(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Nt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Ft(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function It(e,t){return t?Ft({x:e.clientX,y:e.clientY},t):!1}function X(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Lt=Ve,Rt=Ue,zt=qe,Bt=Xe,Vt=nt,Ht=it,Ut=q,Wt=ct,Gt=ft,Kt=mt,qt=vt,Jt=bt,Yt=St,Xt=Et,Zt=Dt,Qt=kt,Z=`ContextMenu`,[$t,en]=o(Z,[Le]),Q=Le(),[tn,nn]=$t(Z),rn=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=P.useRef(!1);{let e=P.useRef(!1);P.useEffect(()=>{i===!0&&!s.current&&!e.current&&(e.current=!0,console.warn("ContextMenu: The `open` prop has been set to `true` before the user has interacted with the trigger, so its position is indeterminate. This is likely unintended and will result in the menu being anchored to the top-left corner of the viewport."))},[i])}let[c,u]=l({prop:i,defaultProp:!1,onChange:r,caller:Z}),d=Q(t);return(0,L.jsx)(tn,{scope:t,open:c,onOpenChange:u,modal:o,hasInteractedRef:s,children:(0,L.jsx)(Lt,{...d,dir:a,open:c,onOpenChange:u,modal:o,children:n})})};rn.displayName=Z;var an=`ContextMenuTrigger`,on=P.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=nn(an,n),o=Q(n),[s,c]=P.useState({x:0,y:0}),l=P.useMemo(()=>({current:{getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s})}}),[s]),u=P.useRef(0),d=P.useCallback(()=>window.clearTimeout(u.current),[]),f=e=>{a.hasInteractedRef.current=!0,c({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)};return P.useEffect(()=>d,[d]),P.useEffect(()=>void(r&&d()),[r,d]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Rt,{...o,virtualRef:l}),(0,L.jsx)(_.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:p(e.onContextMenu,e=>{d(),f(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:p(e.onPointerDown,$(e=>{d(),a.open&&a.onOpenChange(!1),u.current=window.setTimeout(()=>f(e),700)})),onPointerMove:r?e.onPointerMove:p(e.onPointerMove,$(d)),onPointerCancel:r?e.onPointerCancel:p(e.onPointerCancel,$(d)),onPointerUp:r?e.onPointerUp:p(e.onPointerUp,$(d))})]})});on.displayName=an;var sn=`ContextMenuPortal`,cn=e=>{let{__scopeContextMenu:t,...n}=e,r=Q(t);return(0,L.jsx)(zt,{...r,...n})};cn.displayName=sn;var ln=`ContextMenuContent`,un=P.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=nn(ln,n),a=Q(n),o=P.useRef(!1);return(0,L.jsx)(Bt,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});un.displayName=ln;var dn=`ContextMenuGroup`,fn=P.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,L.jsx)(Vt,{...i,...r,ref:t})});fn.displayName=dn;var pn=`ContextMenuLabel`,mn=P.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,L.jsx)(Ht,{...i,...r,ref:t})});mn.displayName=pn;var hn=`ContextMenuItem`,gn=P.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,L.jsx)(Ut,{...i,...r,ref:t})});gn.displayName=hn;var _n=`ContextMenuCheckboxItem`,vn=P.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,L.jsx)(Wt,{...i,...r,ref:t})});vn.displayName=_n;var yn=`ContextMenuRadioGroup`,bn=P.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,L.jsx)(Gt,{...i,...r,ref:t})});bn.displayName=yn;var xn=`ContextMenuRadioItem`,Sn=P.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,L.jsx)(Kt,{...i,...r,ref:t})});Sn.displayName=xn;var Cn=`ContextMenuItemIndicator`,wn=P.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,L.jsx)(qt,{...i,...r,ref:t})});wn.displayName=Cn;var Tn=`ContextMenuSeparator`,En=P.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,L.jsx)(Jt,{...i,...r,ref:t})});En.displayName=Tn;var Dn=`ContextMenuArrow`,On=P.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,L.jsx)(Yt,{...i,...r,ref:t})});On.displayName=Dn;var kn=`ContextMenuSub`,An=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=Q(t),[s,c]=l({prop:i,defaultProp:a??!1,onChange:r,caller:kn});return(0,L.jsx)(Xt,{...o,open:s,onOpenChange:c,children:n})};An.displayName=kn;var jn=`ContextMenuSubTrigger`,Mn=P.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,L.jsx)(Zt,{...i,...r,ref:t})});Mn.displayName=jn;var Nn=`ContextMenuSubContent`,Pn=P.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,L.jsx)(Qt,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Pn.displayName=Nn;function $(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var Fn=rn,In=on,Ln=cn,Rn=un,zn=gn,Bn=En,Vn=An,Hn=Mn,Un=Pn,Wn=Fn,Gn=In,Kn=Vn;function qn({className:e,...t}){return(0,L.jsx)(Ln,{children:(0,L.jsx)(Rn,{className:T(`z-50 min-w-36 overflow-hidden rounded-md bg-elevated p-1 shadow-xl`,e),...t})})}function Jn({className:e,...t}){return(0,L.jsx)(zn,{className:T(C,b,`[&_svg]:size-3.5`,e),...t})}function Yn({className:e,children:t,...n}){return(0,L.jsxs)(Hn,{className:T(C,b,`data-[state=open]:bg-action data-[state=open]:text-action-ink [&_svg]:size-3.5`,e),...n,children:[t,(0,L.jsx)(O,{className:`ml-auto`})]})}function Xn({className:e,...t}){return(0,L.jsx)(Ln,{children:(0,L.jsx)(Un,{className:T(`z-50 min-w-36 overflow-hidden rounded-md bg-elevated p-1 shadow-xl`,e),...t})})}function Zn({className:e,...t}){return(0,L.jsx)(Bn,{className:T(`-mx-1 my-1 h-px bg-border`,e),...t})}function Qn(){return{onClick:e=>{e.detail===2&&e.preventDefault()},onDoubleClick:e=>{e.preventDefault(),e.currentTarget.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY,button:2}))}}}export{M as A,Xt as C,ie as D,Le as E,k as M,N as O,Jt as S,Zt as T,Ht as _,Kn as a,Kt as b,Gn as c,Yt as d,Wt as f,qt as g,Ut as h,Zn as i,A as j,j as k,Qn as l,Vt as m,qn as n,Xn as o,Bt as p,Jn as r,Yn as s,Wn as t,Rt as u,zt as v,Qt as w,Lt as x,Gt as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{C as r,D as i,O as a,T as o,b as s,v as c,x as l,y as u}from"./hotkeys-BrRVXikm.js";import{S as d,n as f,r as p}from"./api-BJeOJuGe.js";var m=class extends o{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:o,isRefetching:s,isError:c,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:i(t,n.data),hasPreviousPage:a(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function ee(e,t){return l(e,m,t)}var h=50;function g(e){return e===void 0?``:`&root=${encodeURIComponent(e)}`}function _(e){return e?{placeholderData:e=>e}:{}}function v(e,t,n){let r=e!==void 0;return s({queryKey:n===void 0?[`wt-tree`,e,t]:[`wt-tree`,e,t,n],queryFn:()=>f(`GET`,`/api/worktrees/${e}/tree?path=${encodeURIComponent(t)}${g(n)}`),enabled:r,..._(r)})}function te(e,t,n){let r=n?.root;return s({queryKey:r===void 0?[`wt-file`,e,t]:[`wt-file`,e,t,r],queryFn:()=>f(`GET`,`/api/worktrees/${e}/file?path=${encodeURIComponent(t)}${g(r)}`),enabled:e!==void 0&&(n?.enabled??!0),...n?.live===!0?{refetchInterval:c(3e3),refetchOnWindowFocus:!0}:{}})}function y(e,t){let n=r();return u({mutationFn:({path:n,...r})=>f(`PUT`,`/api/worktrees/${e}/file?path=${encodeURIComponent(n)}${g(t)}`,r),onSuccess:(r,{path:i})=>{n.invalidateQueries({queryKey:t===void 0?[`wt-file`,e,i]:[`wt-file`,e,i,t]}),n.invalidateQueries({queryKey:[`wt-diff`,e]})}})}function b(e,t){let n=t?.against??`base`,r=t?.root,i=e!==void 0&&(t?.enabled??!0);return s({queryKey:r===void 0?[`wt-diff`,e,n]:[`wt-diff`,e,n,r],queryFn:()=>f(`GET`,`/api/worktrees/${e}/diff?against=${n}${g(r)}`),enabled:i,refetchInterval:c(1e4),refetchOnWindowFocus:!0,..._(i)})}function x(e,t){let n=t?.root,r=e!==void 0&&(t?.enabled??!0);return s({queryKey:n===void 0?[`wt-git-status`,e]:[`wt-git-status`,e,n],queryFn:()=>f(`GET`,`/api/worktrees/${e}/git-status${S(n)}`),enabled:r,refetchInterval:c(1e4),refetchOnWindowFocus:!0,..._(r)})}function S(e){return e===void 0?``:`?root=${encodeURIComponent(e)}`}function ne(e,t,n,r){return f(`POST`,`/api/worktrees/${e}/create${S(r)}`,{path:t,kind:n})}function re(e,t,n,r){return f(`POST`,`/api/worktrees/${e}/rename${S(r)}`,{from:t,to:n})}function ie(e,t,n,r){return f(`POST`,`/api/worktrees/${e}/copy${S(r)}`,{from:t,to:n})}function C(e,t,n){return f(`POST`,`/api/worktrees/${e}/delete${S(n)}`,{path:t})}function w(e,t,n){let{query:r,regex:i,caseSensitive:a,wholeWord:o}=t;return s({queryKey:[`wt-search`,e,r,i,a,o,n],queryFn:()=>{let t=new URLSearchParams({q:r});return i&&t.set(`regex`,`1`),a&&t.set(`case`,`1`),o&&t.set(`word`,`1`),n!==void 0&&t.set(`root`,n),f(`GET`,`/api/worktrees/${e}/search?${t.toString()}`)},enabled:e!==void 0&&r.length>0,staleTime:2e3})}function T(e,t,n,r){let i=r?.root;return s({queryKey:[`wt-file-at`,e,t,n,i],queryFn:()=>f(`GET`,`/api/worktrees/${e}/file-at?ref=${encodeURIComponent(t)}&path=${encodeURIComponent(n)}${g(i)}`),enabled:e!==void 0&&(r?.enabled??!0),staleTime:1/0})}function E(e,t){let n=t?.root,r=e!==void 0&&(t?.enabled??!0);return ee({queryKey:n===void 0?[`wt-log`,e]:[`wt-log`,e,n],queryFn:({pageParam:t})=>f(`GET`,`/api/worktrees/${e}/log?limit=${h}&skip=${t}${g(n)}`),initialPageParam:0,getNextPageParam:(e,t)=>e.has_more?t.length*h:void 0,enabled:r,..._(r)})}function D(e,t,n){return s({queryKey:n===void 0?[`wt-show`,e,t]:[`wt-show`,e,t,n],queryFn:()=>f(`GET`,`/api/worktrees/${e}/show/${t}${S(n)}`),enabled:e!==void 0&&t!==void 0,staleTime:1/0})}var O=64*1024*1024;function k(e,t){let n=[],r=[],i=0;for(let a of e)r.length>0&&i+a.size>t&&(n.push(r),r=[],i=0),r.push(a),i+=a.size;return r.length>0&&n.push(r),n}async function A(e,t,n,r){let i=[];for(let a of k(n,O)){let n=new FormData;for(let e of a)n.append(`files`,e,e.name);let o=await p(`POST`,`/api/worktrees/${e}/upload?dir=${encodeURIComponent(t)}${g(r)}`,{body:n});i.push(...(await o.json()).files)}return{files:i}}function j(e,t){if(!e)return t;let n=/filename\*=UTF-8''([^;]+)/i.exec(e);if(n?.[1])try{return decodeURIComponent(n[1])}catch{return t}return/filename="?([^"; ]+)"?/i.exec(e)?.[1]??t}async function M(e,t,n){let r=await p(`GET`,`/api/worktrees/${e}/download?path=${encodeURIComponent(t)}${g(n)}`),i=await r.blob(),a=t.split(`/`).filter(Boolean).pop()??`worktree`,o=j(r.headers.get(`content-disposition`),a),s=URL.createObjectURL(i);try{let e=document.createElement(`a`);e.href=s,e.download=o,document.body.appendChild(e),e.click(),e.remove()}finally{URL.revokeObjectURL(s)}}function N(e,t,n){let r=`${encodeURIComponent(e)}:${encodeURIComponent(t)}`;return n===void 0?r:`${r}:${encodeURIComponent(n)}`}var P=new Map;function F(e,t){return P.set(e,t),()=>{P.get(e)===t&&P.delete(e)}}function I(e){if(e===null)return!1;let t=P.get(e);return t?(t(),!0):!1}var L=`UTC`;function R(e){return new Date(e).toLocaleDateString(`en-GB`,{day:`numeric`,month:`short`,year:`numeric`,timeZone:L})}var z=60,B=60*z,V=24*B,H=7*V;function U(e,t=new Date){let n=new Date(e).getTime(),r=Math.max(0,Math.floor((t.getTime()-n)/1e3));return r<z?`just now`:r<B?`${Math.floor(r/z)} m ago`:r<V?`${Math.floor(r/B)} h ago`:r<H?`${Math.floor(r/V)} d ago`:R(n)}function W(e,t){return t?`added`:e}function G(e){return f(`POST`,`/api/profiles/${e}/untitled`)}function K(e,t){return s({queryKey:[`untitled`,e,t],queryFn:()=>f(`GET`,`/api/profiles/${e}/untitled/${t}`),enabled:e!==null,staleTime:1/0})}function q(e,t,n){return f(`PUT`,`/api/profiles/${e}/untitled/${t}`,{content:n})}function J(e,t){return f(`DELETE`,`/api/profiles/${e}/untitled/${t}`)}var Y=null,X=new Map;function ae(e){Y=e}function oe(e){Y?.(e)}function se(e,t){X.set(e,t)}function ce(e){X.delete(e)}var Z=e(t(),1),le=n(),Q=(0,Z.createContext)({openFile:()=>void 0,handler:null,setHandler:()=>void 0});function $({children:e}){let[t,n]=(0,Z.useState)(null),r=(0,Z.useCallback)(e=>n(()=>e),[]),i=(0,Z.useCallback)((e,n,r,i)=>{if(!t){d(`The editor is not ready yet.`);return}t(e,n,r,i)},[t]),a=(0,Z.useMemo)(()=>({openFile:i,handler:t,setHandler:r}),[i,t,r]);return(0,le.jsx)(Q.Provider,{value:a,children:e})}function ue(){let{openFile:e}=(0,Z.useContext)(Q);return{openFile:e}}function de(e){let{setHandler:t}=(0,Z.useContext)(Q),n=(0,Z.useRef)(e);n.current=e,(0,Z.useEffect)(()=>(t((e,t,r,i)=>n.current(e,t,r,i)),()=>t(null)),[t])}export{E as A,A as C,b as D,y as E,v as M,te as O,g as S,T,ie as _,se as a,M as b,G as c,K as d,W as f,N as g,I as h,ce as i,w as j,x as k,J as l,F as m,ue as n,oe as o,U as p,de as r,ae as s,$ as t,q as u,ne as v,D as w,re as x,C as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{b as r}from"./api-BJeOJuGe.js";var i=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},a=new class extends i{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},o={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},s=new class{#e=o;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function c(e){setTimeout(e,0)}var l=typeof window>`u`||`Deno`in globalThis;function u(){}function d(e,t){return typeof e==`function`?e(t):e}function f(e){return typeof e==`number`&&e>=0&&e!==1/0}function p(e,t){return Math.max(e+(t||0)-Date.now(),0)}function m(e,t){return typeof e==`function`?e(t):e}function h(e,t){return typeof e==`function`?e(t):e}function g(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==v(o,t.options))return!1}else if(!b(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function _(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(y(t.options.mutationKey)!==y(a))return!1}else if(!b(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function v(e,t){return(t?.queryKeyHashFn||y)(e)}function y(e){return JSON.stringify(e,(e,t)=>w(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function b(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>b(e[n],t[n])):!1}var x=Object.prototype.hasOwnProperty;function S(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ee(e)&&ee(t);if(!r&&!(w(e)&&w(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:x.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=S(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function C(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ee(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function w(e){if(!te(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!te(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function te(e){return Object.prototype.toString.call(e)===`[object Object]`}function ne(e){return new Promise(t=>{s.setTimeout(t,e)})}function T(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:S(e,t)}function re(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ie(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var E=Symbol();function ae(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===E?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function D(e,t){return typeof e==`function`?e(...t):!!e}function oe(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var O=(()=>{let e=()=>l;return{isServer(){return e()},setIsServer(t){e=t}}})();function k(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var se=c;function ce(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=se,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var A=ce(),j=new class extends i{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function le(e){return Math.min(1e3*2**e,3e4)}function ue(e){return(e??`online`)!==`online`||j.isOnline()}var M=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function de(e){let t=!1,n=0,r,i=k(),o=()=>i.status!==`pending`,s=t=>{if(!o()){let n=new M(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>a.isFocused()&&(e.networkMode===`always`||j.isOnline())&&e.canRun(),d=()=>ue(e.networkMode)&&e.canRun(),f=e=>{o()||(r?.(),i.resolve(e))},p=e=>{o()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(o()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),h=()=>{if(o())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(o())return;let i=e.retry??(O.isServer()?0:3),a=e.retryDelay??le,s=typeof a==`function`?a(n,r):a,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),ne(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:s,continue:()=>(r?.(),i),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),i)}}var fe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),f(this.gcTime)&&(this.#e=s.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(O.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(s.clearTimeout(this.#e),this.#e=void 0)}};function pe(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{oe(e,()=>t.signal,()=>n=!0)},u=ae(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ie:re;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?P:N,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:N(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function N(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function P(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function me(e,t){return t?N(e,t)!=null:!1}function he(e,t){return!t||!e.getPreviousPageParam?!1:P(e,t)!=null}var ge=class extends fe{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=L(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=L(this.options);e.data!==void 0&&(this.setState(I(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=T(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(u).catch(u):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>h(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===E||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>m(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!p(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ae(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?pe(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=de({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof M&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof M){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...F(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...I(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),A.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function F(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ue(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function I(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function L(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var R=class extends i{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=k(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),z(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return B(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return B(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof h(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!C(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&V(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||h(this.options.enabled,this.#t)!==h(t.enabled,this.#t)||m(this.options.staleTime,this.#t)!==m(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||h(this.options.enabled,this.#t)!==h(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ve(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=m(this.options.staleTime,this.#t);if(O.isServer()||this.#r.isStale||!f(e))return;let t=p(this.#r.dataUpdatedAt,e)+1;this.#d=s.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(O.isServer()||h(this.options.enabled,this.#t)===!1||!f(this.#p)||this.#p===0)&&(this.#f=s.setInterval(()=>{(this.options.refetchIntervalInBackground||a.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(s.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(s.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&z(e,t),o=i&&V(e,n,t,r);(a||o)&&(l={...l,...F(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let g=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,g=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=T(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!g)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=T(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let _=l.fetchStatus===`fetching`,v=m===`pending`,y=m===`error`,b=v&&_,x=d!==void 0,S={status:m,fetchStatus:l.fetchStatus,isPending:v,isSuccess:m===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:H(e,t),refetch:this.refetch,promise:this.#o,isEnabled:h(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{let e=this.#o=S.promise=k();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!C(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){A.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function _e(e,t){return h(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&h(t.retryOnMount,e)===!1)}function z(e,t){return _e(e,t)||e.state.data!==void 0&&B(e,t,t.refetchOnMount)}function B(e,t,n){if(h(t.enabled,e)!==!1&&m(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&H(e,t)}return!1}function V(e,t,n,r){return(e!==t||h(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&H(e,n)}function H(e,t){return h(t.enabled,e)!==!1&&e.isStaleByTime(m(t.staleTime,e))}function ve(e,t){return!C(e.getCurrentResult(),t)}var ye=class extends fe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||U(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=de({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),A.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function U(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var be=class extends i{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),C(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&y(t.mutationKey)!==y(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??U();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){A.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},W=e(t(),1),xe=n(),Se=W.createContext(void 0),G=e=>{let t=W.useContext(Se);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ce=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,xe.jsx)(Se.Provider,{value:e,children:t})),we=W.createContext(!1),Te=()=>W.useContext(we);we.Provider;function Ee(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var De=W.createContext(Ee()),Oe=()=>W.useContext(De),ke=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?D(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Ae=e=>{W.useEffect(()=>{e.clearReset()},[e])},je=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||D(n,[e.error,r])),Me=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ne=(e,t)=>e.isLoading&&e.isFetching&&!t,Pe=(e,t)=>e?.suspense&&t.isPending,Fe=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ie(e,t,n){let r=Te(),i=Oe(),a=G(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Me(o),ke(o,i,s),Ae(i);let l=!a.getQueryCache().get(o.queryHash),[d]=W.useState(()=>new t(a,o)),f=d.getOptimisticResult(o),p=!r&&c;if(W.useSyncExternalStore(W.useCallback(e=>{let t=p?d.subscribe(A.batchCalls(e)):u;return d.updateResult(),t},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),W.useEffect(()=>{d.setOptions(o)},[o,d]),Pe(o,f))throw Fe(o,d,i);if(je({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw f.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,f),o.experimental_prefetchInRender&&!O.isServer()&&Ne(f,r)&&(l?Fe(o,d,i):s?.promise)?.catch(u).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?f:d.trackResult(f)}function Le(e,t){return Ie(e,R,t)}function Re(e,t){let n=G(t),[r]=W.useState(()=>new be(n,e));W.useEffect(()=>{r.setOptions(e)},[r,e]);let i=W.useSyncExternalStore(W.useCallback(e=>r.subscribe(A.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=W.useCallback((e,t)=>{r.mutate(e,t).catch(u)},[r]);if(i.error&&D(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var ze=12,K=typeof document<`u`?document.hasFocus():!0;typeof window<`u`&&(window.addEventListener(`focus`,()=>{K=!0}),window.addEventListener(`blur`,()=>{K=!1}),a.setEventListener(e=>{let t=()=>e(void 0);return window.addEventListener(`visibilitychange`,t,!1),window.addEventListener(`focus`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t),window.removeEventListener(`focus`,t)}}));function Be(e){return()=>K?e:e*ze}var q=r(`puddle.profile-id`);function Ve(){let e=(0,W.useSyncExternalStore)(q.subscribe,q.get);return e!==null&&/^[0-9a-f]{10}$/.test(e)?e:null}function He(e){window.location.pathname!==`/`&&window.history.replaceState(null,``,`/`),q.set(e)}function J(){return window.puddleDesktop}function Ue(){let[e,t]=(0,W.useState)({fullScreen:!1,animate:!1});return(0,W.useEffect)(()=>{let e=J();if(!e)return;let n=!0;e.isFullScreen?.()?.then(e=>{n&&t({fullScreen:e,animate:!1})});let r=e.onFullScreenChange?.(e=>t({fullScreen:e,animate:!0}));return()=>{n=!1,r?.()}},[]),e}var We=[`Layout & tabs`,`Editor`,`Left sidebar`,`Right sidebar`],Y=[{id:`palette.toggle`,label:`Command palette`,group:`Layout & tabs`,defaultBinding:`meta+KeyK`},{id:`tab.close`,label:`Close current tab`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+KeyW`,desktopBinding:`meta+KeyW`},{id:`tab.reopen`,label:`Reopen last closed tab`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+KeyT`,desktopBinding:`shift+meta+KeyT`},{id:`tab.next`,label:`Next tab in pane`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+BracketRight`,desktopBinding:`ctrl+Tab`},{id:`tab.prev`,label:`Previous tab in pane`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+BracketLeft`,desktopBinding:`ctrl+shift+Tab`},{id:`window.close`,label:`Close window`,group:`Layout & tabs`,defaultBinding:`meta+KeyW`,desktopBinding:`shift+meta+KeyW`},{id:`sidebar.left`,label:`Toggle left sidebar`,group:`Layout & tabs`,defaultBinding:`alt+meta+Comma`,desktopBinding:`meta+KeyB`},{id:`sidebar.right`,label:`Toggle right sidebar`,group:`Layout & tabs`,defaultBinding:`alt+meta+Period`,desktopBinding:`shift+meta+KeyB`},{id:`editor.save`,label:`Save`,group:`Editor`,defaultBinding:`meta+KeyS`,editor:!0},{id:`editor.wordWrap`,label:`Toggle word wrap`,group:`Editor`,defaultBinding:`alt+KeyZ`,editor:!0},{id:`nav.files`,label:`Open Files`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyE`},{id:`nav.search`,label:`Open Search`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyF`},{id:`nav.changes`,label:`Open Changes`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyV`},{id:`nav.worktrees`,label:`Open Worktrees`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyB`},{id:`session.newAgent`,label:`New agent`,group:`Right sidebar`,defaultBinding:`ctrl+alt+Backquote`,desktopBinding:`meta+KeyT`},{id:`session.newTerminal`,label:`New terminal`,group:`Right sidebar`,defaultBinding:`ctrl+Backquote`},{id:`scratchpad.toggle`,label:`Toggle Scratchpad`,group:`Right sidebar`,defaultBinding:`alt+meta+KeyS`},{id:`layouts.toggle`,label:`Toggle Layouts`,group:`Right sidebar`,defaultBinding:`alt+meta+KeyL`}],Ge=new Map(Y.map(e=>[e.id,e])),Ke=typeof window<`u`&&J()!==void 0;function qe(e,t=Ke){return t&&e.desktopBinding?e.desktopBinding:e.defaultBinding}function Je(e){let t=e.code;if(!t||/^(Control|Alt|Shift|Meta)(Left|Right)$/.test(t))return null;let n=[];return e.ctrlKey&&n.push(`ctrl`),e.altKey&&n.push(`alt`),e.shiftKey&&n.push(`shift`),e.metaKey&&n.push(`meta`),n.length===0?null:(n.push(t),n.join(`+`))}var Ye={ctrl:`⌃`,alt:`⌥`,shift:`⇧`,meta:`⌘`},Xe={Comma:`,`,Period:`.`,Backquote:"`",Slash:`/`,Backslash:`\\`,Minus:`-`,Equal:`=`,Space:`␣`,Enter:`↵`,Escape:`Esc`,Tab:`⇥`,BracketLeft:`[`,BracketRight:`]`};function Ze(e){return e.startsWith(`Key`)?e.slice(3):e.startsWith(`Digit`)?e.slice(5):Xe[e]??e}function Qe(e){if(!e)return`—`;let t=e.split(`+`),n=t.pop()??``;return t.map(e=>Ye[e]??e).join(``)+Ze(n)}var X=new Map;function $e(e,t){return X.set(e,t),()=>{X.get(e)===t&&X.delete(e)}}var et=e=>X.get(e),tt=e=>Ge.get(e),nt={},Z=new Set,Q=$();function $(){let e={};for(let t of Y)e[t.id]=nt[t.id]||qe(t);return e}function rt(e){nt=e??{},Q=$(),Z.forEach(e=>e())}var it=e=>Q[e]??``;function at(e){for(let[t,n]of Object.entries(Q))if(n===e)return t}function ot(e){return Qe(st()[e]??``)}function st(){return(0,W.useSyncExternalStore)(e=>(Z.add(e),()=>Z.delete(e)),()=>Q)}export{A,a as B,G as C,me as D,ge as E,g as F,u as I,b as L,y as M,v as N,he as O,_ as P,m as R,Ce as S,R as T,i as V,Ve as _,Qe as a,Le as b,it as c,qe as d,ot as f,He as g,q as h,Je as i,d as j,j as k,$e as l,Ue as m,We as n,tt as o,J as p,at as r,et as s,Y as t,rt as u,Be as v,ye as w,Ie as x,Re as y,E as z};
|