@longleash/cli 0.1.0-rc.11 → 0.1.0-rc.12
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/README.md +11 -0
- package/bin/longleash.mjs +152 -32
- package/npm-shrinkwrap.json +94 -79
- package/package.json +2 -2
- package/runtime/app/dist/assets/app-CSvRpOMO.js +27 -0
- package/runtime/app/dist/assets/styles-By_DSD7A.css +1 -0
- package/runtime/app/dist/assets/{styles-ej0i2z2o.js → styles-Dfo-8KGF.js} +4 -4
- package/runtime/app/dist/assets/welcome-BPvArovG.js +41 -0
- package/runtime/app/dist/build.json +1 -1
- package/runtime/app/dist/index.html +3 -3
- package/runtime/app/dist/welcome.html +3 -3
- package/runtime/daemon/bin/longleashd.mjs +592 -53
- package/runtime/app/dist/assets/app-Dv_E_rRc.js +0 -27
- package/runtime/app/dist/assets/styles-Dr4-130w.css +0 -1
- package/runtime/app/dist/assets/welcome-CbADUhH1.js +0 -40
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import{R as S,r as g,a as Qx,g as ao,j as Xx,b as ei,c as ti,d as ie,M as ni,e as s,i as A0,u as lo,f as co,P as ri,h as si,L as oi,S as fn,k as H0,W as uo,m as ke,l as ze,E as We,K as te,C as Ke,A as pr,n as zt,o as Wt,X as pt,p as vt,q as i0,s as xi,t as a0,v as ho,w as ii,x as ai,y as Nt,N as K0,z as Eo,B as li,D as fo,I as po,F as ci,G as di,H as ui}from"./styles-Dfo-8KGF.js";function hi(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const x=Object.getOwnPropertyDescriptor(r,o);x&&Object.defineProperty(e,o,x.get?x:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var Ei=class mo extends Error{static kind="ClerkError";clerkError=!0;code;longMessage;docsUrl;cause;get name(){return this.constructor.name}constructor(t){super(new.target.formatMessage(new.target.kind,t.message,t.code,t.docsUrl),{cause:t.cause}),Object.setPrototypeOf(this,mo.prototype),this.code=t.code,this.docsUrl=t.docsUrl,this.longMessage=t.longMessage,this.cause=t.cause}toString(){return`[${this.name}]
|
|
2
|
+
Message:${this.message}`}static formatMessage(t,n,r,o){const x="Clerk:",i=new RegExp(x.replace(" ","\\s*"),"i");return n=n.replace(i,""),n=`${x} ${n.trim()}
|
|
3
|
+
|
|
4
|
+
(code="${r}")
|
|
5
|
+
|
|
6
|
+
`,o&&(n+=`
|
|
7
|
+
|
|
8
|
+
Docs: ${o}`),n}},mr=class Co extends Ei{static kind="ClerkRuntimeError";clerkRuntimeError=!0;constructor(t,n){super({...n,message:t}),Object.setPrototypeOf(this,Co.prototype)}};const fi=Object.freeze({InvalidProxyUrlErrorMessage:"The proxyUrl passed to Clerk is invalid. The expected value for proxyUrl is an absolute URL or a relative path with a leading '/'. (key={{url}})",InvalidPublishableKeyErrorMessage:"The publishableKey passed to Clerk is invalid. You can get your Publishable key at https://dashboard.clerk.com/last-active?path=api-keys. (key={{key}})",MissingPublishableKeyErrorMessage:"Missing publishableKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.",MissingSecretKeyErrorMessage:"Missing secretKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.",MissingClerkProvider:"{{source}} can only be used within the <ClerkProvider /> component. Learn more: https://clerk.com/docs/components/clerk-provider"});function Bo({packageName:e,customMessages:t}){let n=e;function r(x,i){if(!i)return`${n}: ${x}`;let a=x;const l=x.matchAll(/{{([a-zA-Z0-9-_]+)}}/g);for(const d of l){const u=(i[d[1]]||"").toString();a=a.replace(`{{${d[1]}}}`,u)}return`${n}: ${a}`}const o={...fi,...t};return{setPackageName({packageName:x}){return typeof x=="string"&&(n=x),this},setMessages({customMessages:x}){return Object.assign(o,x||{}),this},throwInvalidPublishableKeyError(x){throw new Error(r(o.InvalidPublishableKeyErrorMessage,x))},throwInvalidProxyUrl(x){throw new Error(r(o.InvalidProxyUrlErrorMessage,x))},throwMissingPublishableKeyError(){throw new Error(r(o.MissingPublishableKeyErrorMessage))},throwMissingSecretKeyError(){throw new Error(r(o.MissingSecretKeyErrorMessage))},throwMissingClerkProviderError(x){throw new Error(r(o.MissingClerkProvider,x))},throw(x){throw new Error(r(x))}}}const pi={strict_mfa:{afterMinutes:10,level:"multi_factor"},strict:{afterMinutes:10,level:"second_factor"},moderate:{afterMinutes:60,level:"second_factor"},lax:{afterMinutes:1440,level:"second_factor"}},mi=new Set(["first_factor","second_factor","multi_factor"]),Ci=new Set(["strict_mfa","strict","moderate","lax"]),Zr=new Set(["o","org","organization"]),Gr=new Set(["u","user"]),Bi=e=>typeof e=="number"&&e>0,gi=e=>mi.has(e),Ai=e=>Ci.has(e),Jr=e=>typeof e=="number"&&Number.isFinite(e)&&(e===-1||e>=0),F0=e=>e.replace(/^(org:)*/,"org:"),Fi=(e,t)=>{const{orgId:n,orgRole:r,orgPermissions:o}=t,x=e.role!==void 0,i=e.permission!==void 0;return!x&&!i?"skip":x&&typeof e.role!="string"||i&&typeof e.permission!="string"||!n||x&&(typeof r!="string"||!r||F0(r)!==F0(e.role))||i&&(!Array.isArray(o)||!o.includes(F0(e.permission)))?"fail":"pass"},Yr=(e,t)=>{const{org:n,user:r}=ki(e),[o,x]=t.split(":"),i=x!==void 0,a=o,l=x||o;if(i&&!Zr.has(a)&&!Gr.has(a))throw new Error(`Invalid scope: ${a}`);if(i){if(Zr.has(a))return n.includes(l);if(Gr.has(a))return r.includes(l)}return[...n,...r].includes(l)},Di=(e,t)=>{const{features:n,plans:r}=t,o=e.feature!==void 0,x=e.plan!==void 0;if(!o&&!x)return"skip";if(o&&typeof e.feature!="string"||x&&typeof e.plan!="string")return"fail";if(o){if(typeof n!="string"||!n)return"fail";try{if(!Yr(n,e.feature))return"fail"}catch{return"fail"}}if(x){if(typeof r!="string"||!r)return"fail";try{if(!Yr(r,e.plan))return"fail"}catch{return"fail"}}return"pass"},ki=e=>{const t=[],n=[];if(!e)return{org:t,user:n};const r=e.split(",");for(let o=0;o<r.length;o++){const x=r[o].trim(),i=x.indexOf(":");if(i===-1)throw new Error(`Invalid claim element (missing colon): ${x}`);const a=x.slice(0,i),l=x.slice(i+1);a==="o"?t.push(l):a==="u"?n.push(l):(a==="ou"||a==="uo")&&(t.push(l),n.push(l))}return{org:t,user:n}},yi=e=>{if(!e)return!1;const t=o=>typeof o=="string"?pi[o]:o,n=typeof e=="string"&&Ai(e),r=typeof e=="object"&&gi(e.level)&&Bi(e.afterMinutes);return n||r?t.bind(null,e):!1},vi=(e,{factorVerificationAge:t})=>{if(e.reverification===void 0)return"skip";if(!t||!Array.isArray(t)||t.length!==2||!Jr(t[0])||!Jr(t[1]))return"fail";const n=yi(e.reverification);if(!n)return"fail";const{level:r,afterMinutes:o}=n(),[x,i]=t;if(x===-1&&i===-1)return"fail";const a=x!==-1&&o>x,l=i!==-1&&o>i;switch(r){case"first_factor":return a?"pass":"fail";case"second_factor":return i===-1?a?"pass":"fail":l?"pass":"fail";case"multi_factor":return i===-1?a?"pass":"fail":x===-1?"fail":a&&l?"pass":"fail"}},wi=e=>e.some(t=>t==="pass")&&e.every(t=>t==="pass"||t==="skip"),bi=e=>t=>e.userId?wi([Fi(t,e),Di(t,e),vi(t,e)]):!1,ji=({authObject:{sessionId:e,sessionStatus:t,userId:n,actor:r,orgId:o,orgRole:x,orgSlug:i,signOut:a,getToken:l,has:d,sessionClaims:u},options:{treatPendingAsSignedOut:c=!0}})=>{if(e===void 0&&n===void 0)return{actor:void 0,getToken:l,has:()=>!1,isLoaded:!1,isSignedIn:void 0,orgId:void 0,orgRole:void 0,orgSlug:void 0,sessionClaims:void 0,sessionId:e,signOut:a,userId:n};if(e===null&&n===null)return{actor:null,getToken:l,has:()=>!1,isLoaded:!0,isSignedIn:!1,orgId:null,orgRole:null,orgSlug:null,sessionClaims:null,sessionId:e,signOut:a,userId:n};if(c&&t==="pending")return{actor:null,getToken:l,has:()=>!1,isLoaded:!0,isSignedIn:!1,orgId:null,orgRole:null,orgSlug:null,sessionClaims:null,sessionId:null,signOut:a,userId:null};if(e&&u&&n&&o&&x)return{actor:r||null,getToken:l,has:d,isLoaded:!0,isSignedIn:!0,orgId:o,orgRole:x,orgSlug:i||null,sessionClaims:u,sessionId:e,signOut:a,userId:n};if(e&&u&&n&&!o)return{actor:r||null,getToken:l,has:d,isLoaded:!0,isSignedIn:!0,orgId:null,orgRole:null,orgSlug:null,sessionClaims:u,sessionId:e,signOut:a,userId:n}},Qr=(e,t,n)=>!e&&n?_i(n):Si(t),_i=e=>{const t=e.userId,n=e.user,r=e.sessionId,o=e.sessionStatus,x=e.sessionClaims;return{userId:t,user:n,sessionId:r,session:e.session,sessionStatus:o,sessionClaims:x,organization:e.organization,orgId:e.orgId,orgRole:e.orgRole,orgPermissions:e.orgPermissions,orgSlug:e.orgSlug,actor:e.actor,factorVerificationAge:e.factorVerificationAge}},Si=e=>{const t=e.user?e.user.id:e.user,n=e.user,r=e.session?e.session.id:e.session,o=e.session,x=e.session?.status,i=e.session?e.session.lastActiveToken?.jwt?.claims:null,a=e.session?e.session.factorVerificationAge:null,l=o?.actor,d=e.organization,u=e.organization?e.organization.id:e.organization,c=d?.slug,p=d&&n?.organizationMemberships?.find(A=>A.organization.id===u),B=p&&p.permissions;return{userId:t,user:n,sessionId:r,session:o,sessionStatus:x,sessionClaims:i,organization:d,orgId:u,orgRole:p&&p.role,orgSlug:c,orgPermissions:B,actor:l,factorVerificationAge:a}},Pi=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"],go=e=>typeof atob<"u"&&typeof atob=="function"?atob(e):typeof globalThis.Buffer<"u"?globalThis.Buffer.from(e,"base64").toString():e,Ao="pk_live_",Ii="pk_test_";function Fo(e){if(!e.endsWith("$"))return!1;const t=e.slice(0,-1);return t.includes("$")?!1:t.includes(".")}function D0(e,t={}){if(e=e||"",!e||!Xr(e)){if(t.fatal&&!e)throw new Error("Publishable key is missing. Ensure that your publishable key is correctly configured. Double-check your environment configuration for your keys, or access them here: https://dashboard.clerk.com/last-active?path=api-keys");if(t.fatal&&!Xr(e))throw new Error("Publishable key not valid.");return null}const n=e.startsWith(Ao)?"production":"development";let r;try{r=go(e.split("_")[2])}catch{if(t.fatal)throw new Error("Publishable key not valid: Failed to decode key.");return null}if(!Fo(r)){if(t.fatal)throw new Error("Publishable key not valid: Decoded key has invalid format.");return null}let o=r.slice(0,-1);return t.proxyUrl?o=t.proxyUrl:n!=="development"&&t.domain&&t.isSatellite&&(o=`clerk.${t.domain}`),{instanceType:n,frontendApi:o}}function Xr(e=""){try{if(!(e.startsWith(Ao)||e.startsWith(Ii)))return!1;const t=e.split("_");if(t.length!==3)return!1;const n=t[2];return n?Fo(go(n)):!1}catch{return!1}}function Ni(){const e=new Map;return{isDevOrStagingUrl:t=>{if(!t)return!1;const n=typeof t=="string"?t:t.hostname;let r=e.get(n);return r===void 0&&(r=Pi.some(o=>n.endsWith(o)),e.set(n,r)),r}}}const k0={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};var y0={};const es=(e,t)=>{if(typeof process<"u"&&y0&&typeof y0[e]=="string")return y0[e];if(typeof import.meta<"u"&&k0&&typeof k0[e]=="string")return k0[e];try{return globalThis[e]}catch{}return""},Mi=()=>{try{return!1}catch{}return!1},Ti=()=>{try{return!1}catch{}return!1},Oi=()=>{try{return!0}catch{}return!1},Li="METHOD_CALLED",Ri=.1;function Do(e,t){return{event:Li,eventSamplingRate:Ri,payload:{method:e,...t}}}const Ui="ClerkJS:";function $i(){throw new Error(`${Ui} Clerk instance not found. Make sure Clerk is initialized before using any Clerk components.`)}var ts=Object.prototype.hasOwnProperty;function ns(e,t,n){for(n of e.keys())if(Xt(n,t))return n}function Xt(e,t){var n,r,o;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&Xt(e[r],t[r]););return r===-1}if(n===Set){if(e.size!==t.size)return!1;for(r of e)if(o=r,o&&typeof o=="object"&&(o=ns(t,o),!o)||!t.has(o))return!1;return!0}if(n===Map){if(e.size!==t.size)return!1;for(r of e)if(o=r[0],o&&typeof o=="object"&&(o=ns(t,o),!o)||!Xt(r[1],t.get(o)))return!1;return!0}if(n===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(n===DataView){if((r=e.byteLength)===t.byteLength)for(;r--&&e.getInt8(r)===t.getInt8(r););return r===-1}if(ArrayBuffer.isView(e)){if((r=e.byteLength)===t.byteLength)for(;r--&&e[r]===t[r];);return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(ts.call(e,n)&&++r&&!ts.call(t,n)||!(n in t)||!Xt(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}function zi(e,t){if(!e)throw typeof t=="string"?new Error(t):new Error(`${t.displayName} not found`)}const Vt=(e,t)=>{const{assertCtxFn:n=zi}={},r=S.createContext(void 0);return r.displayName=e,[r,()=>{const i=S.useContext(r);return n(i,`${e} not found`),i.value},()=>{const i=S.useContext(r);return i?i.value:{}}]},[Cr,pn]=Vt("ClerkInstanceContext"),[Wi,Vi]=Vt("InitialStateContext");function qi({children:e,initialState:t}){const[n]=g.useState(t),r=S.useMemo(()=>({value:n}),[n]);return S.createElement(Wi.Provider,{value:r},e)}function ko(){const e=Vi();if(e instanceof Promise){if("use"in S&&typeof S.use=="function")return S.use(e);throw new Error("initialState cannot be a promise if React version is less than 19")}return e}S.createContext({});const[Hi]=Vt("CheckoutContext"),Ki=({children:e,...t})=>S.createElement(Hi.Provider,{value:{value:t}},e);function Br(e){if(!S.useContext(Cr)){if(typeof e=="function"){e();return}throw new Error(`${e} can only be used within the <ClerkProvider /> component.
|
|
9
|
+
|
|
10
|
+
Possible fixes:
|
|
11
|
+
1. Ensure that the <ClerkProvider /> is correctly wrapping your application where this component is used.
|
|
12
|
+
2. Check for multiple versions of the \`@clerk/shared\` package in your project. Use a tool like \`npm ls @clerk/shared\` to identify multiple versions, and update your dependencies to only rely on one.
|
|
13
|
+
|
|
14
|
+
Learn more: https://clerk.com/docs/components/clerk-provider`.trim())}}function Zi(e){const t=function(){};let n;return n=new Proxy(t,{get(r,o){if(o!=="then")return o==="toString"?()=>`[${e}]`:o===Symbol.toPrimitive?()=>0:n},apply(){return n},construct(){return n},has(){return!1},set(){return!1}}),n}Zi("ClerkMockQueryClient");function Gi(){const e=pn(),t=ko(),n=g.useCallback(()=>t?.user,[t?.user]);return g.useSyncExternalStore(g.useCallback(r=>e.addListener(r,{skipInitialEmit:!0}),[e]),g.useCallback(()=>!e.loaded||!e.__internal_lastEmittedResources?n():e.__internal_lastEmittedResources.user,[e,n]),n)}const Ji=()=>(Br("useClerk"),pn());typeof window<"u"?S.useLayoutEffect:S.useEffect;const rs="useUser";function Yi(){Br(rs);const e=Gi();return pn().telemetry?.record(Do(rs)),e===void 0?{isLoaded:!1,isSignedIn:void 0,user:void 0}:e===null?{isLoaded:!0,isSignedIn:!1,user:null}:{isLoaded:!0,isSignedIn:!0,user:e}}const ss=Xt;function Qi(e){e||$i()}function Xi(e){const t=e.clerk;if(Qi(t),e.initialState instanceof Promise&&!("use"in S&&typeof S.use=="function"))throw new Error("initialState cannot be a promise if React version is less than 19");const n=S.useMemo(()=>({value:t}),[e.clerkStatus]);return S.createElement(qi,{initialState:e.initialState},S.createElement(Cr.Provider,{value:n},S.createElement(Ki,{value:void 0},e.children)))}const ea=e=>{const t=g.useRef(e);return g.useEffect(()=>{t.current=e},[e]),t.current},Re=(e,t,n)=>{const r=!!n,o=g.useRef(n);g.useEffect(()=>{o.current=n},[n]),g.useEffect(()=>{if(!r||!e)return()=>{};const x=(...i)=>{o.current&&o.current(...i)};return e.on(t,x),()=>{e.off(t,x)}},[r,t,e,o])},yo=S.createContext(null);yo.displayName="ElementsContext";const ta=(e,t)=>{if(!e)throw new Error(`Could not find Elements context; You need to wrap the part of your app that ${t} in an <Elements> provider.`);return e},zn=e=>e!==null&&typeof e=="object",na=(e,t,n)=>zn(e)?Object.keys(e).reduce((r,o)=>{const x=!zn(t)||!vo(e[o],t[o]);return n.includes(o)?(x&&console.warn(`Unsupported prop change: options.${o} is not a mutable property.`),r):x?{...r||{},[o]:e[o]}:r},null):null,os="[object Object]",vo=(e,t)=>{if(!zn(e)||!zn(t))return e===t;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;const r=Object.prototype.toString.call(e)===os;if(r!==(Object.prototype.toString.call(t)===os))return!1;if(!r&&!n)return e===t;const o=Object.keys(e),x=Object.keys(t);if(o.length!==x.length)return!1;const i={};for(let c=0;c<o.length;c+=1)i[o[c]]=!0;for(let c=0;c<x.length;c+=1)i[x[c]]=!0;const a=Object.keys(i);if(a.length!==o.length)return!1;const l=e,d=t,u=c=>vo(l[c],d[c]);return a.every(u)},xs=e=>ta(S.useContext(yo),e),ra=e=>e.charAt(0).toUpperCase()+e.slice(1),sa=(e,t)=>{const n=`${ra(e)}Element`,x=t?i=>{xs(`mounts <${n}>`);const{id:a,className:l}=i;return S.createElement("div",{id:a,className:l})}:({id:i,className:a,fallback:l,options:d={},onBlur:u,onFocus:c,onReady:p,onChange:B,onEscape:A,onClick:k,onLoadError:C,onLoaderStart:b,onNetworksChange:v,onConfirm:F,onCancel:m,onShippingAddressChange:f,onShippingRateChange:D})=>{const h=xs(`mounts <${n}>`),E="elements"in h?h.elements:null,[w,P]=S.useState(null),I=S.useRef(null),j=S.useRef(null),[y,_]=g.useState(!1);Re(w,"blur",u),Re(w,"focus",c),Re(w,"escape",A),Re(w,"click",k),Re(w,"loaderror",C),Re(w,"loaderstart",b),Re(w,"networkschange",v),Re(w,"confirm",F),Re(w,"cancel",m),Re(w,"shippingaddresschange",f),Re(w,"shippingratechange",D),Re(w,"change",B);let L;p&&(L=()=>{_(!0),p(w)}),Re(w,"ready",L),S.useLayoutEffect(()=>{if(I.current===null&&j.current!==null&&E){let M=null;E&&(M=E.create(e,d)),I.current=M,P(M),M&&M.mount(j.current)}},[E,d]);const K=ea(d);return S.useEffect(()=>{if(!I.current)return;const M=na(d,K,["paymentRequest"]);M&&"update"in I.current&&I.current.update(M)},[d,K]),S.useLayoutEffect(()=>()=>{if(I.current&&typeof I.current.destroy=="function")try{I.current.destroy(),I.current=null}catch{}},[]),S.createElement(S.Fragment,null,!y&&l,S.createElement("div",{id:i,style:{height:y?"unset":"0px",visibility:y?"visible":"hidden"},className:a,ref:j}))};return x.displayName=n,x.__elementType=e,x};sa("payment",typeof window>"u");Vt("PaymentElementContext");Vt("StripeUtilsContext");const[Bh,,oa]=Vt("PortalProvider"),xa=()=>{const e=oa();return e&&"getContainer"in e&&e.getContainer?e.getContainer:()=>null},nt=Bo({packageName:"@clerk/react"});function ia(e){nt.setMessages(e).setPackageName(e)}const mn=pn,Cn=e=>{Br(()=>{nt.throwMissingClerkProviderError({source:e})})};var Bn=Qx();const aa=ao(Bn),la=hi({__proto__:null,default:aa},[Bn]);function v0(e,t,n){if(typeof e=="function")return e(t);if(typeof e<"u")return e;if(typeof n<"u")return n}const Me=e=>{Mi()&&console.error(`Clerk: ${e}`)},is=(e,...t)=>{const n={...e};for(const r of t)delete n[r];return n};function Tt(){return typeof window<"u"}const ca="You've added multiple <ClerkProvider> components in your React component tree. Wrap your components in a single <ClerkProvider>.",da=e=>`You've passed multiple children components to <${e}/>. You can only pass a single child component or text.`,ua="Invalid state. Feel free to submit a bug or reach out to support here: https://clerk.com/contact/support",w0="Unsupported usage of isSatellite, domain or proxyUrl. The usage of isSatellite, domain or proxyUrl as function is not supported in non-browser environments.",ha="<UserProfile.Page /> component needs to be a direct child of `<UserProfile />` or `<UserButton />`.",Ea="<UserProfile.Link /> component needs to be a direct child of `<UserProfile />` or `<UserButton />`.",fa="<OrganizationProfile.Page /> component needs to be a direct child of `<OrganizationProfile />` or `<OrganizationSwitcher />`.",pa="<OrganizationProfile.Link /> component needs to be a direct child of `<OrganizationProfile />` or `<OrganizationSwitcher />`.",ma=e=>`<${e} /> can only accept <${e}.Page /> and <${e}.Link /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.`,Ca=e=>`Missing props. <${e}.Page /> component requires the following props: url, label, labelIcon, alongside with children to be rendered inside the page.`,Ba=e=>`Missing props. <${e}.Link /> component requires the following props: url, label and labelIcon.`,ga="<UserButton /> can only accept <UserButton.UserProfilePage />, <UserButton.UserProfileLink /> and <UserButton.MenuItems /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.",Aa="<UserButton.MenuItems /> component can only accept <UserButton.Action /> and <UserButton.Link /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.",Fa="<UserButton.MenuItems /> component needs to be a direct child of `<UserButton />`.",Da="<UserButton.Action /> component needs to be a direct child of `<UserButton.MenuItems />`.",ka="<UserButton.Link /> component needs to be a direct child of `<UserButton.MenuItems />`.",ya="Missing props. <UserButton.Link /> component requires the following props: href, label and labelIcon.",va="Missing props. <UserButton.Action /> component requires the following props: label.",gn=e=>t=>{try{return S.Children.only(e)}catch{const n=S.Children.toArray(e);return n.length===1&&S.isValidElement(n[0])?n[0]:nt.throw(da(t))}},An=(e,t)=>(e||(e=t),typeof e=="string"&&(e=S.createElement("button",null,e)),e),Fn=e=>(...t)=>{if(e&&typeof e=="function")return e(...t)},wa=e=>es(`VITE_${e}`)||es(e),ba=(e,t)=>e!==void 0?e:wa(t)||void 0,ja=e=>{const t=ba(e.publishableKey,"CLERK_PUBLISHABLE_KEY");return{...e,...t!==void 0&&{publishableKey:t}}};function as(e){return typeof e=="function"}const en=e=>{const[t,n]=g.useState(new Map),r=g.useRef(t),o=g.useRef(new Map),x=g.useRef(new Map);r.current=t,o.current=new Map(e.map(a=>[a.id,a.component]));const i=new Set(e.map(a=>a.id));return x.current.forEach((a,l)=>{i.has(l)||x.current.delete(l)}),e.map(a=>{const l=a.id,d=x.current.get(l);if(d)return d;const u=()=>{const p=r.current.get(l),B=o.current.get(l);return p?Bn.createPortal(B,p):null},c={id:a.id,mount:p=>n(B=>new Map(B).set(l,p)),unmount:()=>n(p=>{const B=new Map(p);return B.set(l,null),B}),portal:u};return x.current.set(l,c),c})},Ne=(e,t)=>!!e&&S.isValidElement(e)&&e?.type===t,wo=(e,t)=>_o({children:e,reorderItemsLabels:["account","security","billing","apiKeys"],LinkComponent:kn,PageComponent:Dn,MenuItemsComponent:c0,componentName:"UserProfile"},t),bo=(e,t)=>_o({children:e,reorderItemsLabels:["general","members","billing","apiKeys"],LinkComponent:u0,PageComponent:d0,componentName:"OrganizationProfile"},t),jo=e=>{const t=[],n=[u0,d0,c0,Dn,kn];return S.Children.forEach(e,r=>{n.some(o=>Ne(r,o))||t.push(r)}),t},_o=(e,t)=>{const{children:n,LinkComponent:r,PageComponent:o,MenuItemsComponent:x,reorderItemsLabels:i,componentName:a}=e,{allowForAnyChildren:l=!1}=t||{},d=[],u=new Map;S.Children.forEach(n,F=>{if(!Ne(F,o)&&!Ne(F,r)&&!Ne(F,x)){F&&!l&&Me(ma(a));return}const{props:m}=F,{children:f,label:D,url:h,labelIcon:E}=m,w=F.key;if(Ne(F,o))if(cs(m,i))d.push({label:D});else if(b0(m))d.push({label:D,labelIcon:E,children:f,url:h,portalId:ls("page",m,w,u)});else{Me(Ca(a));return}if(Ne(F,r))if(j0(m))d.push({label:D,labelIcon:E,url:h,portalId:ls("link",m,w,u)});else{Me(Ba(a));return}});const c=[],p=[],B=[];d.forEach((F,m)=>{if(b0(F)){c.push({component:F.children,id:F.portalId||m}),p.push({component:F.labelIcon,id:F.portalId||m});return}j0(F)&&B.push({component:F.labelIcon,id:F.portalId||m})});const A=en(c),k=en(p),C=en(B),b=[],v=[];return d.forEach((F,m)=>{if(cs(F,i)){b.push({label:F.label});return}if(b0(F)){const{portal:f,mount:D,unmount:h}=A.find(I=>I.id===(F.portalId||m)),{portal:E,mount:w,unmount:P}=k.find(I=>I.id===(F.portalId||m));b.push({label:F.label,url:F.url,mount:D,unmount:h,mountIcon:w,unmountIcon:P}),v.push({key:`content:${F.portalId||m}`,portal:f}),v.push({key:`label:${F.portalId||m}`,portal:E});return}if(j0(F)){const{portal:f,mount:D,unmount:h}=C.find(E=>E.id===(F.portalId||m));b.push({label:F.label,url:F.url,mountIcon:D,unmountIcon:h}),v.push({key:`label:${F.portalId||m}`,portal:f});return}}),{customPages:b,customPagesPortals:v}},ls=(e,t,n,r)=>{if(n!=null)return`${e}:key:${n}`;const o=`${e}:${t.label}:${t.url}`,x=r.get(o)??0;return r.set(o,x+1),`${o}:${x}`},cs=(e,t)=>{const{children:n,label:r,url:o,labelIcon:x}=e;return!n&&!o&&!x&&t.some(i=>i===r)},b0=e=>{const{children:t,label:n,url:r,labelIcon:o}=e;return!!t&&!!r&&!!o&&!!n},j0=e=>{const{children:t,label:n,url:r,labelIcon:o}=e;return!t&&!!r&&!!o&&!!n},_a=(e,t)=>Sa({children:e,reorderItemsLabels:["manageAccount","signOut"],MenuItemsComponent:c0,MenuActionComponent:Po,MenuLinkComponent:Io,UserProfileLinkComponent:kn,UserProfilePageComponent:Dn,allowForAnyChildren:t?.allowForAnyChildren??!1}),Sa=({children:e,MenuItemsComponent:t,MenuActionComponent:n,MenuLinkComponent:r,UserProfileLinkComponent:o,UserProfilePageComponent:x,reorderItemsLabels:i,allowForAnyChildren:a=!1})=>{const l=[],d=[],u=[],c=new Map;S.Children.forEach(e,C=>{if(!Ne(C,t)&&!Ne(C,o)&&!Ne(C,x)){C&&!a&&Me(ga);return}if(Ne(C,o)||Ne(C,x))return;const{props:b}=C;S.Children.forEach(b.children,v=>{if(!Ne(v,n)&&!Ne(v,r)){v&&Me(Aa);return}const{props:F}=v,m=v.key,{label:f,labelIcon:D,href:h,onClick:E,open:w}=F;if(Ne(v,n))if(ds(F,i))l.push({label:f});else if(S0(F)){const P={label:f,labelIcon:D};if(E!==void 0)l.push({...P,onClick:E,portalId:_0("action",F,m,c)});else if(w!==void 0)l.push({...P,open:w.startsWith("/")?w:`/${w}`,portalId:_0("action",F,m,c)});else{Me("Custom menu item must have either onClick or open property");return}}else{Me(va);return}if(Ne(v,r))if(P0(F))l.push({label:f,labelIcon:D,href:h,portalId:_0("link",F,m,c)});else{Me(ya);return}})});const p=[],B=[];l.forEach((C,b)=>{S0(C)&&p.push({component:C.labelIcon,id:C.portalId||b}),P0(C)&&B.push({component:C.labelIcon,id:C.portalId||b})});const A=en(p),k=en(B);return l.forEach((C,b)=>{if(ds(C,i)&&d.push({label:C.label}),S0(C)){const{portal:v,mount:F,unmount:m}=A.find(D=>D.id===(C.portalId||b)),f={label:C.label,mountIcon:F,unmountIcon:m};"onClick"in C?f.onClick=C.onClick:"open"in C&&(f.open=C.open),d.push(f),u.push({key:`icon:${C.portalId||b}`,portal:v})}if(P0(C)){const{portal:v,mount:F,unmount:m}=k.find(f=>f.id===(C.portalId||b));d.push({label:C.label,href:C.href,mountIcon:F,unmountIcon:m}),u.push({key:`icon:${C.portalId||b}`,portal:v})}}),{customMenuItems:d,customMenuItemsPortals:u}},_0=(e,t,n,r)=>{if(n!=null)return`${e}:key:${n}`;const o=t.href||t.open||"",x=`${e}:${t.label}:${o}`,i=r.get(x)??0;return r.set(x,i+1),`${x}:${i}`},ds=(e,t)=>{const{children:n,label:r,onClick:o,labelIcon:x}=e;return!n&&!o&&!x&&t.some(i=>i===r)},S0=e=>{const{label:t,labelIcon:n,onClick:r,open:o}=e;return!!n&&!!t&&(typeof r=="function"||typeof o=="string")},P0=e=>{const{label:t,href:n,labelIcon:r}=e;return!!n&&!!r&&!!t},Pa=e=>{const t=e?.isReady;return n=>new Promise((r,o)=>{const{root:x=document?.body,selector:i,timeout:a=0}=n;if(!x){o(new Error("No root element provided"));return}let l=x;if(i&&(l=x?.querySelector(i)),t(l,i)){r();return}const d=new MutationObserver(u=>{for(const c of u)if(!l&&i&&(l=x?.querySelector(i)),(e.childList&&c.type==="childList"||e.attributes&&c.type==="attributes")&&t(l,i)){d.disconnect(),r();return}});d.observe(x,e),a>0&&setTimeout(()=>{d.disconnect(),o(new Error(`Timeout waiting for ${i}`))},a)})},Ia=Pa({childList:!0,subtree:!0,isReady:(e,t)=>!!e?.childElementCount&&e?.matches?.(t)&&e.childElementCount>0});function Se(e,t){const n=g.useRef(),[r,o]=g.useState("rendering");return g.useEffect(()=>{if(!e)throw new Error("Clerk: no component name provided, unable to detect mount.");if(typeof window<"u"&&!n.current){const x=`[data-clerk-component="${e}"]`,i=t?.selector;n.current=Ia({selector:i?x+i:x}).then(()=>{o("rendered")}).catch(()=>{o("error")})}},[e,t?.selector]),r}const jn=e=>"mount"in e,us=e=>"open"in e,hs=e=>e?.map(({mountIcon:t,unmountIcon:n,...r})=>r);var ye=class extends S.PureComponent{constructor(...e){super(...e),this.rootRef=S.createRef()}componentDidUpdate(e){if(!jn(e)||!jn(this.props))return;const t=is(e.props||{},"customPages","customMenuItems","children"),n=is(this.props.props||{},"customPages","customMenuItems","children"),r=e.props?.customPages?.length!==this.props.props?.customPages?.length,o=e.props?.customMenuItems?.length!==this.props.props?.customMenuItems?.length,x=hs(e.props?.customMenuItems),i=hs(this.props.props?.customMenuItems);(!ss(t,n)||!ss(x,i)||r||o)&&this.rootRef.current&&this.props.updateProps({node:this.rootRef.current,props:this.props.props})}componentDidMount(){this.rootRef.current&&(jn(this.props)&&this.props.mount(this.rootRef.current,this.props.props),us(this.props)&&this.props.open(this.props.props))}componentWillUnmount(){this.rootRef.current&&(jn(this.props)&&this.props.unmount(this.rootRef.current),us(this.props)&&this.props.close())}render(){const{hideRootHtmlElement:e=!1}=this.props,t={ref:this.rootRef,...this.props.rootProps,...this.props.component&&{"data-clerk-component":this.props.component}};return S.createElement(S.Fragment,null,!e&&S.createElement("div",t),this.props.children)}};const he=(e,t)=>{const n=(typeof t=="string"?t:t?.component)||e.displayName||e.name||"Component";e.displayName=n;const r=typeof t=="string"?void 0:t,o=x=>{Cn(n||"withClerk");const i=mn(),a=xa();return!i.loaded&&!r?.renderWhileLoading?null:S.createElement(e,{getContainer:a,...x,component:n,clerk:i})};return o.displayName=`withClerk(${n})`,o},l0=e=>S.createElement(S.Fragment,null,e?.customPagesPortals?.map(({key:t,portal:n})=>g.createElement(n,{key:t})),e?.customMenuItemsPortals?.map(({key:t,portal:n})=>g.createElement(n,{key:t})));he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}};return S.createElement(S.Fragment,null,o&&n,e.loaded&&S.createElement(ye,{component:t,mount:e.mountSignIn,unmount:e.unmountSignIn,updateProps:e.__internal_updateProps,props:r,rootProps:x}))},{component:"SignIn",renderWhileLoading:!0});he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}};return S.createElement(S.Fragment,null,o&&n,e.loaded&&S.createElement(ye,{component:t,mount:e.mountSignUp,unmount:e.unmountSignUp,updateProps:e.__internal_updateProps,props:r,rootProps:x}))},{component:"SignUp",renderWhileLoading:!0});function Dn({children:e}){return Me(ha),S.createElement(S.Fragment,null,e)}function kn({children:e}){return Me(Ea),S.createElement(S.Fragment,null,e)}const Na=he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}},{customPages:i,customPagesPortals:a}=wo(r.children);return S.createElement(S.Fragment,null,o&&n,S.createElement(ye,{component:t,mount:e.mountUserProfile,unmount:e.unmountUserProfile,updateProps:e.__internal_updateProps,props:{...r,customPages:i},rootProps:x},S.createElement(l0,{customPagesPortals:a})))},{component:"UserProfile",renderWhileLoading:!0});Object.assign(Na,{Page:Dn,Link:kn});const So=g.createContext({mount:()=>{},unmount:()=>{},updateProps:()=>{}}),Ma=he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}},{customPages:i,customPagesPortals:a}=wo(r.children,{allowForAnyChildren:!!r.__experimental_asProvider}),l={...r.userProfileProps,customPages:i},{customMenuItems:d,customMenuItemsPortals:u}=_a(r.children,{allowForAnyChildren:!!r.__experimental_asProvider}),c=jo(r.children),p={mount:e.mountUserButton,unmount:e.unmountUserButton,updateProps:e.__internal_updateProps,props:{...r,userProfileProps:l,customMenuItems:d}},B={customPagesPortals:a,customMenuItemsPortals:u};return S.createElement(So.Provider,{value:p},o&&n,e.loaded&&S.createElement(ye,{component:t,...p,hideRootHtmlElement:!!r.__experimental_asProvider,rootProps:x},r.__experimental_asProvider?c:null,S.createElement(l0,B)))},{component:"UserButton",renderWhileLoading:!0});function c0({children:e}){return Me(Fa),S.createElement(S.Fragment,null,e)}function Po({children:e}){return Me(Da),S.createElement(S.Fragment,null,e)}function Io({children:e}){return Me(ka),S.createElement(S.Fragment,null,e)}function Ta(e){const t=g.useContext(So),n={...t,props:{...t.props,...e}};return S.createElement(ye,n)}Object.assign(Ma,{UserProfilePage:Dn,UserProfileLink:kn,MenuItems:c0,Action:Po,Link:Io,__experimental_Outlet:Ta});function d0({children:e}){return Me(fa),S.createElement(S.Fragment,null,e)}function u0({children:e}){return Me(pa),S.createElement(S.Fragment,null,e)}const Oa=he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}},{customPages:i,customPagesPortals:a}=bo(r.children);return S.createElement(S.Fragment,null,o&&n,e.loaded&&S.createElement(ye,{component:t,mount:e.mountOrganizationProfile,unmount:e.unmountOrganizationProfile,updateProps:e.__internal_updateProps,props:{...r,customPages:i},rootProps:x},S.createElement(l0,{customPagesPortals:a})))},{component:"OrganizationProfile",renderWhileLoading:!0});Object.assign(Oa,{Page:d0,Link:u0});he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}};return S.createElement(S.Fragment,null,o&&n,e.loaded&&S.createElement(ye,{component:t,mount:e.mountCreateOrganization,unmount:e.unmountCreateOrganization,updateProps:e.__internal_updateProps,props:r,rootProps:x}))},{component:"CreateOrganization",renderWhileLoading:!0});const No=g.createContext({mount:()=>{},unmount:()=>{},updateProps:()=>{}}),La=he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}},{customPages:i,customPagesPortals:a}=bo(r.children,{allowForAnyChildren:!!r.__experimental_asProvider}),l={...r.organizationProfileProps,customPages:i},d=jo(r.children),u={mount:e.mountOrganizationSwitcher,unmount:e.unmountOrganizationSwitcher,updateProps:e.__internal_updateProps,props:{...r,organizationProfileProps:l},rootProps:x,component:t};return e.__experimental_prefetchOrganizationSwitcher(),S.createElement(No.Provider,{value:u},S.createElement(S.Fragment,null,o&&n,e.loaded&&S.createElement(ye,{...u,hideRootHtmlElement:!!r.__experimental_asProvider},r.__experimental_asProvider?d:null,S.createElement(l0,{customPagesPortals:a}))))},{component:"OrganizationSwitcher",renderWhileLoading:!0});function Ra(e){const t=g.useContext(No),n={...t,props:{...t.props,...e}};return S.createElement(ye,n)}Object.assign(La,{OrganizationProfilePage:d0,OrganizationProfileLink:u0,__experimental_Outlet:Ra});he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}};return S.createElement(S.Fragment,null,o&&n,e.loaded&&S.createElement(ye,{component:t,mount:e.mountOrganizationList,unmount:e.unmountOrganizationList,updateProps:e.__internal_updateProps,props:r,rootProps:x}))},{component:"OrganizationList",renderWhileLoading:!0});he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}};return S.createElement(S.Fragment,null,o&&n,e.loaded&&S.createElement(ye,{component:t,open:e.openGoogleOneTap,close:e.closeGoogleOneTap,updateProps:e.__internal_updateProps,props:r,rootProps:x}))},{component:"GoogleOneTap",renderWhileLoading:!0});he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}};return S.createElement(S.Fragment,null,o&&n,e.loaded&&S.createElement(ye,{component:t,mount:e.mountWaitlist,unmount:e.unmountWaitlist,updateProps:e.__internal_updateProps,props:r,rootProps:x}))},{component:"Waitlist",renderWhileLoading:!0});he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t,{selector:'[data-component-status="ready"]'})==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}};return S.createElement(S.Fragment,null,o&&n,e.loaded&&S.createElement(ye,{component:t,mount:e.mountPricingTable,unmount:e.unmountPricingTable,updateProps:e.__internal_updateProps,props:r,rootProps:x}))},{component:"PricingTable",renderWhileLoading:!0});he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}};return S.createElement(S.Fragment,null,o&&n,e.loaded&&S.createElement(ye,{component:t,mount:e.mountAPIKeys,unmount:e.unmountAPIKeys,updateProps:e.__internal_updateProps,props:r,rootProps:x}))},{component:"ApiKeys",renderWhileLoading:!0});he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}};return S.createElement(S.Fragment,null,o&&n,e.loaded&&S.createElement(ye,{component:t,mount:e.__internal_mountOAuthConsent,unmount:e.__internal_unmountOAuthConsent,updateProps:e.__internal_updateProps,props:r,rootProps:x}))},{component:"OAuthConsent",renderWhileLoading:!0});he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}};return S.createElement(S.Fragment,null,o&&n,e.loaded&&S.createElement(ye,{component:t,mount:e.mountUserAvatar,unmount:e.unmountUserAvatar,updateProps:e.__internal_updateProps,props:r,rootProps:x}))},{component:"UserAvatar",renderWhileLoading:!0});he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}};return S.createElement(S.Fragment,null,o&&n,e.loaded&&S.createElement(ye,{component:t,mount:e.mountTaskChooseOrganization,unmount:e.unmountTaskChooseOrganization,updateProps:e.__internal_updateProps,props:r,rootProps:x}))},{component:"TaskChooseOrganization",renderWhileLoading:!0});he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}};return S.createElement(S.Fragment,null,o&&n,e.loaded&&S.createElement(ye,{component:t,mount:e.mountTaskResetPassword,unmount:e.unmountTaskResetPassword,updateProps:e.__internal_updateProps,props:r,rootProps:x}))},{component:"TaskResetPassword",renderWhileLoading:!0});he(({clerk:e,component:t,fallback:n,...r})=>{const o=Se(t)==="rendering"||!e.loaded,x={...o&&n&&{style:{display:"none"}}};return S.createElement(S.Fragment,null,o&&n,e.loaded&&S.createElement(ye,{component:t,mount:e.mountTaskSetupMFA,unmount:e.unmountTaskSetupMFA,updateProps:e.__internal_updateProps,props:r,rootProps:x}))},{component:"TaskSetupMFA",renderWhileLoading:!0});const Ua={actor:void 0,factorVerificationAge:null,orgId:void 0,orgPermissions:void 0,orgRole:void 0,orgSlug:void 0,sessionClaims:void 0,sessionId:void 0,sessionStatus:void 0,userId:void 0};function $a(){const e=pn(),t=ko(),n=g.useCallback(()=>t,[t]),r=g.useSyncExternalStore(g.useCallback(o=>e.addListener(o,{skipInitialEmit:!0}),[e]),g.useCallback(()=>!e.loaded||!e.__internal_lastEmittedResources?n():e.__internal_lastEmittedResources,[e,n]),n);return g.useMemo(()=>r?za(Wa(r)?Qr(!1,{},r):Qr(!0,r,void 0)):Ua,[r])}function za(e){return{sessionId:e.sessionId,sessionStatus:e.sessionStatus,sessionClaims:e.sessionClaims,userId:e.userId,actor:e.actor,orgId:e.orgId,orgRole:e.orgRole,orgSlug:e.orgSlug,orgPermissions:e.orgPermissions,factorVerificationAge:e.factorVerificationAge}}function Wa(e){return!("client"in e)}const Mo=e=>new Promise(t=>{const n=r=>{["ready","degraded"].includes(r)&&(t(),e.off("status",n))};e.on("status",n,{notify:!0})}),Va=e=>async t=>{if(!Tt())throw new mr("useAuth().getToken() can only be used in browser environments. To access auth data server-side, see the Auth object reference doc: https://clerk.com/docs/reference/backend/types/auth-object",{code:"clerk_runtime_not_browser"});return await Mo(e),e.session?e.session.getToken(t):null},qa=e=>async(...t)=>(await Mo(e),e.signOut(...t)),Ha=(e={})=>{Cn("useAuth");const{treatPendingAsSignedOut:t}=e??{},n=$a(),r=mn(),o=g.useCallback(Va(r),[r]),x=g.useCallback(qa(r),[r]);return r.telemetry?.record(Do("useAuth",{treatPendingAsSignedOut:t})),Ka({...n,getToken:o,signOut:x},{treatPendingAsSignedOut:t})};function Ka(e,{treatPendingAsSignedOut:t=!0}={}){const{userId:n,orgId:r,orgRole:o,has:x,signOut:i,getToken:a,orgPermissions:l,factorVerificationAge:d,sessionClaims:u}=e??{},c=g.useCallback(B=>x?x(B):bi({userId:n,orgId:r,orgRole:o,orgPermissions:l,factorVerificationAge:d,features:u?.fea||"",plans:u?.pla||""})(B),[x,n,r,o,l,d,u]),p=ji({authObject:{...e,getToken:a,signOut:i,has:c},options:{treatPendingAsSignedOut:t}});return p||nt.throw(ua)}const Za={initialDelay:125,maxDelayBetweenRetries:0,factor:2,shouldRetry:(e,t)=>t<5,retryImmediately:!1,jitter:!0},Ga=100,To=async e=>new Promise(t=>setTimeout(t,e)),Oo=(e,t)=>t?e*(1+Math.random()):e,Ja=e=>{let t=0;const n=()=>{const r=e.initialDelay,o=e.factor;let x=r*Math.pow(o,t);return x=Oo(x,e.jitter),Math.min(e.maxDelayBetweenRetries||x,x)};return async()=>{await To(n()),t++}},Ya=async(e,t={})=>{let n=0;const{shouldRetry:r,initialDelay:o,maxDelayBetweenRetries:x,factor:i,retryImmediately:a,jitter:l,onBeforeRetry:d}={...Za,...t},u=Ja({initialDelay:o,maxDelayBetweenRetries:x,factor:i,jitter:l});for(;;)try{return await e()}catch(c){if(n++,!r(c,n))throw c;d&&await d(n),a&&n===1?await To(Oo(Ga,l)):await u()}},Qa="loadScript cannot be called when document does not exist",Xa="loadScript cannot be called without a src";async function Lo(e="",t){const{async:n,defer:r,beforeLoad:o,crossOrigin:x,nonce:i}=t||{};return Ya(()=>new Promise((l,d)=>{e||d(new Error(Xa)),(!document||!document.body)&&d(new Error(Qa));const u=document.createElement("script");x&&u.setAttribute("crossorigin",x),u.async=n||!1,u.defer=r||!1,u.addEventListener("load",()=>{u.remove(),l(u)}),u.addEventListener("error",c=>{u.remove(),d(c.error??new Error(`failed to load script: ${e}`))}),u.src=e,i&&(u.nonce=i),o?.(u),document.body.appendChild(u)}),{shouldRetry:(l,d)=>d<=5})}function el(e){return e?tl(e)||yn(e):!0}function tl(e){return/^http(s)?:\/\//.test(e||"")}function yn(e){return e.startsWith("/")}function nl(e){return e?!yn(e)||typeof window>"u"||!window.location?.origin?e:new URL(e,window.location.origin).toString():""}function rl(e){if(!e)return"";let t;if(e.match(/^(clerk\.)+\w*$/))t=/(clerk\.)*(?=clerk\.)/;else{if(e.match(/\.clerk.accounts/))return e;t=/^(clerk\.)*/gi}return`clerk.${e.replace(t,"")}`}const Ro=(e,t="6.29.1")=>{if(e)return e;const n=sl(t);return n?n==="snapshot"?t:n:ol(t)},sl=e=>e.trim().replace(/^v/,"").match(/-(.+?)(\.|$)/)?.[1],ol=e=>e.trim().replace(/^v/,"").split(".")[0],{isDevOrStagingUrl:xl}=Ni(),gr=Bo({packageName:"@clerk/shared"});function Uo(e){return typeof window>"u"||!window[e]?!1:!!window[e]}const I0=()=>Uo("Clerk"),N0=()=>Uo("__internal_ClerkUICtor");function $o(e){if(typeof window>"u"||!window.performance)return!1;const t=performance.getEntriesByName(e,"resource");if(t.length===0)return!1;const n=t[t.length-1];return n.transferSize===0&&n.decodedBodySize===0&&(n.responseEnd===0||n.responseEnd>0&&n.responseStart>0||"responseStatus"in n&&(n.responseStatus>=400||n.responseStatus===0))}const il=async e=>{const t=e?.scriptLoadTimeout??15e3,n=i=>new mr("Failed to load Clerk JS"+(i?.message?`, ${i.message}`:""),{code:"failed_to_load_clerk_js",cause:i});if(I0())return null;if(!e?.publishableKey)return gr.throwMissingPublishableKeyError(),null;const r=ll(e),o=document.querySelector("script[data-clerk-js-script]");if(o)if($o(r))o.remove();else try{return await Wn(t,I0,n(),o),null}catch{o.remove()}const x=Wn(t,I0,n());return Lo(r,{async:!0,crossOrigin:"anonymous",nonce:e.nonce,beforeLoad:Wo(zo(e))}).catch(i=>{throw n(i)}),x},al=async e=>{const t=e?.scriptLoadTimeout??15e3,n=i=>new mr("Failed to load Clerk UI"+(i?.message?`, ${i.message}`:""),{code:"failed_to_load_clerk_ui",cause:i});if(N0())return null;if(!e?.publishableKey)return gr.throwMissingPublishableKeyError(),null;const r=cl(e),o=document.querySelector("script[data-clerk-ui-script]");if(o)if($o(r))o.remove();else try{return await Wn(t,N0,n(),o),null}catch{o.remove()}const x=Wn(t,N0,n());return Lo(r,{async:!0,crossOrigin:"anonymous",nonce:e.nonce,beforeLoad:Wo(dl(e))}).catch(i=>{throw n(i)}),x},ll=e=>{const{__internal_clerkJSUrl:t,__internal_clerkJSVersion:n,proxyUrl:r,domain:o,publishableKey:x}=e;if(t)return t;const i=Ro(n);return r&&yn(r)?Vo(r,"clerk-js",i,"clerk.browser.js"):`https://${qo({publishableKey:x,proxyUrl:r,domain:o})}/npm/@clerk/clerk-js@${i}/dist/clerk.browser.js`},cl=e=>{const{__internal_clerkUIUrl:t,__internal_clerkUIVersion:n,proxyUrl:r,domain:o,publishableKey:x}=e;if(t)return t;const i=Ro(n,"1.30.3");return r&&yn(r)?Vo(r,"ui",i,"ui.browser.js"):`https://${qo({publishableKey:x,proxyUrl:r,domain:o})}/npm/@clerk/ui@${i}/dist/ui.browser.js`},zo=e=>{const t={};return e.publishableKey&&(t["data-clerk-publishable-key"]=e.publishableKey),e.proxyUrl&&(t["data-clerk-proxy-url"]=e.proxyUrl),e.domain&&(t["data-clerk-domain"]=e.domain),e.nonce&&(t.nonce=e.nonce),t},dl=e=>zo(e),Wo=e=>t=>{for(const n in e)t.setAttribute(n,e[n])},ul=e=>{for(;e.endsWith("/");)e=e.slice(0,-1);return e},Vo=(e,t,n,r)=>`${ul(e)}/npm/@clerk/${t}@${n}/dist/${r}`,qo=e=>{const{proxyUrl:t,domain:n,publishableKey:r}=e;if(t&&el(t)){const o=nl(t);return yn(o)?D0(r)?.frontendApi||"":o.replace(/http(s)?:\/\//,"")}else return n&&!xl(D0(r)?.frontendApi||"")?rl(n):D0(r)?.frontendApi||""};function Wn(e,t,n,r){return new Promise((o,x)=>{let i=!1;const a=(p,B)=>{clearTimeout(p),clearInterval(B)};r?.addEventListener("error",()=>{a(u,c),x(n)});const l=()=>{i||t()&&(i=!0,a(u,c),o(null))},u=setTimeout(()=>{i||(i=!0,a(u,c),t()?o(null):x(n))},e);l();const c=setInterval(()=>{if(i){clearInterval(c);return}l()},100)})}function hl(e){gr.setPackageName({packageName:e})}const Es=new Set,h0=(e,t,n)=>{const r=Ti()||Oi(),o=e;Es.has(o)||r||(Es.add(o),console.warn(`Clerk - DEPRECATION WARNING: "${e}" is deprecated and will be removed in the next major release.
|
|
15
|
+
${t}`))},fs=(e,t,n,r,o)=>{const{notify:x}=o||{};let i=e.get(n);i||(i=[],e.set(n,i)),i.push(r),x&&t.has(n)&&r(t.get(n))},ps=(e,t,n)=>(e.get(t)||[]).map(r=>r(n)),ms=(e,t,n)=>{const r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},El=()=>{const e=new Map,t=new Map,n=new Map;return{on:(...o)=>fs(e,t,...o),prioritizedOn:(...o)=>fs(n,t,...o),emit:(o,x)=>{t.set(o,x),ps(n,o,x),ps(e,o,x)},off:(...o)=>ms(e,...o),prioritizedOff:(...o)=>ms(n,...o),internal:{retrieveListeners:o=>e.get(o)||[]}}},jt={Status:"status"},fl=()=>El(),pl="clerk:beforeunload",Z0=["http:","https:","wails:","chrome-extension:"],ml=/^[/\\][/\\]/;function Cl(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;let n="";for(let r=t;r<e.length;r++){const o=e.charCodeAt(r);o!==9&&o!==10&&o!==13&&(n+=e[r])}return n}function Bl(e,t){if(typeof e=="string"&&ml.test(Cl(e))){console.warn(`Clerk: scheme-relative navigation to "${e}" is not allowed. Provide a same-origin path or an absolute URL.`);return}const n=new URL(e,window.location.href);if(!(t?.allowedProtocols??Z0).includes(n.protocol)){console.warn(`Clerk: "${n.protocol}" is not a valid navigation protocol. Aborting navigation. If you think this is a mistake, please open an issue.`);return}window.dispatchEvent(new CustomEvent(pl)),window.location.href=n.href}function gl(e){const t=e.match(/^(\d+)\.(\d+)\.(\d+)/);if(!t)return null;const[,n,r,o]=t;return{major:parseInt(n,10),minor:parseInt(r,10),patch:parseInt(o,10)}}function Al(e,t){const{major:n,minor:r,patch:o}=e;return t.some(([x,i,a,l])=>n!==x?!1:a===-1?r>i||r===i&&o>=l:r===a&&o>=l)}function Fl(e,t){const n=gl(e);return n?Al(n,t):!1}const Dl=({children:e})=>(Cn("ClerkLoaded"),mn().loaded?e:null),kl=({children:e})=>(Cn("ClerkLoading"),mn().status!=="loading"?null:e),yl=({children:e})=>(Cn("ClerkFailed"),mn().status!=="error"?null:e);he(({clerk:e,...t})=>{const{client:n,session:r}=e,o=(n.signedInSessions?.length??0)>0;return S.useEffect(()=>{r===null&&o?e.redirectToAfterSignOut():e.redirectToSignIn(t)},[]),null},"RedirectToSignIn");he(({clerk:e,...t})=>(S.useEffect(()=>{e.redirectToSignUp(t)},[]),null),"RedirectToSignUp");he(({clerk:e,...t})=>(S.useEffect(()=>{e.redirectToTasks(t)},[]),null),"RedirectToTasks");he(({clerk:e})=>(S.useEffect(()=>{h0("RedirectToUserProfile","Use the `redirectToUserProfile()` method instead."),e.redirectToUserProfile()},[]),null),"RedirectToUserProfile");he(({clerk:e})=>(S.useEffect(()=>{h0("RedirectToOrganizationProfile","Use the `redirectToOrganizationProfile()` method instead."),e.redirectToOrganizationProfile()},[]),null),"RedirectToOrganizationProfile");he(({clerk:e})=>(S.useEffect(()=>{h0("RedirectToCreateOrganization","Use the `redirectToCreateOrganization()` method instead."),e.redirectToCreateOrganization()},[]),null),"RedirectToCreateOrganization");he(({clerk:e,...t})=>(S.useEffect(()=>{e.handleRedirectCallback(t)},[]),null),"AuthenticateWithRedirectCallback");const vl=()=>({fields:{identifier:null,password:null,code:null},raw:null,global:null}),wl=()=>({fields:{firstName:null,lastName:null,emailAddress:null,phoneNumber:null,password:null,username:null,code:null,captcha:null,legalAccepted:null},raw:null,global:null}),bl=()=>({fields:{emailAddress:null},raw:null,global:null}),Cs=()=>({pathRoot:"",attempts:null,error:null,expireAt:null,externalVerificationRedirectURL:null,nonce:null,message:null,status:null,strategy:null,verifiedAtClient:null,verifiedFromTheSameClient(){return!1},reload(){throw new Error("reload() called before Clerk is loaded")},__internal_toSnapshot(){return{object:"verification",id:"",attempts:null,error:{code:"",message:""},expire_at:null,externalVerificationRedirectURL:null,nonce:null,message:null,status:null,strategy:null,verified_at_client:null}}}),_n=()=>({...Cs(),supportedStrategies:[],nextAction:"",reload(){throw new Error("reload() called before Clerk is loaded")},__internal_toSnapshot(){return{...Cs().__internal_toSnapshot(),next_action:this.nextAction,supported_strategies:this.supportedStrategies}}});var jl=class{constructor(e){this.isomorphicClerk=e,this.signInSignalProxy=this.buildSignInProxy(),this.signUpSignalProxy=this.buildSignUpProxy(),this.waitlistSignalProxy=this.buildWaitlistProxy()}signInSignal(){return this.signInSignalProxy}signUpSignal(){return this.signUpSignalProxy}waitlistSignal(){return this.waitlistSignalProxy}get __internal_waitlist(){return this.state.__internal_waitlist}checkoutSignal(e){return this.buildCheckoutProxy(e)}buildSignInProxy(){const e=this.gateProperty.bind(this),t=()=>this.client.signIn.__internal_future;return{errors:vl(),fetchStatus:"idle",signIn:{status:"needs_identifier",availableStrategies:[],get isTransferable(){return e(t,"isTransferable",!1)},get id(){return e(t,"id",void 0)},get supportedFirstFactors(){return e(t,"supportedFirstFactors",[])},get supportedSecondFactors(){return e(t,"supportedSecondFactors",[])},get secondFactorVerification(){return e(t,"secondFactorVerification",{status:null,error:null,expireAt:null,externalVerificationRedirectURL:null,nonce:null,attempts:null,message:null,strategy:null,verifiedAtClient:null,verifiedFromTheSameClient:()=>!1,__internal_toSnapshot:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")},pathRoot:"",reload:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")}})},get identifier(){return e(t,"identifier",null)},get createdSessionId(){return e(t,"createdSessionId",null)},get userData(){return e(t,"userData",{})},get firstFactorVerification(){return e(t,"firstFactorVerification",{status:null,error:null,expireAt:null,externalVerificationRedirectURL:null,nonce:null,attempts:null,message:null,strategy:null,verifiedAtClient:null,verifiedFromTheSameClient:()=>!1,__internal_toSnapshot:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")},pathRoot:"",reload:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")}})},get canBeDiscarded(){return e(t,"canBeDiscarded",!1)},get protectCheck(){return e(t,"protectCheck",null)},create:this.gateMethod(t,"create"),password:this.gateMethod(t,"password"),sso:this.gateMethod(t,"sso"),finalize:this.gateMethod(t,"finalize"),reset:this.gateMethod(t,"reset"),submitProtectCheck:this.gateMethod(t,"submitProtectCheck"),emailCode:this.wrapMethods(()=>t().emailCode,["sendCode","verifyCode"]),emailLink:this.wrapStruct(()=>t().emailLink,["sendLink","waitForVerification"],["verification"],{verification:null}),resetPasswordEmailCode:this.wrapMethods(()=>t().resetPasswordEmailCode,["sendCode","verifyCode","submitPassword"]),resetPasswordPhoneCode:this.wrapMethods(()=>t().resetPasswordPhoneCode,["sendCode","verifyCode","submitPassword"]),phoneCode:this.wrapMethods(()=>t().phoneCode,["sendCode","verifyCode"]),mfa:this.wrapMethods(()=>t().mfa,["sendPhoneCode","verifyPhoneCode","sendEmailCode","verifyEmailCode","verifyTOTP","verifyBackupCode"]),ticket:this.gateMethod(t,"ticket"),passkey:this.gateMethod(t,"passkey"),web3:this.gateMethod(t,"web3")}}}buildSignUpProxy(){const e=this.gateProperty.bind(this),t=this.gateMethod.bind(this),n=()=>this.client.signUp.__internal_future;return{errors:wl(),fetchStatus:"idle",signUp:{get id(){return e(n,"id",void 0)},get requiredFields(){return e(n,"requiredFields",[])},get optionalFields(){return e(n,"optionalFields",[])},get missingFields(){return e(n,"missingFields",[])},get username(){return e(n,"username",null)},get firstName(){return e(n,"firstName",null)},get lastName(){return e(n,"lastName",null)},get emailAddress(){return e(n,"emailAddress",null)},get phoneNumber(){return e(n,"phoneNumber",null)},get web3Wallet(){return e(n,"web3Wallet",null)},get hasPassword(){return e(n,"hasPassword",!1)},get unsafeMetadata(){return e(n,"unsafeMetadata",{})},get createdSessionId(){return e(n,"createdSessionId",null)},get createdUserId(){return e(n,"createdUserId",null)},get abandonAt(){return e(n,"abandonAt",null)},get legalAcceptedAt(){return e(n,"legalAcceptedAt",null)},get locale(){return e(n,"locale",null)},get status(){return e(n,"status","missing_requirements")},get unverifiedFields(){return e(n,"unverifiedFields",[])},get isTransferable(){return e(n,"isTransferable",!1)},get canBeDiscarded(){return e(n,"canBeDiscarded",!1)},get protectCheck(){return e(n,"protectCheck",null)},create:t(n,"create"),update:t(n,"update"),sso:t(n,"sso"),password:t(n,"password"),ticket:t(n,"ticket"),web3:t(n,"web3"),finalize:t(n,"finalize"),reset:t(n,"reset"),submitProtectCheck:t(n,"submitProtectCheck"),verifications:this.wrapStruct(()=>n().verifications,["sendEmailCode","verifyEmailCode","sendEmailLink","waitForEmailLinkVerification","sendPhoneCode","verifyPhoneCode"],["emailAddress","phoneNumber","web3Wallet","externalAccount","emailLinkVerification"],{emailAddress:_n(),phoneNumber:_n(),web3Wallet:_n(),externalAccount:_n(),emailLinkVerification:null})}}}buildWaitlistProxy(){const e=this.gateProperty.bind(this),t=this.gateMethod.bind(this),n=()=>this.state.__internal_waitlist;return{errors:bl(),fetchStatus:"idle",waitlist:{pathRoot:"/waitlist",get id(){return e(n,"id","")},get createdAt(){return e(n,"createdAt",null)},get updatedAt(){return e(n,"updatedAt",null)},join:t(n,"join"),reload:t(n,"reload")}}}buildCheckoutProxy(e){const t=this.gateProperty.bind(this),n=()=>this.checkout(e),r=()=>n().checkout;return{errors:{raw:null,global:null},fetchStatus:"idle",checkout:{get status(){return t(r,"status","needs_initialization")},get externalClientSecret(){return t(r,"externalClientSecret",null)},get externalGatewayId(){return t(r,"externalGatewayId",null)},get paymentMethod(){return t(r,"paymentMethod",null)},get plan(){return t(r,"plan",null)},get planPeriod(){return t(r,"planPeriod",null)},get totals(){return t(r,"totals",null)},get isImmediatePlanChange(){return t(r,"isImmediatePlanChange",!1)},get freeTrialEndsAt(){return t(r,"freeTrialEndsAt",null)},get payer(){return t(r,"payer",null)},get planPeriodStart(){return t(r,"planPeriodStart",null)},get needsPaymentMethod(){return t(r,"needsPaymentMethod",null)},start:this.gateMethod(r,"start"),update:this.gateMethod(r,"update"),confirm:this.gateMethod(r,"confirm"),finalize:this.gateMethod(r,"finalize")}}}__internal_effect(e){throw new Error("__internal_effect called before Clerk is loaded")}__internal_computed(e){throw new Error("__internal_computed called before Clerk is loaded")}get state(){const e=this.isomorphicClerk.__internal_state;if(!e)throw new Error("Clerk state not ready");return e}get client(){const e=this.isomorphicClerk.client;if(!e)throw new Error("Clerk client not ready");return e}get checkout(){const e=this.isomorphicClerk.__experimental_checkout;if(!e)throw new Error("Clerk checkout not ready");return e}gateProperty(e,t,n){return!Tt()||!this.isomorphicClerk.loaded?n:e()[t]}gateMethod(e,t){return(async(...n)=>{if(!Tt())return nt.throw(`Attempted to call a method (${t}) that is not supported on the server.`);this.isomorphicClerk.loaded||await new Promise(o=>this.isomorphicClerk.addOnLoaded(o));const r=e();return r[t].apply(r,n)})}wrapMethods(e,t){return Object.fromEntries(t.map(n=>[n,this.gateMethod(e,n)]))}wrapStruct(e,t,n,r){const o={};for(const x of t)o[x]=this.gateMethod(e,x);for(const x of n)Object.defineProperty(o,x,{get:()=>this.gateProperty(e,x,r[x]),enumerable:!0});return o}};typeof globalThis.__BUILD_DISABLE_RHC__>"u"&&(globalThis.__BUILD_DISABLE_RHC__=!1);const _l={name:"@clerk/react",version:"6.14.3",environment:"production"};var Bs=class Ho{#o;#r;#s;#t;#e;#x;get publishableKey(){return this.#t}get loaded(){return this.clerkjs?.loaded||!1}get status(){return this.clerkjs?this.clerkjs?.status||(this.clerkjs.loaded?"ready":"loading"):this.#o}static#n;static getOrCreateInstance(t){return(!Tt()||!this.#n||t.Clerk&&this.#n.Clerk!==t.Clerk||this.#n.publishableKey!==t.publishableKey)&&(this.#n=new Ho(t)),this.#n}static clearInstance(){this.#n=null}get domain(){return typeof window<"u"&&window.location?v0(this.#r,new URL(window.location.href),""):typeof this.#r=="function"?nt.throw(w0):this.#r||""}get proxyUrl(){return typeof window<"u"&&window.location?v0(this.#s,new URL(window.location.href),""):typeof this.#s=="function"?nt.throw(w0):this.#s||""}__internal_getOption(t){return this.clerkjs?.__internal_getOption?this.clerkjs?.__internal_getOption(t):this.options[t]}get __internal_moduleManager(){return this.clerkjs?.__internal_moduleManager}constructor(t){this.clerkjs=null,this.preopenOneTap=null,this.preopenUserVerification=null,this.preopenEnableOrganizationsPrompt=null,this.preopenSignIn=null,this.preopenCheckout=null,this.preopenPlanDetails=null,this.preopenSubscriptionDetails=null,this.preopenSignUp=null,this.preopenUserProfile=null,this.preopenOrganizationProfile=null,this.preopenInviteMembers=null,this.preopenCreateOrganization=null,this.preOpenWaitlist=null,this.premountSignInNodes=new Map,this.premountSignUpNodes=new Map,this.premountUserAvatarNodes=new Map,this.premountUserProfileNodes=new Map,this.premountUserButtonNodes=new Map,this.premountOrganizationProfileNodes=new Map,this.premountCreateOrganizationNodes=new Map,this.premountOrganizationSwitcherNodes=new Map,this.premountOrganizationListNodes=new Map,this.premountMethodCalls=new Map,this.premountWaitlistNodes=new Map,this.premountPricingTableNodes=new Map,this.premountAPIKeysNodes=new Map,this.premountConfigureSSONodes=new Map,this.premountOAuthConsentNodes=new Map,this.premountTaskChooseOrganizationNodes=new Map,this.premountTaskResetPasswordNodes=new Map,this.premountTaskSetupMFANodes=new Map,this.premountAddListenerCalls=new Map,this.loadedListeners=[],this.#o="loading",this.#e=fl(),this.__internal_windowNavigate=(n,r)=>{const o=this.clerkjs;if(typeof o?.__internal_windowNavigate=="function"){o.__internal_windowNavigate(n,r);return}Tt()&&Bl(n,{allowedProtocols:r?.useStaticAllowlistOnly?Z0:[...Z0,...this.options.allowedRedirectProtocols??[]]})},this.setProtectAssertion=n=>{const r=()=>this.clerkjs?.setProtectAssertion(n);this.clerkjs&&this.loaded?r():this.premountMethodCalls.set("setProtectAssertion",r)},this.buildSignInUrl=n=>{const r=()=>this.clerkjs?.buildSignInUrl(n)||"";if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildSignInUrl",r)},this.buildSignUpUrl=n=>{const r=()=>this.clerkjs?.buildSignUpUrl(n)||"";if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildSignUpUrl",r)},this.buildAfterSignInUrl=(...n)=>{const r=()=>this.clerkjs?.buildAfterSignInUrl(...n)||"";if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildAfterSignInUrl",r)},this.buildAfterSignUpUrl=(...n)=>{const r=()=>this.clerkjs?.buildAfterSignUpUrl(...n)||"";if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildAfterSignUpUrl",r)},this.buildAfterSignOutUrl=()=>{const n=()=>this.clerkjs?.buildAfterSignOutUrl()||"";if(this.clerkjs&&this.loaded)return n();this.premountMethodCalls.set("buildAfterSignOutUrl",n)},this.buildNewSubscriptionRedirectUrl=()=>{const n=()=>this.clerkjs?.buildNewSubscriptionRedirectUrl()||"";if(this.clerkjs&&this.loaded)return n();this.premountMethodCalls.set("buildNewSubscriptionRedirectUrl",n)},this.buildAfterMultiSessionSingleSignOutUrl=()=>{const n=()=>this.clerkjs?.buildAfterMultiSessionSingleSignOutUrl()||"";if(this.clerkjs&&this.loaded)return n();this.premountMethodCalls.set("buildAfterMultiSessionSingleSignOutUrl",n)},this.buildUserProfileUrl=()=>{const n=()=>this.clerkjs?.buildUserProfileUrl()||"";if(this.clerkjs&&this.loaded)return n();this.premountMethodCalls.set("buildUserProfileUrl",n)},this.buildCreateOrganizationUrl=()=>{const n=()=>this.clerkjs?.buildCreateOrganizationUrl()||"";if(this.clerkjs&&this.loaded)return n();this.premountMethodCalls.set("buildCreateOrganizationUrl",n)},this.buildOrganizationProfileUrl=()=>{const n=()=>this.clerkjs?.buildOrganizationProfileUrl()||"";if(this.clerkjs&&this.loaded)return n();this.premountMethodCalls.set("buildOrganizationProfileUrl",n)},this.buildWaitlistUrl=()=>{const n=()=>this.clerkjs?.buildWaitlistUrl()||"";if(this.clerkjs&&this.loaded)return n();this.premountMethodCalls.set("buildWaitlistUrl",n)},this.buildTasksUrl=()=>{const n=()=>this.clerkjs?.buildTasksUrl()||"";if(this.clerkjs&&this.loaded)return n();this.premountMethodCalls.set("buildTasksUrl",n)},this.buildUrlWithAuth=n=>{const r=()=>this.clerkjs?.buildUrlWithAuth(n)||"";if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("buildUrlWithAuth",r)},this.handleUnauthenticated=async()=>{const n=()=>this.clerkjs?.handleUnauthenticated();this.clerkjs&&this.loaded?n():this.premountMethodCalls.set("handleUnauthenticated",n)},this.on=(...n)=>{if(this.clerkjs?.on)return this.clerkjs.on(...n);this.#e.on(...n)},this.off=(...n)=>{if(this.clerkjs?.off)return this.clerkjs.off(...n);this.#e.off(...n)},this.addOnLoaded=n=>{this.loadedListeners.push(n),this.loaded&&this.emitLoaded()},this.emitLoaded=()=>{this.loadedListeners.forEach(n=>n()),this.loadedListeners=[]},this.beforeLoad=n=>{if(!n)throw new Error("Failed to hydrate latest Clerk JS")},this.replayInterceptedInvocations=n=>{if(!n)throw new Error("Failed to hydrate latest Clerk JS");return this.clerkjs=n,this.premountMethodCalls.forEach(r=>r()),this.premountAddListenerCalls.forEach((r,o)=>{r.handlers.nativeUnsubscribe=n.addListener(o,r.options)}),this.#e.internal.retrieveListeners("status")?.forEach(r=>{this.on("status",r,{notify:!0})}),this.preopenSignIn!==null&&n.openSignIn(this.preopenSignIn),this.preopenCheckout!==null&&n.__internal_openCheckout(this.preopenCheckout),this.preopenPlanDetails!==null&&n.__internal_openPlanDetails(this.preopenPlanDetails),this.preopenSubscriptionDetails!==null&&n.__internal_openSubscriptionDetails(this.preopenSubscriptionDetails),this.preopenSignUp!==null&&n.openSignUp(this.preopenSignUp),this.preopenUserProfile!==null&&n.openUserProfile(this.preopenUserProfile),this.preopenUserVerification!==null&&n.__internal_openReverification(this.preopenUserVerification),this.preopenOneTap!==null&&n.openGoogleOneTap(this.preopenOneTap),this.preopenOrganizationProfile!==null&&n.openOrganizationProfile(this.preopenOrganizationProfile),this.preopenInviteMembers!==null&&n.openInviteMembers(this.preopenInviteMembers),this.preopenCreateOrganization!==null&&n.openCreateOrganization(this.preopenCreateOrganization),this.preOpenWaitlist!==null&&n.openWaitlist(this.preOpenWaitlist),this.preopenEnableOrganizationsPrompt&&n.__internal_openEnableOrganizationsPrompt(this.preopenEnableOrganizationsPrompt),this.premountSignInNodes.forEach((r,o)=>{n.mountSignIn(o,r)}),this.premountSignUpNodes.forEach((r,o)=>{n.mountSignUp(o,r)}),this.premountUserProfileNodes.forEach((r,o)=>{n.mountUserProfile(o,r)}),this.premountUserAvatarNodes.forEach((r,o)=>{n.mountUserAvatar(o,r)}),this.premountUserButtonNodes.forEach((r,o)=>{n.mountUserButton(o,r)}),this.premountOrganizationListNodes.forEach((r,o)=>{n.mountOrganizationList(o,r)}),this.premountWaitlistNodes.forEach((r,o)=>{n.mountWaitlist(o,r)}),this.premountPricingTableNodes.forEach((r,o)=>{n.mountPricingTable(o,r)}),this.premountAPIKeysNodes.forEach((r,o)=>{n.mountAPIKeys(o,r)}),this.premountConfigureSSONodes.forEach((r,o)=>{n.__internal_mountConfigureSSO(o,r)}),this.premountOAuthConsentNodes.forEach((r,o)=>{n.__internal_mountOAuthConsent(o,r)}),this.premountTaskChooseOrganizationNodes.forEach((r,o)=>{n.mountTaskChooseOrganization(o,r)}),this.premountTaskResetPasswordNodes.forEach((r,o)=>{n.mountTaskResetPassword(o,r)}),this.premountTaskSetupMFANodes.forEach((r,o)=>{n.mountTaskSetupMFA(o,r)}),typeof this.clerkjs.status>"u"&&this.#e.emit(jt.Status,"ready"),this.emitLoaded(),this.clerkjs},this.__experimental_checkout=(...n)=>this.loaded&&this.clerkjs?this.clerkjs.__experimental_checkout(...n):this.#x.checkoutSignal(...n),this.__internal_updateProps=async n=>{const r=await this.#i();if(r&&"__internal_updateProps"in r)return r.__internal_updateProps(n)},this.setActive=n=>this.clerkjs?this.clerkjs.setActive(n):Promise.reject(),this.openSignIn=n=>{this.clerkjs&&this.loaded?this.clerkjs.openSignIn(n):this.preopenSignIn=n},this.closeSignIn=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeSignIn():this.preopenSignIn=null},this.__internal_openCheckout=n=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openCheckout(n):this.preopenCheckout=n},this.__internal_closeCheckout=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeCheckout():this.preopenCheckout=null},this.__internal_openPlanDetails=n=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openPlanDetails(n):this.preopenPlanDetails=n},this.__internal_closePlanDetails=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closePlanDetails():this.preopenPlanDetails=null},this.__internal_openSubscriptionDetails=n=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openSubscriptionDetails(n):this.preopenSubscriptionDetails=n??null},this.__internal_closeSubscriptionDetails=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeSubscriptionDetails():this.preopenSubscriptionDetails=null},this.__internal_openReverification=n=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openReverification(n):this.preopenUserVerification=n},this.__internal_closeReverification=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeReverification():this.preopenUserVerification=null},this.__internal_openEnableOrganizationsPrompt=n=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openEnableOrganizationsPrompt(n):this.preopenEnableOrganizationsPrompt=n},this.__internal_closeEnableOrganizationsPrompt=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeEnableOrganizationsPrompt():this.preopenEnableOrganizationsPrompt=null},this.openGoogleOneTap=n=>{this.clerkjs&&this.loaded?this.clerkjs.openGoogleOneTap(n):this.preopenOneTap=n},this.closeGoogleOneTap=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeGoogleOneTap():this.preopenOneTap=null},this.openUserProfile=n=>{this.clerkjs&&this.loaded?this.clerkjs.openUserProfile(n):this.preopenUserProfile=n},this.closeUserProfile=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeUserProfile():this.preopenUserProfile=null},this.openOrganizationProfile=n=>{this.clerkjs&&this.loaded?this.clerkjs.openOrganizationProfile(n):this.preopenOrganizationProfile=n},this.closeOrganizationProfile=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeOrganizationProfile():this.preopenOrganizationProfile=null},this.openInviteMembers=n=>{this.clerkjs&&this.loaded?this.clerkjs.openInviteMembers(n):this.preopenInviteMembers=n},this.closeInviteMembers=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeInviteMembers():this.preopenInviteMembers=null},this.openCreateOrganization=n=>{this.clerkjs&&this.loaded?this.clerkjs.openCreateOrganization(n):this.preopenCreateOrganization=n},this.closeCreateOrganization=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeCreateOrganization():this.preopenCreateOrganization=null},this.openWaitlist=n=>{this.clerkjs&&this.loaded?this.clerkjs.openWaitlist(n):this.preOpenWaitlist=n},this.closeWaitlist=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeWaitlist():this.preOpenWaitlist=null},this.openSignUp=n=>{this.clerkjs&&this.loaded?this.clerkjs.openSignUp(n):this.preopenSignUp=n},this.closeSignUp=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeSignUp():this.preopenSignUp=null},this.mountSignIn=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.mountSignIn(n,r):this.premountSignInNodes.set(n,r)},this.unmountSignIn=n=>{this.clerkjs&&this.loaded?this.clerkjs.unmountSignIn(n):this.premountSignInNodes.delete(n)},this.mountSignUp=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.mountSignUp(n,r):this.premountSignUpNodes.set(n,r)},this.unmountSignUp=n=>{this.clerkjs&&this.loaded?this.clerkjs.unmountSignUp(n):this.premountSignUpNodes.delete(n)},this.mountUserAvatar=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.mountUserAvatar(n,r):this.premountUserAvatarNodes.set(n,r)},this.unmountUserAvatar=n=>{this.clerkjs&&this.loaded?this.clerkjs.unmountUserAvatar(n):this.premountUserAvatarNodes.delete(n)},this.mountUserProfile=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.mountUserProfile(n,r):this.premountUserProfileNodes.set(n,r)},this.unmountUserProfile=n=>{this.clerkjs&&this.loaded?this.clerkjs.unmountUserProfile(n):this.premountUserProfileNodes.delete(n)},this.mountOrganizationProfile=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.mountOrganizationProfile(n,r):this.premountOrganizationProfileNodes.set(n,r)},this.unmountOrganizationProfile=n=>{this.clerkjs&&this.loaded?this.clerkjs.unmountOrganizationProfile(n):this.premountOrganizationProfileNodes.delete(n)},this.mountCreateOrganization=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.mountCreateOrganization(n,r):this.premountCreateOrganizationNodes.set(n,r)},this.unmountCreateOrganization=n=>{this.clerkjs&&this.loaded?this.clerkjs.unmountCreateOrganization(n):this.premountCreateOrganizationNodes.delete(n)},this.mountOrganizationSwitcher=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.mountOrganizationSwitcher(n,r):this.premountOrganizationSwitcherNodes.set(n,r)},this.unmountOrganizationSwitcher=n=>{this.clerkjs&&this.loaded?this.clerkjs.unmountOrganizationSwitcher(n):this.premountOrganizationSwitcherNodes.delete(n)},this.__experimental_prefetchOrganizationSwitcher=()=>{const n=()=>this.clerkjs?.__experimental_prefetchOrganizationSwitcher();this.clerkjs&&this.loaded?n():this.premountMethodCalls.set("__experimental_prefetchOrganizationSwitcher",n)},this.mountOrganizationList=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.mountOrganizationList(n,r):this.premountOrganizationListNodes.set(n,r)},this.unmountOrganizationList=n=>{this.clerkjs&&this.loaded?this.clerkjs.unmountOrganizationList(n):this.premountOrganizationListNodes.delete(n)},this.mountUserButton=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.mountUserButton(n,r):this.premountUserButtonNodes.set(n,r)},this.unmountUserButton=n=>{this.clerkjs&&this.loaded?this.clerkjs.unmountUserButton(n):this.premountUserButtonNodes.delete(n)},this.mountWaitlist=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.mountWaitlist(n,r):this.premountWaitlistNodes.set(n,r)},this.unmountWaitlist=n=>{this.clerkjs&&this.loaded?this.clerkjs.unmountWaitlist(n):this.premountWaitlistNodes.delete(n)},this.mountPricingTable=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.mountPricingTable(n,r):this.premountPricingTableNodes.set(n,r)},this.unmountPricingTable=n=>{this.clerkjs&&this.loaded?this.clerkjs.unmountPricingTable(n):this.premountPricingTableNodes.delete(n)},this.mountAPIKeys=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.mountAPIKeys(n,r):this.premountAPIKeysNodes.set(n,r)},this.unmountAPIKeys=n=>{this.clerkjs&&this.loaded?this.clerkjs.unmountAPIKeys(n):this.premountAPIKeysNodes.delete(n)},this.__internal_mountConfigureSSO=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_mountConfigureSSO(n,r):this.premountConfigureSSONodes.set(n,r)},this.__internal_unmountConfigureSSO=n=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_unmountConfigureSSO(n):this.premountConfigureSSONodes.delete(n)},this.__internal_mountOAuthConsent=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_mountOAuthConsent(n,r):this.premountOAuthConsentNodes.set(n,r)},this.__internal_unmountOAuthConsent=n=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_unmountOAuthConsent(n):this.premountOAuthConsentNodes.delete(n)},this.mountOAuthConsent=(n,r)=>{this.__internal_mountOAuthConsent(n,r)},this.unmountOAuthConsent=n=>{this.__internal_unmountOAuthConsent(n)},this.mountTaskChooseOrganization=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.mountTaskChooseOrganization(n,r):this.premountTaskChooseOrganizationNodes.set(n,r)},this.unmountTaskChooseOrganization=n=>{this.clerkjs&&this.loaded?this.clerkjs.unmountTaskChooseOrganization(n):this.premountTaskChooseOrganizationNodes.delete(n)},this.mountTaskResetPassword=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.mountTaskResetPassword(n,r):this.premountTaskResetPasswordNodes.set(n,r)},this.unmountTaskResetPassword=n=>{this.clerkjs&&this.loaded?this.clerkjs.unmountTaskResetPassword(n):this.premountTaskResetPasswordNodes.delete(n)},this.mountTaskSetupMFA=(n,r)=>{this.clerkjs&&this.loaded?this.clerkjs.mountTaskSetupMFA(n,r):this.premountTaskSetupMFANodes.set(n,r)},this.unmountTaskSetupMFA=n=>{this.clerkjs&&this.loaded?this.clerkjs.unmountTaskSetupMFA(n):this.premountTaskSetupMFANodes.delete(n)},this.addListener=(n,r)=>{if(this.clerkjs)return this.clerkjs.addListener(n,r);{const o=()=>{const x=this.premountAddListenerCalls.get(n);x?.handlers&&(x?.handlers.nativeUnsubscribe?.(),this.premountAddListenerCalls.delete(n))};return this.premountAddListenerCalls.set(n,{options:r,handlers:{unsubscribe:o,nativeUnsubscribe:void 0}}),o}},this.navigate=n=>{const r=()=>this.clerkjs?.navigate(n);this.clerkjs&&this.loaded?r():this.premountMethodCalls.set("navigate",r)},this.redirectWithAuth=async(...n)=>{const r=()=>this.clerkjs?.redirectWithAuth(...n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("redirectWithAuth",r)},this.redirectToSignIn=async n=>{const r=()=>this.clerkjs?.redirectToSignIn(n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("redirectToSignIn",r)},this.redirectToSignUp=async n=>{const r=()=>this.clerkjs?.redirectToSignUp(n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("redirectToSignUp",r)},this.redirectToUserProfile=async()=>{const n=()=>this.clerkjs?.redirectToUserProfile();if(this.clerkjs&&this.loaded)return n();this.premountMethodCalls.set("redirectToUserProfile",n)},this.redirectToAfterSignUp=()=>{const n=()=>this.clerkjs?.redirectToAfterSignUp();if(this.clerkjs&&this.loaded)return n();this.premountMethodCalls.set("redirectToAfterSignUp",n)},this.redirectToAfterSignIn=()=>{const n=()=>this.clerkjs?.redirectToAfterSignIn();this.clerkjs&&this.loaded?n():this.premountMethodCalls.set("redirectToAfterSignIn",n)},this.redirectToAfterSignOut=()=>{const n=()=>this.clerkjs?.redirectToAfterSignOut();this.clerkjs&&this.loaded?n():this.premountMethodCalls.set("redirectToAfterSignOut",n)},this.redirectToOrganizationProfile=async()=>{const n=()=>this.clerkjs?.redirectToOrganizationProfile();if(this.clerkjs&&this.loaded)return n();this.premountMethodCalls.set("redirectToOrganizationProfile",n)},this.redirectToCreateOrganization=async()=>{const n=()=>this.clerkjs?.redirectToCreateOrganization();if(this.clerkjs&&this.loaded)return n();this.premountMethodCalls.set("redirectToCreateOrganization",n)},this.redirectToWaitlist=async()=>{const n=()=>this.clerkjs?.redirectToWaitlist();if(this.clerkjs&&this.loaded)return n();this.premountMethodCalls.set("redirectToWaitlist",n)},this.redirectToTasks=async n=>{const r=()=>this.clerkjs?.redirectToTasks(n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("redirectToTasks",r)},this.handleRedirectCallback=async n=>{const r=()=>this.clerkjs?.handleRedirectCallback(n);this.clerkjs&&this.loaded?r()?.catch(()=>{}):this.premountMethodCalls.set("handleRedirectCallback",r)},this.handleGoogleOneTapCallback=async(n,r)=>{const o=()=>this.clerkjs?.handleGoogleOneTapCallback(n,r);this.clerkjs&&this.loaded?o()?.catch(()=>{}):this.premountMethodCalls.set("handleGoogleOneTapCallback",o)},this.__internal_handleResourceCallback=async(n,r,o)=>{const x=()=>this.clerkjs?.__internal_handleResourceCallback(n,r,o);if(this.clerkjs&&this.loaded)return x();this.premountMethodCalls.set("__internal_handleResourceCallback",x)},this.handleEmailLinkVerification=async n=>{const r=()=>this.clerkjs?.handleEmailLinkVerification(n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("handleEmailLinkVerification",r)},this.authenticateWithMetamask=async n=>{const r=()=>this.clerkjs?.authenticateWithMetamask(n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("authenticateWithMetamask",r)},this.authenticateWithCoinbaseWallet=async n=>{const r=()=>this.clerkjs?.authenticateWithCoinbaseWallet(n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("authenticateWithCoinbaseWallet",r)},this.authenticateWithBase=async n=>{const r=()=>this.clerkjs?.authenticateWithBase(n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("authenticateWithBase",r)},this.authenticateWithOKXWallet=async n=>{const r=()=>this.clerkjs?.authenticateWithOKXWallet(n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("authenticateWithOKXWallet",r)},this.authenticateWithSolana=async n=>{const r=()=>this.clerkjs?.authenticateWithSolana(n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("authenticateWithSolana",r)},this.authenticateWithWeb3=async n=>{const r=()=>this.clerkjs?.authenticateWithWeb3(n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("authenticateWithWeb3",r)},this.authenticateWithGoogleOneTap=async n=>(await this.#i()).authenticateWithGoogleOneTap(n),this.__internal_loadStripeJs=async()=>(await this.#i()).__internal_loadStripeJs(),this.createOrganization=async n=>{const r=()=>this.clerkjs?.createOrganization(n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("createOrganization",r)},this.getOrganization=async n=>{const r=()=>this.clerkjs?.getOrganization(n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("getOrganization",r)},this.joinWaitlist=async n=>{const r=()=>this.clerkjs?.joinWaitlist(n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("joinWaitlist",r)},this.signOut=async(...n)=>{const r=()=>this.clerkjs?.signOut(...n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("signOut",r)},this.__internal_attemptToEnableEnvironmentSetting=n=>{const r=()=>this.clerkjs?.__internal_attemptToEnableEnvironmentSetting(n);if(this.clerkjs&&this.loaded)return r();this.premountMethodCalls.set("__internal_attemptToEnableEnvironmentSetting",r)},this.#t=t?.publishableKey,this.#s=t?.proxyUrl,this.#r=t?.domain,this.options=t,this.Clerk=t?.Clerk||null,this.mode=Tt()?"browser":"server",this.#x=new jl(this),this.options.sdkMetadata||(this.options.sdkMetadata=_l),this.#e.emit(jt.Status,"loading"),this.#e.prioritizedOn(jt.Status,n=>this.#o=n),this.#t&&this.options.experimental?.runtimeEnvironment==="headless"&&this.options.Clerk?this.loadHeadlessClerk():this.#t&&this.getEntryChunks()}loadHeadlessClerk(){const t=as(this.options.Clerk)?new this.options.Clerk(this.#t,{proxyUrl:this.proxyUrl,domain:this.domain}):this.options.Clerk;if(!t){this.#e.emit(jt.Status,"error");return}const n=()=>{this.replayInterceptedInvocations(t)};t.loaded?n():t.load(this.options).then(()=>n()).catch(r=>{this.#e.emit(jt.Status,"error"),this.emitLoaded()})}get sdkMetadata(){return this.clerkjs?.sdkMetadata||this.options.sdkMetadata||void 0}get instanceType(){return this.clerkjs?.instanceType}get frontendApi(){return this.clerkjs?.frontendApi||""}get isStandardBrowser(){return this.clerkjs?.isStandardBrowser||this.options.standardBrowser||!1}get isSatellite(){return typeof window<"u"&&window.location?v0(this.options.isSatellite,new URL(window.location.href),!1):typeof this.options.isSatellite=="function"?nt.throw(w0):!1}#i(){return new Promise(t=>{this.addOnLoaded(()=>t(this.clerkjs))})}async getEntryChunks(){if(!(this.mode!=="browser"||this.loaded)){typeof window<"u"&&(window.__clerk_publishable_key=this.#t,window.__clerk_proxy_url=this.proxyUrl,window.__clerk_domain=this.domain);try{const t=await this.getClerkJsEntryChunk();if(!t.loaded){this.beforeLoad(t);const n=this.options.standardBrowser!==!1&&!this.options.Clerk||this.options.ui?.ClerkUI?await this.getClerkUIEntryChunk():void 0;await t.load({...this.options,ui:{...this.options.ui,ClerkUI:n}})}t.loaded&&this.replayInterceptedInvocations(t)}catch(t){const n=t;this.#e.emit(jt.Status,"error"),console.error(n.stack||n.message||n);return}}}async getClerkJsEntryChunk(){if((!this.options.Clerk||this.options.__internal_clerkJSUrl)&&!__BUILD_DISABLE_RHC__&&await il({...this.options,publishableKey:this.#t,proxyUrl:this.proxyUrl,domain:this.domain,nonce:this.options.nonce}),this.options.Clerk&&!this.options.__internal_clerkJSUrl&&(globalThis.Clerk=as(this.options.Clerk)?new this.options.Clerk(this.#t,{proxyUrl:this.proxyUrl,domain:this.domain}):this.options.Clerk),!globalThis.Clerk)throw new Error("Failed to download latest ClerkJS. Contact support@clerk.com.");return globalThis.Clerk}async getClerkUIEntryChunk(){const t=this.options.ui,n=!!this.options.__internal_clerkUIUrl;if(t?.ClerkUI&&!n)return t.ClerkUI;if(!((t||this.options.prefetchUI===!1)&&!n)&&!__BUILD_DISABLE_RHC__){if(await al({...this.options,publishableKey:this.#t,proxyUrl:this.proxyUrl,domain:this.domain,nonce:this.options.nonce}),!globalThis.__internal_ClerkUICtor)throw new Error("Failed to download latest Clerk UI. Contact support@clerk.com.");return globalThis.__internal_ClerkUICtor}}get version(){return this.clerkjs?.version}get uiVersion(){return this.clerkjs?.uiVersion}get client(){if(this.clerkjs)return this.clerkjs.client}get session(){if(this.clerkjs)return this.clerkjs.session}get user(){if(this.clerkjs)return this.clerkjs.user}get organization(){if(this.clerkjs)return this.clerkjs.organization}get telemetry(){if(this.clerkjs)return this.clerkjs.telemetry}get __internal_environment(){if(this.clerkjs)return this.clerkjs.__internal_environment}get isSignedIn(){return this.clerkjs?this.clerkjs.isSignedIn:!1}get billing(){return this.clerkjs?.billing}get __internal_state(){return this.loaded&&this.clerkjs?this.clerkjs.__internal_state:this.#x}get apiKeys(){return this.clerkjs?.apiKeys}get oauthApplication(){return this.clerkjs?.oauthApplication}__internal_setEnvironment(...t){if(this.clerkjs&&"__internal_setEnvironment"in this.clerkjs)this.clerkjs.__internal_setEnvironment(t);else return}get __internal_lastEmittedResources(){return this.clerkjs?.__internal_lastEmittedResources}get __internal_hasOAuthTransport(){return this.clerkjs?.__internal_hasOAuthTransport||!1}get __internal_oauthTransport(){return this.clerkjs?.__internal_oauthTransport||null}};function Sl(){try{return Fl(S.version,[[18,0,-1,0],[19,0,0,3],[19,1,1,4],[19,2,2,3],[19,3,3,0]])}catch{return!1}}const Pl=Sl();function Il(e){const{initialState:t,children:n,...r}=e,{isomorphicClerk:o,clerkStatus:x}=Tl(ja(r));return S.createElement(Xi,{initialState:t,clerk:o,clerkStatus:x},n)}function Nl(e){return S.useContext(Cr)&&nt.throw(ca),S.createElement(Il,e)}const Ko=Nl;Ko.displayName="ClerkProvider";const Ml=Pl?"shared":"",Tl=e=>{const t=S.useMemo(()=>({clerkUIVariant:Ml,...e}),[e]),n=S.useRef(Bs.getOrCreateInstance(t)),[r,o]=S.useState(n.current.status);return S.useEffect(()=>{n.current.__internal_updateProps({appearance:e.appearance})},[e.appearance]),S.useEffect(()=>{n.current.__internal_updateProps({options:e})},[e.localization]),S.useEffect(()=>(n.current.on("status",o),()=>{n.current&&n.current.off("status",o),Bs.clearInstance()}),[]),{isomorphicClerk:n.current,clerkStatus:r}};typeof window<"u"&&!window.global&&(window.global=typeof global>"u"?window:global);if(globalThis.__clerkSharedModules){const e=globalThis.__clerkSharedModules.react?.version;e&&e!==g.version&&console.warn(`[@clerk/ui/register] React version mismatch detected. Already registered: ${e}, current import: ${g.version}. This may cause issues with the shared @clerk/ui variant.`)}else globalThis.__clerkSharedModules={react:ti,"react-dom":la,"react-dom/client":ei,"react/jsx-runtime":Xx};he(({clerk:e,children:t,...n})=>{const{appearance:r,getContainer:o,component:x,...i}=n;t=An(t,"Invite members");const a=gn(t)("InviteMembersButton"),l=()=>e.openInviteMembers({appearance:r,getContainer:o}),u={...i,onClick:async c=>(a&&typeof a=="object"&&"props"in a&&await Fn(a.props.onClick)(c),l())};return S.cloneElement(a,u)},{component:"InviteMembersButton",renderWhileLoading:!0});const Ol=he(({clerk:e,children:t,...n})=>{const{appearance:r,getContainer:o,component:x,signUpFallbackRedirectUrl:i,forceRedirectUrl:a,fallbackRedirectUrl:l,signUpForceRedirectUrl:d,mode:u,initialValues:c,withSignUp:p,oauthFlow:B,...A}=n;t=An(t,"Sign in");const k=gn(t)("SignInButton"),C=()=>{const F={forceRedirectUrl:a,fallbackRedirectUrl:l,signUpFallbackRedirectUrl:i,signUpForceRedirectUrl:d,initialValues:c,withSignUp:p,oauthFlow:B};return u==="modal"?e.openSignIn({...F,appearance:r,getContainer:o}):e.redirectToSignIn({...F,signInFallbackRedirectUrl:l,signInForceRedirectUrl:a})},v={...A,onClick:async F=>(k&&typeof k=="object"&&"props"in k&&await Fn(k.props.onClick)(F),C())};return S.cloneElement(k,v)},{component:"SignInButton",renderWhileLoading:!0});he(({clerk:e,children:t,...n})=>{const{redirectUrl:r,getContainer:o,component:x,...i}=n;t=An(t,"Sign in with Metamask");const a=gn(t)("SignInWithMetamaskButton"),l=async()=>{async function c(){await e.authenticateWithMetamask({redirectUrl:r||void 0})}c()},u={...i,onClick:async c=>(await Fn(a.props.onClick)(c),l())};return S.cloneElement(a,u)},{component:"SignInWithMetamask",renderWhileLoading:!0});he(({clerk:e,children:t,...n})=>{const{redirectUrl:r="/",sessionId:o,signOutOptions:x,getContainer:i,component:a,...l}=n;x&&h0("SignOutButton `signOutOptions`","Use the `redirectUrl` and `sessionId` props directly instead."),t=An(t,"Sign out");const d=gn(t)("SignOutButton"),u=()=>e.signOut({redirectUrl:r,...o!==void 0&&{sessionId:o},...x}),p={...l,onClick:async B=>(await Fn(d.props.onClick)(B),u())};return S.cloneElement(d,p)},{component:"SignOutButton",renderWhileLoading:!0});he(({clerk:e,children:t,...n})=>{const{appearance:r,unsafeMetadata:o,getContainer:x,component:i,fallbackRedirectUrl:a,forceRedirectUrl:l,signInFallbackRedirectUrl:d,signInForceRedirectUrl:u,mode:c,initialValues:p,oauthFlow:B,...A}=n;t=An(t,"Sign up");const k=gn(t)("SignUpButton"),C=()=>{const F={fallbackRedirectUrl:a,forceRedirectUrl:l,signInFallbackRedirectUrl:d,signInForceRedirectUrl:u,initialValues:p,oauthFlow:B};return c==="modal"?e.openSignUp({...F,appearance:r,unsafeMetadata:o,getContainer:x}):e.redirectToSignUp({...F,signUpFallbackRedirectUrl:a,signUpForceRedirectUrl:l})},v={...A,onClick:async F=>(k&&typeof k=="object"&&"props"in k&&await Fn(k.props.onClick)(F),C())};return S.cloneElement(k,v)},{component:"SignUpButton",renderWhileLoading:!0});ia({packageName:"@clerk/react"});hl("@clerk/react");const Ll=[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]],M0=ie("arrow-down-left",Ll);const Rl=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Ul=ie("arrow-up-down",Rl);const $l=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],zl=ie("arrow-up",$l);const Wl=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],Zo=ie("ban",Wl);const Vl=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],ql=ie("bell-off",Vl);const Hl=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Kl=ie("bell",Hl);const Zl=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Gl=ie("chart-column",Zl);const Jl=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Yl=ie("chevron-left",Jl);const Ql=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Xl=ie("chevron-right",Ql);const ec=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Go=ie("download",ec);const tc=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],nc=ie("eye",tc);const rc=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],sc=ie("file-search",rc);const oc=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],xc=ie("file-text",oc);const ic=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],G0=ie("file",ic);const ac=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],lc=ie("flask-conical",ac);const cc=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]],dc=ie("focus",cc);const uc=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],J0=ie("folder",uc);const hc=[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]],sn=ie("git-branch-plus",hc);const Ec=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],gs=ie("globe",Ec);const fc=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],pc=ie("key-round",fc);const mc=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Cc=ie("link-2",mc);const Bc=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],gc=ie("list-checks",Bc);const Ac=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],Fc=ie("lock-keyhole",Ac);const Dc=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Jo=ie("log-out",Dc);const kc=[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]],yc=ie("mail-check",kc);const vc=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],wc=ie("message-circle-question-mark",vc);const bc=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],jc=ie("pen-line",bc);const _c=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Sn=ie("pencil-line",_c);const Sc=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Pc=ie("pencil",Sc);const Ic=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Yo=ie("plus",Ic);const Nc=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Mc=ie("rotate-ccw",Nc);const Tc=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]],Oc=ie("scan-line",Tc);const Lc=[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Rc=ie("search-check",Lc);const Uc=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Vn=ie("shield-alert",Uc);const $c=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],Ar=ie("sliders-horizontal",$c);const zc=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Qo=ie("square",zc);const Wc=[["path",{d:"M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5",key:"mtk2lu"}],["path",{d:"M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5",key:"120jsl"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m18 22-3-3 3-3",key:"kgdoj7"}],["path",{d:"m6 2 3 3-3 3",key:"1fnbkv"}]],Vc=ie("switch-camera",Wc);const qc=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Hc=ie("terminal",qc);const Kc=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],As=ie("trash-2",Kc);const Zc=[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]],Fs=ie("user-round-check",Zc);const Gc=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Jc=ie("users",Gc);function Ds(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Yc(...e){return t=>{let n=!1;const r=e.map(o=>{const x=Ds(o,t);return!n&&typeof x=="function"&&(n=!0),x});if(n)return()=>{for(let o=0;o<r.length;o++){const x=r[o];typeof x=="function"?x():Ds(e[o],null)}}}}function Qc(...e){return g.useCallback(Yc(...e),e)}class Xc extends g.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(A0(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,o=A0(r)&&r.offsetWidth||0,x=A0(r)&&r.offsetHeight||0,i=getComputedStyle(n),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=n.offsetTop,a.left=n.offsetLeft,a.right=o-a.width-a.left,a.bottom=x-a.height-a.top,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function ed({children:e,isPresent:t,anchorX:n,anchorY:r,root:o,pop:x}){const i=g.useId(),a=g.useRef(null),l=g.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:d}=g.useContext(ni),u=x!==!1?e.props?.ref??e?.ref:void 0,c=Qc(a,u);return g.useInsertionEffect(()=>{const{width:p,height:B,top:A,left:k,right:C,bottom:b,direction:v}=l.current;if(t||x===!1||!a.current||!p||!B)return;const F=v==="rtl",m=n==="left"?F?`right: ${C}`:`left: ${k}`:F?`left: ${k}`:`right: ${C}`,f=r==="bottom"?`bottom: ${b}`:`top: ${A}`;a.current.dataset.motionPopId=i;const D=document.createElement("style");d&&(D.nonce=d);const h=o??document.head;return h.appendChild(D),D.sheet&&D.sheet.insertRule(`
|
|
16
|
+
[data-motion-pop-id="${i}"] {
|
|
17
|
+
position: absolute !important;
|
|
18
|
+
width: ${p}px !important;
|
|
19
|
+
height: ${B}px !important;
|
|
20
|
+
${m}px !important;
|
|
21
|
+
${f}px !important;
|
|
22
|
+
}
|
|
23
|
+
`),()=>{a.current?.removeAttribute("data-motion-pop-id"),h.contains(D)&&h.removeChild(D)}},[t]),s.jsx(Xc,{isPresent:t,childRef:a,sizeRef:l,pop:x,children:x===!1?e:g.cloneElement(e,{ref:c})})}const td=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:o,presenceAffectsLayout:x,mode:i,anchorX:a,anchorY:l,root:d})=>{const u=lo(nd),c=g.useId(),p=g.useRef(n),B=g.useRef(r);co(()=>{p.current=n,B.current=r});let A=!0,k=g.useMemo(()=>(A=!1,{id:c,initial:t,isPresent:n,custom:o,onExitComplete:C=>{u.set(C,!0);for(const b of u.values())if(!b)return;r&&r()},register:C=>(u.set(C,!1),()=>{u.delete(C),!p.current&&!u.size&&B.current?.()})}),[n,u,r]);return x&&A&&(k={...k}),g.useMemo(()=>{u.forEach((C,b)=>u.set(b,!1))},[n]),g.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=s.jsx(ed,{pop:i==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:d,children:e}),s.jsx(ri.Provider,{value:k,children:e})};function nd(){return new Map}const Pn=e=>e.key||"";function ks(e){const t=[];return g.Children.forEach(e,n=>{g.isValidElement(n)&&t.push(n)}),t}const xt=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:o=!0,mode:x="sync",propagate:i=!1,anchorX:a="left",anchorY:l="top",root:d})=>{const[u,c]=si(i),p=g.useMemo(()=>ks(e),[e]),B=i&&!u?[]:p.map(Pn),A=g.useRef(!0),k=g.useRef(p),C=lo(()=>new Map),b=g.useRef(new Set),[v,F]=g.useState(p),[m,f]=g.useState(p);co(()=>{A.current=!1,k.current=p;for(let E=0;E<m.length;E++){const w=Pn(m[E]);B.includes(w)?(C.delete(w),b.current.delete(w)):C.get(w)!==!0&&C.set(w,!1)}},[m,B.length,B.join("-")]);const D=[];if(p!==v){let E=[...p];for(let w=0;w<m.length;w++){const P=m[w],I=Pn(P);B.includes(I)||(E.splice(w,0,P),D.push(P))}return x==="wait"&&D.length&&(E=D),f(ks(E)),F(p),null}const{forceRender:h}=g.useContext(oi);return s.jsx(s.Fragment,{children:m.map(E=>{const w=Pn(E),P=i&&!u?!1:p===m||B.includes(w),I=()=>{if(b.current.has(w))return;if(C.has(w))b.current.add(w),C.set(w,!0);else return;let j=!0;C.forEach(y=>{y||(j=!1)}),j&&(h?.(),f(k.current),i&&c?.(),r&&r())};return s.jsx(td,{isPresent:P,initial:!A.current||n?void 0:!1,custom:t,presenceAffectsLayout:o,mode:x,root:d,onExitComplete:P?void 0:I,anchorX:a,anchorY:l,children:E},w)})})};function Xo(e,t){return e.approvals.filter(n=>n.sessionId===t)}const rd=2e5;function ys(e,t){let n=e.reduce((o,x)=>o+x.text.length,0);if(n<=t)return e;const r=[...e];for(;r.length>1&&n>t;)n-=r.shift().text.length;return r}function sd(e={}){const t=e.maxOutputChars??rd,n={},r=new Map,o=new Map,x=new Set,i={},a=new Set;let l=!1,d=!1;const u=()=>{if(l){d=!0;return}for(const f of a)f()},c=f=>{for(const[D,h]of r)h.sessionId===f&&r.delete(D);for(const[D,h]of o)h.sessionId===f&&o.delete(D)},p=f=>{const D=n[f];if(D)return D;const h={sessionId:f,startedAt:0,agent:"claude",live:!0,cwd:"",title:"",origin:"unknown",status:"running",blocks:[],output:"",activity:[],resumable:!1};return n[f]=h,h};function B(f){const D=i[f.sessionId]??0;if(f.seq<=D)return;i[f.sessionId]=f.seq;const h=p(f.sessionId);switch(h.lastActivityAt=Math.max(h.lastActivityAt??0,f.ts),f.type){case"session.started":{delete h.error;const E=f.payload;h.agent=E.agent,(h.startedAt??0)===0&&(h.startedAt=f.ts),h.live=!0,h.cwd=E.cwd,h.title=E.title??"",h.origin=E.origin??"unknown";const w=E.surface??E.origin;w!==void 0&&(h.surface=w),E.controller!==void 0&&(h.controller=E.controller),E.control!==void 0&&(h.control=E.control),E.resumeId&&(h.resumeId=E.resumeId),E.relationship&&(h.relationship=E.relationship),E.settings&&(h.settings=E.settings),E.workspace&&(h.workspace=E.workspace);break}case"stream.delta":{const E=f.payload,w=E.kind??"text",P=h.blocks[h.blocks.length-1];P&&P.kind===w&&(w==="text"||w==="thinking")?h.blocks=[...h.blocks.slice(0,-1),{kind:w,text:P.text+E.text,firstSeq:P.firstSeq,lastSeq:f.seq}]:h.blocks=[...h.blocks,{kind:w,text:E.text,firstSeq:f.seq,lastSeq:f.seq}],h.blocks=ys(h.blocks,t),w==="text"&&(h.output=(h.output+E.text).slice(-t));break}case"session.transcript.reset":{const E=f.payload;h.blocks=ys((E.blocks??[]).map(w=>({...w,firstSeq:f.seq,lastSeq:f.seq})),t),h.output=h.blocks.filter(w=>w.kind==="text").map(w=>w.text).join("").slice(-t),h.activity=[];break}case"activity.tool":{const E=f.payload;h.activity=[...h.activity,E].slice(-200);break}case"approval.requested":{const E=f.payload;if(x.has(E.approvalId))break;r.set(E.approvalId,{approvalId:E.approvalId,sessionId:f.sessionId,toolName:E.toolName,inputSummary:E.inputSummary,...E.targetPath===void 0?{}:{targetPath:E.targetPath},outsideRoot:E.outsideRoot===!0,...E.questions===void 0?{}:{questions:E.questions}});break}case"approval.decided":{const E=f.payload;x.add(E.approvalId),r.delete(E.approvalId),o.delete(E.approvalId);break}case"session.status":{const E=f.payload;(E.status==="waiting"||E.status==="running")&&(h.status=E.status,delete h.error),typeof E.live=="boolean"&&(h.live=E.live),typeof E.resumable=="boolean"&&(h.resumable=E.resumable),E.resumeId&&(h.resumeId=E.resumeId),E.settings!==void 0&&(h.settings=E.settings),E.title!==void 0&&E.title!==""&&(h.title=E.title),E.permissionMode!==void 0&&(h.permissionMode=E.permissionMode),E.gate!==void 0&&(h.gate=E.gate),E.controller!==void 0&&(h.controller=E.controller),E.surface!==void 0&&(h.surface=E.surface),E.control!==void 0&&(h.control=E.control),E.workspaceConflict!==void 0?h.workspaceConflict=E.workspaceConflict:delete h.workspaceConflict;break}case"session.ended":{h.status="ended",h.live=!1,c(f.sessionId);const E=f.payload;typeof E.resumable=="boolean"&&(h.resumable=E.resumable),E.resumeId&&(h.resumeId=E.resumeId);break}case"session.errored":{h.status="errored",h.live=!1,c(f.sessionId),h.error=f.payload.message;break}}u()}function A(f){for(const h of f){const E=p(h.sessionId);E.agent=h.agent,typeof h.startedAt=="number"&&(E.startedAt=h.startedAt),typeof h.lastActivityAt=="number"?E.lastActivityAt=Math.max(E.lastActivityAt??0,h.lastActivityAt):E.lastActivityAt===void 0&&typeof h.startedAt=="number"&&(E.lastActivityAt=h.startedAt),E.cwd=h.cwd,E.title=h.title,E.origin=h.origin,E.status=h.status,E.resumable=h.resumable??!1,E.live=h.live??!0,h.resumeId&&(E.resumeId=h.resumeId),h.gate&&(E.gate=h.gate),E.controller=h.controller??(h.live&&(h.origin==="terminal"||h.origin==="vscode")?"external":"longleash"),E.surface=h.surface??h.origin,E.control=h.control??"full",h.relationship&&(E.relationship=h.relationship),h.settings&&(E.settings=h.settings),h.workspace&&(E.workspace=h.workspace),h.workspaceConflict?E.workspaceConflict=h.workspaceConflict:delete E.workspaceConflict,(E.status==="ended"||E.status==="errored"||!E.live)&&c(E.sessionId)}const D=new Set(f.map(h=>h.sessionId));for(const h of Object.values(n))D.has(h.sessionId)||(h.live=!1,(h.status==="running"||h.status==="waiting")&&(h.status="ended"),c(h.sessionId));u()}function k(f){i[f]=0;const D=n[f];D&&(D.output="",D.blocks=[],D.activity=[],delete D.error);for(const[h,E]of r)E.sessionId===f&&r.delete(h);u()}function C(f){const D=r.get(f);D&&(o.set(f,D),r.delete(f),u())}function b(f){const D=o.get(f);o.delete(f),!(!D||x.has(f))&&(r.set(f,D),u())}function v(f){const D=n[f];D&&(D.status="ended",D.live=!1),c(f),u()}function F(){l=!0}function m(){if(!l)return;l=!1;const f=d;d=!1,f&&u()}return{apply:B,seedSessions:A,applyGap:k,markDeciding:C,rollbackDecision:b,settleSession:v,beginHydration:F,endHydration:m,cursors:()=>({...i}),getState:()=>({sessions:n,approvals:[...r.values()]}),subscribe:f=>(a.add(f),()=>{a.delete(f)})}}function od(e){return[...e].sort((t,n)=>(n.lastActivityAt??n.startedAt??0)-(t.lastActivityAt??t.startedAt??0)||(n.startedAt??0)-(t.startedAt??0)||n.sessionId.localeCompare(t.sessionId))}var ce;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const x={};for(const i of o)x[i]=i;return x},e.getValidEnumValues=o=>{const x=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of x)i[a]=o[a];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(x){return o[x]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const x=[];for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&x.push(i);return x},e.find=(o,x)=>{for(const i of o)if(x(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,x=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(x)}e.joinValues=r,e.jsonStringifyReplacer=(o,x)=>typeof x=="bigint"?x.toString():x})(ce||(ce={}));var vs;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(vs||(vs={}));const V=ce.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ht=e=>{switch(typeof e){case"undefined":return V.undefined;case"string":return V.string;case"number":return Number.isNaN(e)?V.nan:V.number;case"boolean":return V.boolean;case"function":return V.function;case"bigint":return V.bigint;case"symbol":return V.symbol;case"object":return Array.isArray(e)?V.array:e===null?V.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?V.promise:typeof Map<"u"&&e instanceof Map?V.map:typeof Set<"u"&&e instanceof Set?V.set:typeof Date<"u"&&e instanceof Date?V.date:V.object;default:return V.unknown}},T=ce.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ot extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(x){return x.message},r={_errors:[]},o=x=>{for(const i of x.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;l<i.path.length;){const d=i.path[l];l===i.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(n(i))):a[d]=a[d]||{_errors:[]},a=a[d],l++}}};return o(this),r}static assert(t){if(!(t instanceof ot))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ce.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)if(o.path.length>0){const x=o.path[0];n[x]=n[x]||[],n[x].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ot.create=e=>new ot(e);const Y0=(e,t)=>{let n;switch(e.code){case T.invalid_type:e.received===V.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case T.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ce.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:n=`Unrecognized key(s) in object: ${ce.joinValues(e.keys,", ")}`;break;case T.invalid_union:n="Invalid input";break;case T.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ce.joinValues(e.options)}`;break;case T.invalid_enum_value:n=`Invalid enum value. Expected ${ce.joinValues(e.options)}, received '${e.received}'`;break;case T.invalid_arguments:n="Invalid function arguments";break;case T.invalid_return_type:n="Invalid function return type";break;case T.invalid_date:n="Invalid date";break;case T.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:ce.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case T.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case T.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case T.custom:n="Invalid input";break;case T.invalid_intersection_types:n="Intersection results could not be merged";break;case T.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case T.not_finite:n="Number must be finite";break;default:n=t.defaultError,ce.assertNever(e)}return{message:n}};let xd=Y0;function id(){return xd}const ad=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,x=[...n,...o.path||[]],i={...o,path:x};if(o.message!==void 0)return{...o,path:x,message:o.message};let a="";const l=r.filter(d=>!!d).slice().reverse();for(const d of l)a=d(i,{data:t,defaultError:a}).message;return{...o,path:x,message:a}};function U(e,t){const n=id(),r=ad({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Y0?void 0:Y0].filter(o=>!!o)});e.common.issues.push(r)}class Te{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return X;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const x=await o.key,i=await o.value;r.push({key:x,value:i})}return Te.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:x,value:i}=o;if(x.status==="aborted"||i.status==="aborted")return X;x.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),x.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[x.value]=i.value)}return{status:t.value,value:r}}}const X=Object.freeze({status:"aborted"}),Zt=e=>({status:"dirty",value:e}),Ve=e=>({status:"valid",value:e}),ws=e=>e.status==="aborted",bs=e=>e.status==="dirty",Rt=e=>e.status==="valid",qn=e=>typeof Promise<"u"&&e instanceof Promise;var G;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(G||(G={}));class Je{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const js=(e,t)=>{if(Rt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ot(e.common.issues);return this._error=n,this._error}}};function xe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(i,a)=>{const{message:l}=e;return i.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:o}}class le{get description(){return this._def.description}_getType(t){return ht(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:ht(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Te,ctx:{common:t.parent.common,data:t.data,parsedType:ht(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(qn(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ht(t)},o=this._parseSync({data:t,path:r.path,parent:r});return js(r,o)}"~validate"(t){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ht(t)};if(!this["~standard"].async)try{const r=this._parseSync({data:t,path:[],parent:n});return Rt(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>Rt(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ht(t)},o=this._parse({data:t,path:r.path,parent:r}),x=await(qn(o)?o:Promise.resolve(o));return js(r,x)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,x)=>{const i=t(o),a=()=>x.addIssue({code:T.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Ft({schema:this,typeName:ee.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return rt.create(this,this._def)}nullable(){return Dt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ge.create(this)}promise(){return Yn.create(this,this._def)}or(t){return Kn.create([this,t],this._def)}and(t){return Zn.create(this,t,this._def)}transform(t){return new Ft({...xe(this._def),schema:this,typeName:ee.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Qn({...xe(this._def),innerType:this,defaultValue:n,typeName:ee.ZodDefault})}brand(){return new rx({typeName:ee.ZodBranded,type:this,...xe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Xn({...xe(this._def),innerType:this,catchValue:n,typeName:ee.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Dr.create(this,t)}readonly(){return e0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ld=/^c[^\s-]{8,}$/i,cd=/^[0-9a-z]+$/,dd=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ud=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,hd=/^[a-z0-9_-]{21}$/i,Ed=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fd=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,pd=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,md="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let T0;const Cd=/^(?:(?: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])$/,Bd=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,gd=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ad=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Fd=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Dd=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ex="((\\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])))",kd=new RegExp(`^${ex}$`);function tx(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function yd(e){return new RegExp(`^${tx(e)}$`)}function vd(e){let t=`${ex}T${tx(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function wd(e,t){return!!((t==="v4"||!t)&&Cd.test(e)||(t==="v6"||!t)&&gd.test(e))}function bd(e,t){if(!Ed.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function jd(e,t){return!!((t==="v4"||!t)&&Bd.test(e)||(t==="v6"||!t)&&Ad.test(e))}class tt extends le{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==V.string){const x=this._getOrReturnCtx(t);return U(x,{code:T.invalid_type,expected:V.string,received:x.parsedType}),X}const r=new Te;let o;for(const x of this._def.checks)if(x.kind==="min")t.data.length<x.value&&(o=this._getOrReturnCtx(t,o),U(o,{code:T.too_small,minimum:x.value,type:"string",inclusive:!0,exact:!1,message:x.message}),r.dirty());else if(x.kind==="max")t.data.length>x.value&&(o=this._getOrReturnCtx(t,o),U(o,{code:T.too_big,maximum:x.value,type:"string",inclusive:!0,exact:!1,message:x.message}),r.dirty());else if(x.kind==="length"){const i=t.data.length>x.value,a=t.data.length<x.value;(i||a)&&(o=this._getOrReturnCtx(t,o),i?U(o,{code:T.too_big,maximum:x.value,type:"string",inclusive:!0,exact:!0,message:x.message}):a&&U(o,{code:T.too_small,minimum:x.value,type:"string",inclusive:!0,exact:!0,message:x.message}),r.dirty())}else if(x.kind==="email")pd.test(t.data)||(o=this._getOrReturnCtx(t,o),U(o,{validation:"email",code:T.invalid_string,message:x.message}),r.dirty());else if(x.kind==="emoji")T0||(T0=new RegExp(md,"u")),T0.test(t.data)||(o=this._getOrReturnCtx(t,o),U(o,{validation:"emoji",code:T.invalid_string,message:x.message}),r.dirty());else if(x.kind==="uuid")ud.test(t.data)||(o=this._getOrReturnCtx(t,o),U(o,{validation:"uuid",code:T.invalid_string,message:x.message}),r.dirty());else if(x.kind==="nanoid")hd.test(t.data)||(o=this._getOrReturnCtx(t,o),U(o,{validation:"nanoid",code:T.invalid_string,message:x.message}),r.dirty());else if(x.kind==="cuid")ld.test(t.data)||(o=this._getOrReturnCtx(t,o),U(o,{validation:"cuid",code:T.invalid_string,message:x.message}),r.dirty());else if(x.kind==="cuid2")cd.test(t.data)||(o=this._getOrReturnCtx(t,o),U(o,{validation:"cuid2",code:T.invalid_string,message:x.message}),r.dirty());else if(x.kind==="ulid")dd.test(t.data)||(o=this._getOrReturnCtx(t,o),U(o,{validation:"ulid",code:T.invalid_string,message:x.message}),r.dirty());else if(x.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),U(o,{validation:"url",code:T.invalid_string,message:x.message}),r.dirty()}else x.kind==="regex"?(x.regex.lastIndex=0,x.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),U(o,{validation:"regex",code:T.invalid_string,message:x.message}),r.dirty())):x.kind==="trim"?t.data=t.data.trim():x.kind==="includes"?t.data.includes(x.value,x.position)||(o=this._getOrReturnCtx(t,o),U(o,{code:T.invalid_string,validation:{includes:x.value,position:x.position},message:x.message}),r.dirty()):x.kind==="toLowerCase"?t.data=t.data.toLowerCase():x.kind==="toUpperCase"?t.data=t.data.toUpperCase():x.kind==="startsWith"?t.data.startsWith(x.value)||(o=this._getOrReturnCtx(t,o),U(o,{code:T.invalid_string,validation:{startsWith:x.value},message:x.message}),r.dirty()):x.kind==="endsWith"?t.data.endsWith(x.value)||(o=this._getOrReturnCtx(t,o),U(o,{code:T.invalid_string,validation:{endsWith:x.value},message:x.message}),r.dirty()):x.kind==="datetime"?vd(x).test(t.data)||(o=this._getOrReturnCtx(t,o),U(o,{code:T.invalid_string,validation:"datetime",message:x.message}),r.dirty()):x.kind==="date"?kd.test(t.data)||(o=this._getOrReturnCtx(t,o),U(o,{code:T.invalid_string,validation:"date",message:x.message}),r.dirty()):x.kind==="time"?yd(x).test(t.data)||(o=this._getOrReturnCtx(t,o),U(o,{code:T.invalid_string,validation:"time",message:x.message}),r.dirty()):x.kind==="duration"?fd.test(t.data)||(o=this._getOrReturnCtx(t,o),U(o,{validation:"duration",code:T.invalid_string,message:x.message}),r.dirty()):x.kind==="ip"?wd(t.data,x.version)||(o=this._getOrReturnCtx(t,o),U(o,{validation:"ip",code:T.invalid_string,message:x.message}),r.dirty()):x.kind==="jwt"?bd(t.data,x.alg)||(o=this._getOrReturnCtx(t,o),U(o,{validation:"jwt",code:T.invalid_string,message:x.message}),r.dirty()):x.kind==="cidr"?jd(t.data,x.version)||(o=this._getOrReturnCtx(t,o),U(o,{validation:"cidr",code:T.invalid_string,message:x.message}),r.dirty()):x.kind==="base64"?Fd.test(t.data)||(o=this._getOrReturnCtx(t,o),U(o,{validation:"base64",code:T.invalid_string,message:x.message}),r.dirty()):x.kind==="base64url"?Dd.test(t.data)||(o=this._getOrReturnCtx(t,o),U(o,{validation:"base64url",code:T.invalid_string,message:x.message}),r.dirty()):ce.assertNever(x);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:T.invalid_string,...G.errToObj(r)})}_addCheck(t){return new tt({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...G.errToObj(t)})}url(t){return this._addCheck({kind:"url",...G.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...G.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...G.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...G.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...G.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...G.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...G.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...G.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...G.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...G.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...G.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...G.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...G.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...G.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...G.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...G.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...G.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...G.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...G.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...G.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...G.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...G.errToObj(n)})}nonempty(t){return this.min(1,G.errToObj(t))}trim(){return new tt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new tt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new tt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}tt.create=e=>new tt({checks:[],typeName:ee.ZodString,coerce:e?.coerce??!1,...xe(e)});function _d(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,x=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return x%i/10**o}class Ut extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==V.number){const x=this._getOrReturnCtx(t);return U(x,{code:T.invalid_type,expected:V.number,received:x.parsedType}),X}let r;const o=new Te;for(const x of this._def.checks)x.kind==="int"?ce.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),U(r,{code:T.invalid_type,expected:"integer",received:"float",message:x.message}),o.dirty()):x.kind==="min"?(x.inclusive?t.data<x.value:t.data<=x.value)&&(r=this._getOrReturnCtx(t,r),U(r,{code:T.too_small,minimum:x.value,type:"number",inclusive:x.inclusive,exact:!1,message:x.message}),o.dirty()):x.kind==="max"?(x.inclusive?t.data>x.value:t.data>=x.value)&&(r=this._getOrReturnCtx(t,r),U(r,{code:T.too_big,maximum:x.value,type:"number",inclusive:x.inclusive,exact:!1,message:x.message}),o.dirty()):x.kind==="multipleOf"?_d(t.data,x.value)!==0&&(r=this._getOrReturnCtx(t,r),U(r,{code:T.not_multiple_of,multipleOf:x.value,message:x.message}),o.dirty()):x.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),U(r,{code:T.not_finite,message:x.message}),o.dirty()):ce.assertNever(x);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,G.toString(n))}gt(t,n){return this.setLimit("min",t,!1,G.toString(n))}lte(t,n){return this.setLimit("max",t,!0,G.toString(n))}lt(t,n){return this.setLimit("max",t,!1,G.toString(n))}setLimit(t,n,r,o){return new Ut({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:G.toString(o)}]})}_addCheck(t){return new Ut({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:G.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:G.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:G.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:G.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:G.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:G.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:G.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:G.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:G.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&ce.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ut.create=e=>new Ut({checks:[],typeName:ee.ZodNumber,coerce:e?.coerce||!1,...xe(e)});class on extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==V.bigint)return this._getInvalidInput(t);let r;const o=new Te;for(const x of this._def.checks)x.kind==="min"?(x.inclusive?t.data<x.value:t.data<=x.value)&&(r=this._getOrReturnCtx(t,r),U(r,{code:T.too_small,type:"bigint",minimum:x.value,inclusive:x.inclusive,message:x.message}),o.dirty()):x.kind==="max"?(x.inclusive?t.data>x.value:t.data>=x.value)&&(r=this._getOrReturnCtx(t,r),U(r,{code:T.too_big,type:"bigint",maximum:x.value,inclusive:x.inclusive,message:x.message}),o.dirty()):x.kind==="multipleOf"?t.data%x.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),U(r,{code:T.not_multiple_of,multipleOf:x.value,message:x.message}),o.dirty()):ce.assertNever(x);return{status:o.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return U(n,{code:T.invalid_type,expected:V.bigint,received:n.parsedType}),X}gte(t,n){return this.setLimit("min",t,!0,G.toString(n))}gt(t,n){return this.setLimit("min",t,!1,G.toString(n))}lte(t,n){return this.setLimit("max",t,!0,G.toString(n))}lt(t,n){return this.setLimit("max",t,!1,G.toString(n))}setLimit(t,n,r,o){return new on({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:G.toString(o)}]})}_addCheck(t){return new on({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:G.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:G.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:G.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:G.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:G.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}on.create=e=>new on({checks:[],typeName:ee.ZodBigInt,coerce:e?.coerce??!1,...xe(e)});class Q0 extends le{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==V.boolean){const r=this._getOrReturnCtx(t);return U(r,{code:T.invalid_type,expected:V.boolean,received:r.parsedType}),X}return Ve(t.data)}}Q0.create=e=>new Q0({typeName:ee.ZodBoolean,coerce:e?.coerce||!1,...xe(e)});class Hn extends le{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==V.date){const x=this._getOrReturnCtx(t);return U(x,{code:T.invalid_type,expected:V.date,received:x.parsedType}),X}if(Number.isNaN(t.data.getTime())){const x=this._getOrReturnCtx(t);return U(x,{code:T.invalid_date}),X}const r=new Te;let o;for(const x of this._def.checks)x.kind==="min"?t.data.getTime()<x.value&&(o=this._getOrReturnCtx(t,o),U(o,{code:T.too_small,message:x.message,inclusive:!0,exact:!1,minimum:x.value,type:"date"}),r.dirty()):x.kind==="max"?t.data.getTime()>x.value&&(o=this._getOrReturnCtx(t,o),U(o,{code:T.too_big,message:x.message,inclusive:!0,exact:!1,maximum:x.value,type:"date"}),r.dirty()):ce.assertNever(x);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Hn({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:G.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:G.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Hn.create=e=>new Hn({checks:[],coerce:e?.coerce||!1,typeName:ee.ZodDate,...xe(e)});class _s extends le{_parse(t){if(this._getType(t)!==V.symbol){const r=this._getOrReturnCtx(t);return U(r,{code:T.invalid_type,expected:V.symbol,received:r.parsedType}),X}return Ve(t.data)}}_s.create=e=>new _s({typeName:ee.ZodSymbol,...xe(e)});class X0 extends le{_parse(t){if(this._getType(t)!==V.undefined){const r=this._getOrReturnCtx(t);return U(r,{code:T.invalid_type,expected:V.undefined,received:r.parsedType}),X}return Ve(t.data)}}X0.create=e=>new X0({typeName:ee.ZodUndefined,...xe(e)});class er extends le{_parse(t){if(this._getType(t)!==V.null){const r=this._getOrReturnCtx(t);return U(r,{code:T.invalid_type,expected:V.null,received:r.parsedType}),X}return Ve(t.data)}}er.create=e=>new er({typeName:ee.ZodNull,...xe(e)});class Ss extends le{constructor(){super(...arguments),this._any=!0}_parse(t){return Ve(t.data)}}Ss.create=e=>new Ss({typeName:ee.ZodAny,...xe(e)});class Ps extends le{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ve(t.data)}}Ps.create=e=>new Ps({typeName:ee.ZodUnknown,...xe(e)});class ft extends le{_parse(t){const n=this._getOrReturnCtx(t);return U(n,{code:T.invalid_type,expected:V.never,received:n.parsedType}),X}}ft.create=e=>new ft({typeName:ee.ZodNever,...xe(e)});class Is extends le{_parse(t){if(this._getType(t)!==V.undefined){const r=this._getOrReturnCtx(t);return U(r,{code:T.invalid_type,expected:V.void,received:r.parsedType}),X}return Ve(t.data)}}Is.create=e=>new Is({typeName:ee.ZodVoid,...xe(e)});class Ge extends le{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==V.array)return U(n,{code:T.invalid_type,expected:V.array,received:n.parsedType}),X;if(o.exactLength!==null){const i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(U(n,{code:i?T.too_big:T.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(U(n,{code:T.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(U(n,{code:T.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Je(n,i,n.path,a)))).then(i=>Te.mergeArray(r,i));const x=[...n.data].map((i,a)=>o.type._parseSync(new Je(n,i,n.path,a)));return Te.mergeArray(r,x)}get element(){return this._def.type}min(t,n){return new Ge({...this._def,minLength:{value:t,message:G.toString(n)}})}max(t,n){return new Ge({...this._def,maxLength:{value:t,message:G.toString(n)}})}length(t,n){return new Ge({...this._def,exactLength:{value:t,message:G.toString(n)}})}nonempty(t){return this.min(1,t)}}Ge.create=(e,t)=>new Ge({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ee.ZodArray,...xe(t)});function It(e){if(e instanceof Ae){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=rt.create(It(r))}return new Ae({...e._def,shape:()=>t})}else return e instanceof Ge?new Ge({...e._def,type:It(e.element)}):e instanceof rt?rt.create(It(e.unwrap())):e instanceof Dt?Dt.create(It(e.unwrap())):e instanceof gt?gt.create(e.items.map(t=>It(t))):e}class Ae extends le{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=ce.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==V.object){const d=this._getOrReturnCtx(t);return U(d,{code:T.invalid_type,expected:V.object,received:d.parsedType}),X}const{status:r,ctx:o}=this._processInputParams(t),{shape:x,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof ft&&this._def.unknownKeys==="strip"))for(const d in o.data)i.includes(d)||a.push(d);const l=[];for(const d of i){const u=x[d],c=o.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new Je(o,c,o.path,d)),alwaysSet:d in o.data})}if(this._def.catchall instanceof ft){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(d==="strict")a.length>0&&(U(o,{code:T.unrecognized_keys,keys:a}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const u of a){const c=o.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new Je(o,c,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of l){const c=await u.key,p=await u.value;d.push({key:c,value:p,alwaysSet:u.alwaysSet})}return d}).then(d=>Te.mergeObjectSync(r,d)):Te.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return G.errToObj,new Ae({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{const o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:G.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new Ae({...this._def,unknownKeys:"strip"})}passthrough(){return new Ae({...this._def,unknownKeys:"passthrough"})}extend(t){return new Ae({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Ae({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ee.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Ae({...this._def,catchall:t})}pick(t){const n={};for(const r of ce.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Ae({...this._def,shape:()=>n})}omit(t){const n={};for(const r of ce.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new Ae({...this._def,shape:()=>n})}deepPartial(){return It(this)}partial(t){const n={};for(const r of ce.objectKeys(this.shape)){const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new Ae({...this._def,shape:()=>n})}required(t){const n={};for(const r of ce.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let x=this.shape[r];for(;x instanceof rt;)x=x._def.innerType;n[r]=x}return new Ae({...this._def,shape:()=>n})}keyof(){return nx(ce.objectKeys(this.shape))}}Ae.create=(e,t)=>new Ae({shape:()=>e,unknownKeys:"strip",catchall:ft.create(),typeName:ee.ZodObject,...xe(t)});Ae.strictCreate=(e,t)=>new Ae({shape:()=>e,unknownKeys:"strict",catchall:ft.create(),typeName:ee.ZodObject,...xe(t)});Ae.lazycreate=(e,t)=>new Ae({shape:e,unknownKeys:"strip",catchall:ft.create(),typeName:ee.ZodObject,...xe(t)});class Kn extends le{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(x){for(const a of x)if(a.result.status==="valid")return a.result;for(const a of x)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=x.map(a=>new ot(a.ctx.common.issues));return U(n,{code:T.invalid_union,unionErrors:i}),X}if(n.common.async)return Promise.all(r.map(async x=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await x._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let x;const i=[];for(const l of r){const d={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!x&&(x={result:u,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(x)return n.common.issues.push(...x.ctx.common.issues),x.result;const a=i.map(l=>new ot(l));return U(n,{code:T.invalid_union,unionErrors:a}),X}}get options(){return this._def.options}}Kn.create=(e,t)=>new Kn({options:e,typeName:ee.ZodUnion,...xe(t)});const et=e=>e instanceof nr?et(e.schema):e instanceof Ft?et(e.innerType()):e instanceof Jn?[e.value]:e instanceof At?e.options:e instanceof rr?ce.objectValues(e.enum):e instanceof Qn?et(e._def.innerType):e instanceof X0?[void 0]:e instanceof er?[null]:e instanceof rt?[void 0,...et(e.unwrap())]:e instanceof Dt?[null,...et(e.unwrap())]:e instanceof rx||e instanceof e0?et(e.unwrap()):e instanceof Xn?et(e._def.innerType):[];class Fr extends le{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==V.object)return U(n,{code:T.invalid_type,expected:V.object,received:n.parsedType}),X;const r=this.discriminator,o=n.data[r],x=this.optionsMap.get(o);return x?n.common.async?x._parseAsync({data:n.data,path:n.path,parent:n}):x._parseSync({data:n.data,path:n.path,parent:n}):(U(n,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),X)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const x of n){const i=et(x.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of i){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,x)}}return new Fr({typeName:ee.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...xe(r)})}}function tr(e,t){const n=ht(e),r=ht(t);if(e===t)return{valid:!0,data:e};if(n===V.object&&r===V.object){const o=ce.objectKeys(t),x=ce.objectKeys(e).filter(a=>o.indexOf(a)!==-1),i={...e,...t};for(const a of x){const l=tr(e[a],t[a]);if(!l.valid)return{valid:!1};i[a]=l.data}return{valid:!0,data:i}}else if(n===V.array&&r===V.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let x=0;x<e.length;x++){const i=e[x],a=t[x],l=tr(i,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===V.date&&r===V.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Zn extends le{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(x,i)=>{if(ws(x)||ws(i))return X;const a=tr(x.value,i.value);return a.valid?((bs(x)||bs(i))&&n.dirty(),{status:n.value,value:a.data}):(U(r,{code:T.invalid_intersection_types}),X)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([x,i])=>o(x,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Zn.create=(e,t,n)=>new Zn({left:e,right:t,typeName:ee.ZodIntersection,...xe(n)});class gt extends le{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==V.array)return U(r,{code:T.invalid_type,expected:V.array,received:r.parsedType}),X;if(r.data.length<this._def.items.length)return U(r,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X;!this._def.rest&&r.data.length>this._def.items.length&&(U(r,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const x=[...r.data].map((i,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Je(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(x).then(i=>Te.mergeArray(n,i)):Te.mergeArray(n,x)}get items(){return this._def.items}rest(t){return new gt({...this._def,rest:t})}}gt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new gt({items:e,typeName:ee.ZodTuple,rest:null,...xe(t)})};class Gn extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==V.object)return U(r,{code:T.invalid_type,expected:V.object,received:r.parsedType}),X;const o=[],x=this._def.keyType,i=this._def.valueType;for(const a in r.data)o.push({key:x._parse(new Je(r,a,r.path,a)),value:i._parse(new Je(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Te.mergeObjectAsync(n,o):Te.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof le?new Gn({keyType:t,valueType:n,typeName:ee.ZodRecord,...xe(r)}):new Gn({keyType:tt.create(),valueType:t,typeName:ee.ZodRecord,...xe(n)})}}class Ns extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==V.map)return U(r,{code:T.invalid_type,expected:V.map,received:r.parsedType}),X;const o=this._def.keyType,x=this._def.valueType,i=[...r.data.entries()].map(([a,l],d)=>({key:o._parse(new Je(r,a,r.path,[d,"key"])),value:x._parse(new Je(r,l,r.path,[d,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of i){const d=await l.key,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return X;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of i){const d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return X;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}}}}Ns.create=(e,t,n)=>new Ns({valueType:t,keyType:e,typeName:ee.ZodMap,...xe(n)});class xn extends le{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==V.set)return U(r,{code:T.invalid_type,expected:V.set,received:r.parsedType}),X;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(U(r,{code:T.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(U(r,{code:T.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const x=this._def.valueType;function i(l){const d=new Set;for(const u of l){if(u.status==="aborted")return X;u.status==="dirty"&&n.dirty(),d.add(u.value)}return{status:n.value,value:d}}const a=[...r.data.values()].map((l,d)=>x._parse(new Je(r,l,r.path,d)));return r.common.async?Promise.all(a).then(l=>i(l)):i(a)}min(t,n){return new xn({...this._def,minSize:{value:t,message:G.toString(n)}})}max(t,n){return new xn({...this._def,maxSize:{value:t,message:G.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}xn.create=(e,t)=>new xn({valueType:e,minSize:null,maxSize:null,typeName:ee.ZodSet,...xe(t)});class nr extends le{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}nr.create=(e,t)=>new nr({getter:e,typeName:ee.ZodLazy,...xe(t)});class Jn extends le{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return U(n,{received:n.data,code:T.invalid_literal,expected:this._def.value}),X}return{status:"valid",value:t.data}}get value(){return this._def.value}}Jn.create=(e,t)=>new Jn({value:e,typeName:ee.ZodLiteral,...xe(t)});function nx(e,t){return new At({values:e,typeName:ee.ZodEnum,...xe(t)})}class At extends le{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return U(n,{expected:ce.joinValues(r),received:n.parsedType,code:T.invalid_type}),X}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return U(n,{received:n.data,code:T.invalid_enum_value,options:r}),X}return Ve(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return At.create(t,{...this._def,...n})}exclude(t,n=this._def){return At.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}At.create=nx;class rr extends le{_parse(t){const n=ce.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==V.string&&r.parsedType!==V.number){const o=ce.objectValues(n);return U(r,{expected:ce.joinValues(o),received:r.parsedType,code:T.invalid_type}),X}if(this._cache||(this._cache=new Set(ce.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=ce.objectValues(n);return U(r,{received:r.data,code:T.invalid_enum_value,options:o}),X}return Ve(t.data)}get enum(){return this._def.values}}rr.create=(e,t)=>new rr({values:e,typeName:ee.ZodNativeEnum,...xe(t)});class Yn extends le{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==V.promise&&n.common.async===!1)return U(n,{code:T.invalid_type,expected:V.promise,received:n.parsedType}),X;const r=n.parsedType===V.promise?n.data:Promise.resolve(n.data);return Ve(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Yn.create=(e,t)=>new Yn({type:e,typeName:ee.ZodPromise,...xe(t)});class Ft extends le{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ee.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,x={addIssue:i=>{U(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(x.addIssue=x.addIssue.bind(x),o.type==="preprocess"){const i=o.transform(r.data,x);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return X;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?X:l.status==="dirty"||n.value==="dirty"?Zt(l.value):l});{if(n.value==="aborted")return X;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?X:a.status==="dirty"||n.value==="dirty"?Zt(a.value):a}}if(o.type==="refinement"){const i=a=>{const l=o.refinement(a,x);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?X:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?X:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Rt(i))return X;const a=o.transform(i.value,x);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Rt(i)?Promise.resolve(o.transform(i.value,x)).then(a=>({status:n.value,value:a})):X);ce.assertNever(o)}}Ft.create=(e,t,n)=>new Ft({schema:e,typeName:ee.ZodEffects,effect:t,...xe(n)});Ft.createWithPreprocess=(e,t,n)=>new Ft({schema:t,effect:{type:"preprocess",transform:e},typeName:ee.ZodEffects,...xe(n)});class rt extends le{_parse(t){return this._getType(t)===V.undefined?Ve(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}rt.create=(e,t)=>new rt({innerType:e,typeName:ee.ZodOptional,...xe(t)});class Dt extends le{_parse(t){return this._getType(t)===V.null?Ve(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Dt.create=(e,t)=>new Dt({innerType:e,typeName:ee.ZodNullable,...xe(t)});class Qn extends le{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===V.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Qn.create=(e,t)=>new Qn({innerType:e,typeName:ee.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...xe(t)});class Xn extends le{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return qn(o)?o.then(x=>({status:"valid",value:x.status==="valid"?x.value:this._def.catchValue({get error(){return new ot(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ot(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Xn.create=(e,t)=>new Xn({innerType:e,typeName:ee.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...xe(t)});class Ms extends le{_parse(t){if(this._getType(t)!==V.nan){const r=this._getOrReturnCtx(t);return U(r,{code:T.invalid_type,expected:V.nan,received:r.parsedType}),X}return{status:"valid",value:t.data}}}Ms.create=e=>new Ms({typeName:ee.ZodNaN,...xe(e)});class rx extends le{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Dr extends le{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const x=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return x.status==="aborted"?X:x.status==="dirty"?(n.dirty(),Zt(x.value)):this._def.out._parseAsync({data:x.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?X:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new Dr({in:t,out:n,typeName:ee.ZodPipeline})}}class e0 extends le{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Rt(o)&&(o.value=Object.freeze(o.value)),o);return qn(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}e0.create=(e,t)=>new e0({innerType:e,typeName:ee.ZodReadonly,...xe(t)});var ee;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ee||(ee={}));const N=tt.create,ne=Ut.create,be=Q0.create;ft.create;const kt=Ge.create,W=Ae.create;Kn.create;const kr=Fr.create;Zn.create;gt.create;const sx=Gn.create,Q=Jn.create,oe=At.create;Yn.create;rt.create;Dt.create;const Sd=["ide_opened_file","ide_selection","task-notification","system-reminder","local-command-stdout","local-command-stderr","command-message","command-args","command-name","recommended_plugins","environment_context"],Pd=/^(?:\s*<([a-zA-Z][\w-]*)\b[^>]*>[\s\S]*?<\/\1>\s*)+$/,Id=/^\s*#\s*Context from my IDE setup:/i,Nd=/##\s*My request:\s*/i;function Md(e){let t=e;if(Id.test(t)){const n=Nd.exec(t);if(n?.index===void 0)return"";t=t.slice(n.index+n[0].length)}if(/<command-(name|message|args)>/.test(t)){const n=t.match(/<command-name>([^<]*)<\/command-name>/)?.[1]?.trim(),r=t.match(/<command-args>([^<]*)<\/command-args>/)?.[1]?.trim();return n===void 0||n===""?"":r?`${n} ${r}`:n}for(const n of Sd)t=t.replace(new RegExp(`<${n}\\b[^>]*>[\\s\\S]*?</${n}>`,"gi"),""),t=t.replace(new RegExp(`<${n}\\b[^>]*>[\\s\\S]*$`,"i"),"");return Pd.test(t.trim())?"":t.trim()}function Td(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Ts(e){if(typeof e!="number")throw new TypeError("number expected, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError("positive integer expected, got "+e)}function Oe(e,t,n=""){const r=Td(e),o=e?.length,x=t!==void 0;if(!r||x&&o!==t){const i=n&&`"${n}" `,a=x?` of length ${t}`:"",l=r?`length=${o}`:`type=${typeof e}`,d=i+"expected Uint8Array"+a+", got "+l;throw r?new RangeError(d):new TypeError(d)}return e}function Os(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Od(e,t,n=!1){Oe(e,void 0,"output");const r=t.outputLen;if(e.length<r)throw new RangeError("digestInto() expects output buffer of length at least "+r);if(n&&!an(e))throw new Error("invalid output, must be aligned")}function Ld(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function Bt(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Et(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function E0(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const yr=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,ox=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,ge=yr?e=>e:e=>ox(e)>>>0,Rd=e=>{for(let t=0;t<e.length;t++)e[t]=ox(e[t]);return e},vr=yr?e=>e:Rd;function Ud(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function $d(e,t,n){const r=t,o=n||(()=>[]),x=(a,l)=>r(l,...o(a)).update(a).digest(),i=r(new Uint8Array(e),...o(new Uint8Array(0)));return x.outputLen=i.outputLen,x.blockLen=i.blockLen,x.create=(a,...l)=>r(a,...l),x}const zd=(e,t)=>{function n(r,...o){if(Oe(r,void 0,"key"),e.nonceLength!==void 0){const u=o[0];Oe(u,e.varSizeNonce?void 0:e.nonceLength,"nonce")}const x=e.tagLength;x&&o[1]!==void 0&&Oe(o[1],void 0,"AAD");const i=t(r,...o),a=(u,c)=>{if(c!==void 0){if(u!==2)throw new Error("cipher output not supported");Oe(c,void 0,"output")}};let l=!1;return{encrypt(u,c){if(l)throw new Error("cannot encrypt() twice with same key + nonce");return l=!0,Oe(u),a(i.encrypt.length,c),i.encrypt(u,c)},decrypt(u,c){if(Oe(u),x&&u.length<x)throw new Error('"ciphertext" expected length bigger than tagLength='+x);return a(i.decrypt.length,c),i.decrypt(u,c)}}}return Object.assign(n,e),n};function Wd(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(Oe(t,void 0,"output"),t.length!==e)throw new Error('"output" expected Uint8Array of length '+e+", got: "+t.length);if(n&&!an(t))throw new Error("invalid output, must be aligned");return t}function Vd(e,t,n){Ts(e),Ts(t);const r=new Uint8Array(16),o=E0(r);return o.setBigUint64(0,BigInt(t),n),o.setBigUint64(8,BigInt(e),n),r}function an(e){return e.byteOffset%4===0}function ln(e){return Uint8Array.from(Oe(e))}const _t=16,xx=new Uint8Array(16),Kt=Bt(xx),qd=225,Hd=(e,t,n,r)=>{const o=r&1;return{s3:n<<31|r>>>1,s2:t<<31|n>>>1,s1:e<<31|t>>>1,s0:e>>>1^qd<<24&-(o&1)}},In=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255|0,Kd=e=>e>64*1024?8:e>1024?4:2;class Zd{blockLen=_t;outputLen=_t;s0=0;s1=0;s2=0;s3=0;finished=!1;destroyed=!1;t;W;windowSize;constructor(t,n){Oe(t,16,"key"),t=ln(t);const r=E0(t);let o=r.getUint32(0,!1),x=r.getUint32(4,!1),i=r.getUint32(8,!1),a=r.getUint32(12,!1);const l=[];for(let A=0;A<128;A++)l.push({s0:In(o),s1:In(x),s2:In(i),s3:In(a)}),{s0:o,s1:x,s2:i,s3:a}=Hd(o,x,i,a);const d=Kd(n||1024);if(![1,2,4,8].includes(d))throw new Error("ghash: invalid window size, expected 2, 4 or 8");this.W=d;const c=128/d,p=this.windowSize=2**d,B=[];for(let A=0;A<c;A++)for(let k=0;k<p;k++){let C=0,b=0,v=0,F=0;for(let m=0;m<d;m++){if(!(k>>>d-m-1&1))continue;const{s0:D,s1:h,s2:E,s3:w}=l[d*A+m];C^=D,b^=h,v^=E,F^=w}B.push({s0:C,s1:b,s2:v,s3:F})}this.t=B}_updateBlock(t,n,r,o){t^=this.s0,n^=this.s1,r^=this.s2,o^=this.s3;const{W:x,t:i,windowSize:a}=this;let l=0,d=0,u=0,c=0;const p=(1<<x)-1;let B=0;for(const A of[t,n,r,o])for(let k=0;k<4;k++){const C=A>>>8*k&255;for(let b=8/x-1;b>=0;b--){const v=C>>>x*b&p,{s0:F,s1:m,s2:f,s3:D}=i[B*a+v];l^=F,d^=m,u^=f,c^=D,B+=1}}this.s0=l,this.s1=d,this.s2=u,this.s3=c}update(t){Os(this),Oe(t),t=ln(t);const n=Bt(t),r=Math.floor(t.length/_t),o=t.length%_t;for(let x=0;x<r;x++)this._updateBlock(ge(n[x*4+0]),ge(n[x*4+1]),ge(n[x*4+2]),ge(n[x*4+3]));return o&&(xx.set(t.subarray(r*_t)),this._updateBlock(ge(Kt[0]),ge(Kt[1]),ge(Kt[2]),ge(Kt[3])),Et(Kt)),this}destroy(){this.destroyed=!0;const{t}=this;for(const n of t)n.s0=0,n.s1=0,n.s2=0,n.s3=0}digestInto(t){Os(this),Od(t,this,!0),this.finished=!0;const{s0:n,s1:r,s2:o,s3:x}=this,i=Bt(t);i[0]=n,i[1]=r,i[2]=o,i[3]=x,vr(i)}digest(){const t=new Uint8Array(_t);return this.digestInto(t),this.destroy(),t}}const Ls=$d(16,(e,t)=>new Zd(e,t),e=>[e.length]),sr=16,Gd=4,Nn=new Uint8Array(sr),Jd=283;function Yd(e){if(![16,24,32].includes(e.length))throw new Error('"aes key" expected Uint8Array of length 16/24/32, got length='+e.length)}function wr(e){return e<<1^Jd&-(e>>7)}function Rs(e,t){let n=0;for(;t>0;t>>=1)n^=e&-(t&1),e=wr(e);return n}const Qd=(()=>{const e=new Uint8Array(256);for(let n=0,r=1;n<256;n++,r^=wr(r))e[n]=r;const t=new Uint8Array(256);t[0]=99;for(let n=0;n<255;n++){let r=e[255-n];r|=r<<8,t[e[n]]=(r^r>>4^r>>5^r>>6^r>>7^99)&255}return Et(e),t})(),Xd=e=>e<<24|e>>>8,O0=e=>e<<8|e>>>24;function eu(e,t){if(e.length!==256)throw new Error("Wrong sbox length");const n=new Uint32Array(256).map((d,u)=>t(e[u])),r=n.map(O0),o=r.map(O0),x=o.map(O0),i=new Uint32Array(256*256),a=new Uint32Array(256*256),l=new Uint16Array(256*256);for(let d=0;d<256;d++)for(let u=0;u<256;u++){const c=d*256+u;i[c]=n[d]^r[u],a[c]=o[d]^x[u],l[c]=e[d]<<8|e[u]}return{sbox:e,sbox2:l,T0:n,T1:r,T2:o,T3:x,T01:i,T23:a}}const ix=eu(Qd,e=>Rs(e,3)<<24|e<<16|e<<8|Rs(e,2)),tu=(()=>{const e=new Uint8Array(16);for(let t=0,n=1;t<16;t++,n=wr(n))e[t]=n;return e})();function nu(e){Oe(e);const t=e.length;Yd(e);const{sbox2:n}=ix,r=[];(!yr||!an(e))&&r.push(e=ln(e));const o=vr(Bt(e)),x=o.length,i=l=>Gt(n,l,l,l,l),a=new Uint32Array(t+28);a.set(o);for(let l=x;l<a.length;l++){let d=a[l-1];l%x===0?d=i(Xd(d))^tu[l/x-1]:x>6&&l%x===4&&(d=i(d)),a[l]=a[l-x]^d}return Et(...r),a}function Mn(e,t,n,r,o,x){return e[n<<8&65280|r>>>8&255]^t[o>>>8&65280|x>>>24&255]}function Gt(e,t,n,r,o){return e[t&255|n&65280]|e[r>>>16&255|o>>>16&65280]<<16}function Us(e,t,n,r,o){const{sbox2:x,T01:i,T23:a}=ix;let l=0;t^=e[l++],n^=e[l++],r^=e[l++],o^=e[l++];const d=e.length/4-2;for(let A=0;A<d;A++){const k=e[l++]^Mn(i,a,t,n,r,o),C=e[l++]^Mn(i,a,n,r,o,t),b=e[l++]^Mn(i,a,r,o,t,n),v=e[l++]^Mn(i,a,o,t,n,r);t=k,n=C,r=b,o=v}const u=e[l++]^Gt(x,t,n,r,o),c=e[l++]^Gt(x,n,r,o,t),p=e[l++]^Gt(x,r,o,t,n),B=e[l++]^Gt(x,o,t,n,r);return{s0:u,s1:c,s2:p,s3:B}}function Tn(e,t,n,r,o){Oe(n,sr,"nonce"),Oe(r),o=Wd(r.length,o);const x=n,i=Bt(x),a=E0(x),l=Bt(r),d=Bt(o),u=t?0:12,c=r.length;let p=a.getUint32(u,t),{s0:B,s1:A,s2:k,s3:C}=Us(e,ge(i[0]),ge(i[1]),ge(i[2]),ge(i[3]));for(let v=0;v+4<=l.length;v+=4)d[v+0]=l[v+0]^ge(B),d[v+1]=l[v+1]^ge(A),d[v+2]=l[v+2]^ge(k),d[v+3]=l[v+3]^ge(C),p=p+1>>>0,a.setUint32(u,p,t),{s0:B,s1:A,s2:k,s3:C}=Us(e,ge(i[0]),ge(i[1]),ge(i[2]),ge(i[3]));const b=sr*Math.floor(l.length/Gd);if(b<c){const v=new Uint32Array([B,A,k,C]);vr(v);const F=Ld(v);for(let m=b,f=0;m<c;m++,f++)o[m]=r[m]^F[f];Et(v)}return o}function ru(e,t,n,r,o){const x=o?o.length:0,i=e.create(n,r.length+x);o&&i.update(o);const a=Vd(8*r.length,8*x,t);i.update(r),i.update(a);const l=i.digest();return Et(a),l}const ax=zd({blockSize:16,nonceLength:12,tagLength:16,varSizeNonce:!0},function(t,n,r){if(n.length<8)throw new Error("aes/gcm: invalid nonce length");const o=16;function x(a,l,d){const u=ru(Ls,!1,a,d,r);for(let c=0;c<l.length;c++)u[c]^=l[c];return u}function i(){const a=nu(t),l=Nn.slice(),d=Nn.slice();if(Tn(a,!1,d,d,l),n.length===12)d.set(n);else{const c=Nn.slice();E0(c).setBigUint64(8,BigInt(n.length*8),!1);const B=Ls.create(l).update(n).update(c);B.digestInto(d),B.destroy()}const u=Tn(a,!1,d,Nn);return{xk:a,authKey:l,counter:d,tagMask:u}}return{encrypt(a){const{xk:l,authKey:d,counter:u,tagMask:c}=i(),p=new Uint8Array(a.length+o),B=[l,d,u,c];an(a)||B.push(a=ln(a)),Tn(l,!1,u,a,p.subarray(0,a.length));const A=x(d,c,p.subarray(0,p.length-o));return B.push(A),p.set(A,a.length),Et(...B),p},decrypt(a){const{xk:l,authKey:d,counter:u,tagMask:c}=i(),p=[l,d,c,u];an(a)||p.push(a=ln(a));const B=a.subarray(0,-o),A=a.subarray(-o),k=x(d,c,B);if(p.push(k),!Ud(k,A))throw Et(...p),new Error("aes/gcm: invalid ghash tag");const C=Tn(l,!1,u,B);return Et(...p),C}}});function su(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function or(e,t=""){if(typeof e!="number"){const n=t&&`"${t}" `;throw new TypeError(`${n}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){const n=t&&`"${t}" `;throw new RangeError(`${n}expected integer >= 0, got ${e}`)}}function cn(e,t,n=""){const r=su(e),o=e?.length;if(!r||t!==void 0){const i=n&&`"${n}" `,a="",l=r?`length=${o}`:`type=${typeof e}`,d=i+"expected Uint8Array"+a+", got "+l;throw r?new RangeError(d):new TypeError(d)}return e}function br(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(or(e.outputLen),or(e.blockLen),e.outputLen<1)throw new Error('"outputLen" must be >= 1');if(e.blockLen<1)throw new Error('"blockLen" must be >= 1')}function t0(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function lx(e,t){cn(e,void 0,"digestInto() output");const n=t.outputLen;if(e.length<n)throw new RangeError('"digestInto() output" expected to be of length >='+n)}function dn(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function L0(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ze(e,t){return e<<32-t|e>>>t}function ou(e,t={}){const n=(o,x)=>e(x).update(o).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=o=>e(o),Object.assign(n,t),Object.freeze(n)}const xu=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});class $s{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(t,n){if(br(t),cn(n,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,o=new Uint8Array(r);o.set(n.length>r?t.create().update(n).digest():n);for(let x=0;x<o.length;x++)o[x]^=54;this.iHash.update(o),this.oHash=t.create();for(let x=0;x<o.length;x++)o[x]^=106;this.oHash.update(o),dn(o)}update(t){return t0(this),this.iHash.update(t),this}digestInto(t){t0(this),lx(t,this),this.finished=!0;const n=t.subarray(0,this.outputLen);this.iHash.digestInto(n),this.oHash.update(n),this.oHash.digestInto(n),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});const{oHash:n,iHash:r,finished:o,destroyed:x,blockLen:i,outputLen:a}=this;return t=t,t.finished=o,t.destroyed=x,t.blockLen=i,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const cx=(()=>{const e=((t,n,r)=>new $s(t,n).update(r).digest());return e.create=(t,n)=>new $s(t,n),e})();function iu(e,t,n){return br(e),n===void 0&&(n=new Uint8Array(e.outputLen)),cx(e,n,t)}const R0=Uint8Array.of(0),zs=Uint8Array.of();function au(e,t,n,r=32){br(e),or(r,"length"),cn(t,void 0,"prk");const o=e.outputLen;if(t.length<o)throw new Error('"prk" must be at least HashLen octets');if(r>255*o)throw new Error("Length must be <= 255*HashLen");const x=Math.ceil(r/o);n===void 0?n=zs:cn(n,void 0,"info");const i=new Uint8Array(x*o),a=cx.create(e,t),l=a._cloneInto(),d=new Uint8Array(a.outputLen);for(let u=0;u<x;u++)R0[0]=u+1,l.update(u===0?zs:d).update(n).update(R0).digestInto(d),i.set(d,o*u),a._cloneInto(l);return a.destroy(),l.destroy(),dn(d,R0),i.slice(0,r)}const dx=(e,t,n,r,o)=>au(e,iu(e,t,n),r,o);function lu(e,t,n){return e&t^~e&n}function cu(e,t,n){return e&t^e&n^t&n}class du{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,n,r,o){this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=L0(this.buffer)}update(t){t0(this),cn(t);const{view:n,buffer:r,blockLen:o}=this,x=t.length;for(let i=0;i<x;){const a=Math.min(o-this.pos,x-i);if(a===o){const l=L0(t);for(;o<=x-i;i+=o)this.process(l,i);continue}r.set(t.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){t0(this),lx(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:x}=this;let{pos:i}=this;n[i++]=128,dn(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let c=i;c<o;c++)n[c]=0;r.setBigUint64(o-8,BigInt(this.length*8),x),this.process(r,0);const a=L0(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const d=l/4,u=this.get();if(d>u.length)throw new Error("_sha2: outputLen bigger than state");for(let c=0;c<d;c++)a.setUint32(4*c,u[c],x)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||=new this.constructor,t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:x,destroyed:i,pos:a}=this;return t.destroyed=i,t.finished=x,t.length=o,t.pos=a,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const ct=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),uu=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),dt=new Uint32Array(64);class hu extends du{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:n,C:r,D:o,E:x,F:i,G:a,H:l}=this;return[t,n,r,o,x,i,a,l]}set(t,n,r,o,x,i,a,l){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=x|0,this.F=i|0,this.G=a|0,this.H=l|0}process(t,n){for(let c=0;c<16;c++,n+=4)dt[c]=t.getUint32(n,!1);for(let c=16;c<64;c++){const p=dt[c-15],B=dt[c-2],A=Ze(p,7)^Ze(p,18)^p>>>3,k=Ze(B,17)^Ze(B,19)^B>>>10;dt[c]=k+dt[c-7]+A+dt[c-16]|0}let{A:r,B:o,C:x,D:i,E:a,F:l,G:d,H:u}=this;for(let c=0;c<64;c++){const p=Ze(a,6)^Ze(a,11)^Ze(a,25),B=u+p+lu(a,l,d)+uu[c]+dt[c]|0,k=(Ze(r,2)^Ze(r,13)^Ze(r,22))+cu(r,o,x)|0;u=d,d=l,l=a,a=i+B|0,i=x,x=o,o=r,r=B+k|0}r=r+this.A|0,o=o+this.B|0,x=x+this.C|0,i=i+this.D|0,a=a+this.E|0,l=l+this.F|0,d=d+this.G|0,u=u+this.H|0,this.set(r,o,x,i,a,l,d,u)}roundClean(){dn(dt)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),dn(this.buffer)}}class Eu extends hu{A=ct[0]|0;B=ct[1]|0;C=ct[2]|0;D=ct[3]|0;E=ct[4]|0;F=ct[5]|0;G=ct[6]|0;H=ct[7]|0;constructor(){super(32)}}const xr=ou(()=>new Eu,xu(1)),ux=1,Ot=12,fu=new TextEncoder().encode("longleash-relay-v1");function hx(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ex(e){try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/")),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}catch{return null}}async function fx(e,t,n){const r=Ex(e);if(r===null||r.length<16)throw new Error("relay secret is not valid base64url");const o=x=>dx(xr,r,fu,new TextEncoder().encode(x),32);return{roomTag:hx(o(t)),frameKey:o(n)}}async function pu(e){return fx(e,"room-tag","frame-key")}async function mu(e){return fx(e,"pair-room-tag","pair-frame-key")}async function px(e,t){const n=crypto.getRandomValues(new Uint8Array(Ot)),r=ax(e.frameKey,n).encrypt(new TextEncoder().encode(t)),o=new Uint8Array(1+Ot+r.length);return o[0]=ux,o.set(n,1),o.set(r,1+Ot),hx(o)}async function mx(e,t){const n=Ex(t);if(n===null||n.length<1+Ot+16||n[0]!==ux)return null;try{const r=ax(e.frameKey,n.subarray(1,1+Ot)).decrypt(n.subarray(1+Ot));return new TextDecoder().decode(r)}catch{return null}}const vn=1,Cu=6e4,n0=oe(["diagnostics.read","sessions.read","transcripts.read","workspace.open","file.open","claude.dispatch","codex.render","approvals.decide","sessions.message","sessions.stop","sessions.delegate","delegations.return"]),Bu=W({min:ne().int().positive(),max:ne().int().positive()}).strict().refine(e=>e.min<=e.max,"Protocol minimum must not exceed maximum"),gu=W({uri:N().min(1).max(8192),canonicalPath:N().min(1).max(4096).optional()}).strict();W({v:Q(vn),type:Q("ide.hello"),clientInstanceId:N().min(1).max(120),protocol:Bu,extension:W({version:N().min(1).max(80),build:N().min(1).max(120)}).strict(),vscode:W({version:N().min(1).max(80),uriScheme:N().min(1).max(40),remoteAuthority:N().min(1).max(512).nullable(),workspaceTrusted:be(),windowFocused:be(),workspaceFolders:kt(gu).max(64)}).strict(),capabilities:kt(n0).max(n0.options.length).refine(e=>new Set(e).size===e.length,"Capabilities must be unique")}).strict();W({v:Q(vn),type:Q("ide.welcome"),principalId:N().min(1).max(120),selectedProtocol:ne().int().positive(),daemonBuild:N().min(1).max(120),grantedCapabilities:kt(n0).max(n0.options.length).refine(e=>new Set(e).size===e.length,"Capabilities must be unique"),mutationMode:oe(["enabled","read-only"]),reason:oe(["workspace-untrusted","build-mismatch","protocol-incompatible","credential-revoked"]).optional()}).strict();const Au=W({sessionId:N().min(1).max(240),provider:oe(["claude","codex"]),title:N().trim().min(1).max(240),origin:oe(["phone","daemon","terminal","vscode","external"]),status:oe(["running","waiting","ended","errored"]),live:be(),resumable:be(),controller:oe(["longleash","external"]).optional(),attention:oe(["approval","question","error"]).optional(),workspace:W({label:N().trim().min(1).max(240),branch:N().trim().min(1).max(240).optional(),mode:oe(["shared","isolated"])}).strict(),relationship:W({parentSessionId:N().min(1).max(240),role:oe(["investigate","review","implement","test"]),depth:ne().int().min(1).max(16)}).strict().optional(),updatedAt:ne().int().nonnegative()}).strict().superRefine((e,t)=>{e.attention==="error"&&e.status!=="errored"&&t.addIssue({code:T.custom,path:["attention"],message:"Error attention is valid only for an errored session."}),(e.attention==="approval"||e.attention==="question")&&(!e.live||e.status==="ended"||e.status==="errored")&&t.addIssue({code:T.custom,path:["attention"],message:"Approval and question attention require a live non-terminal session."})});W({v:Q(vn),type:Q("ide.sessionInventory"),streamId:N().min(1).max(120),cursor:ne().int().nonnegative(),generatedAt:ne().int().nonnegative(),sessions:kt(Au).max(1e3).refine(e=>new Set(e.map(t=>t.sessionId)).size===e.length,"Inventory session ids must be unique.")}).strict();const Fu=W({verifiedAt:ne().int().nonnegative(),canonicalWorkspace:N().min(1).max(4096)}).strict();W({v:Q(vn),type:Q("ide.openSession"),operationId:N().min(1).max(160),issuedAt:ne().int().nonnegative(),expiresAt:ne().int().positive(),provider:oe(["claude","codex"]),sessionId:N().min(1).max(240),nativeId:N().min(1).max(240),canonicalWorkspace:N().min(1).max(4096),destination:oe(["claude-native","codex-longleash"]),nativeRecord:Fu,ownership:oe(["read-only","ide-reserved"])}).strict().superRefine((e,t)=>{e.expiresAt<=e.issuedAt&&t.addIssue({code:T.custom,path:["expiresAt"],message:"An IDE operation must expire after it is issued."}),e.expiresAt-e.issuedAt>Cu&&t.addIssue({code:T.custom,path:["expiresAt"],message:"An IDE operation must remain short-lived."}),e.provider==="claude"&&e.destination!=="claude-native"&&t.addIssue({code:T.custom,path:["destination"],message:"Claude sessions may only target the official native destination."}),e.provider==="codex"&&e.destination!=="codex-longleash"&&t.addIssue({code:T.custom,path:["destination"],message:"Codex sessions may only target the LongLeash-owned editor."})});const Du=oe(["expired","workspace-untrusted","window-not-focused","editor-scheme-unsupported","workspace-not-open","workspace-mismatch","remote-workspace-unsupported","provider-missing","provider-too-old","provider-contract-unverified","native-session-unverified","ownership-not-reserved","build-mismatch","capability-denied","dispatch-refused","thread-snapshot-missing","thread-snapshot-mismatch","internal"]);W({v:Q(vn),type:Q("ide.openSessionResult"),operationId:N().min(1).max(160),provider:oe(["claude","codex"]),destination:oe(["claude-native","codex-longleash"]),outcome:oe(["blocked","dispatched","opened"]),verification:oe(["none","preflight-only","extension-owned"]),failure:Du.optional(),extensionBuild:N().min(1).max(120),completedAt:ne().int().nonnegative()}).strict().superRefine((e,t)=>{e.outcome==="blocked"&&e.failure===void 0&&t.addIssue({code:T.custom,path:["failure"],message:"A blocked IDE operation requires a machine-readable failure."}),e.outcome!=="blocked"&&e.failure!==void 0&&t.addIssue({code:T.custom,path:["failure"],message:"A successful IDE operation must not carry a failure."}),e.provider==="claude"&&e.outcome==="opened"&&t.addIssue({code:T.custom,path:["outcome"],message:"The public Claude URI cannot prove an exact native conversation opened."}),e.provider==="claude"&&e.destination!=="claude-native"&&t.addIssue({code:T.custom,path:["destination"],message:"Claude results must name the official native destination."}),e.provider==="codex"&&e.destination!=="codex-longleash"&&t.addIssue({code:T.custom,path:["destination"],message:"Codex results must name the LongLeash-owned editor."}),e.outcome==="dispatched"&&e.verification!=="preflight-only"&&t.addIssue({code:T.custom,path:["verification"],message:"A dispatched native-provider request has preflight-only verification."}),e.outcome==="opened"&&e.verification!=="extension-owned"&&t.addIssue({code:T.custom,path:["verification"],message:"Only an extension-owned editor can report a verified open."}),e.outcome==="blocked"&&e.verification!=="none"&&t.addIssue({code:T.custom,path:["verification"],message:"A blocked operation has no open verification."})});const ku=2,st=N().regex(/^[A-Za-z0-9_-]{43}$/),Cx=N().min(1).max(64).refine(e=>e.trim().length>0&&!/[\p{Cc}\p{Cf}]/u.test(e),"Device name must be visible text without control characters"),Bx=W({v:Q(ku),challengeId:N().min(1).max(128),attemptId:st,phoneNonce:st,daemonNonce:st,deviceName:Cx,expiresAt:ne().int().positive().safe()}).strict(),U0=e=>new TextEncoder().encode(e),Ws=e=>Array.from(e,t=>t.toString(16).padStart(2,"0")).join("");function yu(e,t){st.parse(e);const n=Bx.parse(t),r=JSON.stringify(["longleash-pairing-v2",n.v,n.challengeId,n.attemptId,["phone",n.phoneNonce,n.deviceName],["daemon",n.daemonNonce],n.expiresAt]),o=xr(U0(r)),x=a=>dx(xr,U0(e),o,U0(`longleash-pairing-v2/${a}`),32),i=(BigInt(`0x${Ws(x("display-code"))}`)%100000000n).toString().padStart(8,"0");return{code:`${i.slice(0,4)} ${i.slice(4)}`,identity:{roomTag:Ws(x("room-tag")),frameKey:x("frame-key")}}}W({v:Q(2),type:Q("pair-begin"),challengeId:N().min(1).max(128),phoneNonce:st,deviceName:Cx}).strict();W({v:Q(2),type:oe(["pair-confirm","pair-reject","pair-ping"]),attemptId:st}).strict();const vu=kr("type",[W({v:Q(2),type:Q("pair-transcript"),transcript:Bx,remainingMs:ne().int().min(1).max(3e5)}).strict(),W({v:Q(2),type:Q("pair-waiting"),attemptId:st}).strict(),W({v:Q(2),type:Q("paired"),attemptId:st,token:N().regex(/^llt_[A-Za-z0-9_-]{43}$/),relaySecret:st,deviceId:N().min(1).max(128)}).strict(),W({v:Q(2),type:Q("pair-error"),reason:oe(["update-required","invalid-input","expired","competing-attempt","cancelled","disconnected","unavailable"])}).strict()]),wu=8192,we=1,un=oe(["claude","gemini","codex","terminal"]),hn=oe(["phone","daemon","terminal","vscode","external"]),bu=oe(["auto","shared","isolated"]),ju=oe(["low","medium","high","xhigh","max"]),_u=oe(["adaptive","disabled","fixed"]),Su=oe(["manual","auto","plan"]),wt=W({mode:Su.optional(),model:N().trim().min(1).max(120).optional(),effort:ju.optional(),thinking:W({mode:_u,budgetTokens:ne().int().min(1024).max(128e3).optional()}).strict().optional()}).strict().superRefine((e,t)=>{e.thinking?.mode==="fixed"&&e.thinking.budgetTokens===void 0&&t.addIssue({code:T.custom,path:["thinking","budgetTokens"],message:"A fixed thinking mode requires a token budget."}),e.thinking?.mode!=="fixed"&&e.thinking?.budgetTokens!==void 0&&t.addIssue({code:T.custom,path:["thinking","budgetTokens"],message:"A token budget is only valid with fixed thinking."})}),Pu=W({mode:oe(["shared","isolated"]),sourceCwd:N().min(1),branch:N().min(1).optional()}).strict(),gx=oe(["allow","deny"]),Ax=oe(["ask","auto"]),qt=oe(["investigate","review","implement","test"]),f0=oe(["selected","recent","task"]),p0=oe(["claude","codex"]),Iu=oe(["draft","starting","running","ready","returned","cancelled","failed"]),Nu=24e3,Fx=24e3,Mu=2,Tu=W({delegationId:N().min(1),parentSessionId:N().min(1),role:qt,depth:ne().int().min(1).max(16)}).passthrough(),Ou=W({agent:un,cwd:N().min(1),title:N().optional(),origin:hn.optional(),controller:oe(["longleash","external"]).optional(),surface:hn.optional(),control:oe(["full","observe"]).optional(),resumeId:N().optional(),relationship:Tu.optional(),settings:wt.optional(),workspace:Pu.optional()}).passthrough(),Lu=W({status:oe(["running","waiting","errored","ended"]),live:be().optional(),resumable:be().optional(),resumeId:N().optional(),detail:N().optional(),title:N().optional(),permissionMode:N().optional(),gate:Ax.optional(),controller:oe(["longleash","external"]).optional(),surface:hn.optional(),control:oe(["full","observe"]).optional(),settings:wt.optional(),workspaceConflict:W({cwd:N().min(1),ownerSessionId:N().min(1),processPaused:be().optional()}).optional()}).passthrough(),Ru=W({kind:oe(["text","tool","thinking","user"]),text:N()}).passthrough(),Uu=W({reason:oe(["provider-snapshot","recovery"]),blocks:kt(W({kind:oe(["text","tool","thinking","user"]),text:N().max(12e4)}).strict()).max(80).optional()}).passthrough(),$u=W({label:N().min(1),description:N().default(""),preview:N().optional()}).passthrough(),zu=W({question:N().min(1),header:N().default(""),options:kt($u).min(1).max(8),multiSelect:be().default(!1)}).passthrough(),Wu=W({approvalId:N().min(1),toolName:N().min(1),inputSummary:N(),expiresAt:ne().int().positive(),targetPath:N().optional(),outsideRoot:be().optional(),questions:kt(zu).min(1).max(4).optional()}).passthrough(),Vu=W({approvalId:N().min(1),verdict:gx,decidedBy:N().min(1),reply:N().optional(),answers:sx(N()).optional()}).passthrough(),qu=W({toolName:N().min(1),inputSummary:N(),autoApproved:be()}).passthrough(),Hu=W({message:N().min(1)}).passthrough(),Ku=W({reason:N().optional(),resumable:be().optional(),resumeId:N().optional()}).passthrough(),Zu={v:ne().int().positive(),seq:ne().int().positive(),sessionId:N().min(1),ts:ne().int().nonnegative()};function Xe(e,t){return W({...Zu,type:Q(e),payload:t}).passthrough()}kr("type",[Xe("session.started",Ou),Xe("session.status",Lu),Xe("session.transcript.reset",Uu),Xe("stream.delta",Ru),Xe("approval.requested",Wu),Xe("approval.decided",Vu),Xe("activity.tool",qu),Xe("session.errored",Hu),Xe("session.ended",Ku)]);const ve={v:ne().int().positive()},Gu=W({...ve,type:Q("subscribe"),sessionId:N().min(1),fromCursor:ne().int().nonnegative(),syncId:N().min(1).max(120).optional()}).passthrough(),Ju=W({...ve,type:Q("decision"),approvalId:N().min(1),verdict:gx,reply:N().optional(),answers:sx(N()).optional(),response:N().optional()}).passthrough(),Yu=W({...ve,type:Q("sendMessage"),sessionId:N().min(1),text:N().min(1)}).passthrough(),Qu=W({...ve,type:Q("startSession"),agent:un,root:N().min(1),prompt:N().min(1),requestId:N().min(1).max(120).optional(),workspaceMode:bu.default("auto"),settings:wt.optional()}).passthrough(),Xu=W({...ve,type:Q("updateSessionSettings"),requestId:N().min(1).max(120),sessionId:N().min(1),settings:wt,externalTransferConfirmed:be().default(!1)}).passthrough(),e9=W({...ve,type:Q("findFolders"),query:N().max(200)}).passthrough(),t9=W({...ve,type:Q("resumeSession"),sessionId:N().min(1)}).passthrough(),n9=W({...ve,type:Q("stopSession"),sessionId:N().min(1)}).passthrough(),r9=W({endpoint:N().url(),keys:W({p256dh:N().min(1),auth:N().min(1)}).passthrough()}).passthrough(),s9=W({...ve,type:Q("pushSubscribe"),subscription:r9}).passthrough(),o9=W({...ve,type:Q("pushUnsubscribe"),endpoint:N().url()}).passthrough(),x9=W({...ve,type:Q("pushTest")}).passthrough(),i9=W({...ve,type:Q("setGate"),sessionId:N().min(1),gate:Ax}).passthrough(),a9=W({...ve,type:Q("takeOver"),sessionId:N().min(1),text:N().min(1)}).passthrough(),l9=W({...ve,type:Q("reclaimSession"),sessionId:N().min(1)}).passthrough(),c9=W({...ve,type:Q("renameSession"),sessionId:N().min(1),title:N().trim().min(1).max(80).refine(e=>e.replace(/[\u0000-\u001f\u007f]/g,"").trim().length>0,"A session name needs visible text.")}).passthrough(),d9=W({...ve,type:Q("previewDelegation"),requestId:N().min(1).max(120),sourceSessionId:N().min(1),sourceSeq:ne().int().positive().optional(),targetAgent:p0,role:qt,contextScope:f0}).passthrough(),u9=W({...ve,type:Q("startDelegation"),requestId:N().min(1).max(120),idempotencyKey:N().min(1).max(200),sourceSessionId:N().min(1),sourceSeq:ne().int().positive().optional(),targetAgent:p0,role:qt,contextScope:f0,briefing:N().max(Nu).refine(e=>e.trim().length>0,"Briefing must not be empty"),settings:wt.optional(),confirmed:Q(!0),workspaceTransferConfirmed:Q(!0)}).passthrough(),h9=W({...ve,type:Q("prepareReturn"),requestId:N().min(1).max(120),delegationId:N().min(1)}).passthrough(),E9=W({...ve,type:Q("returnDelegation"),requestId:N().min(1).max(120),idempotencyKey:N().min(1).max(200),delegationId:N().min(1),returnText:N().max(Fx).refine(e=>e.trim().length>0,"Return text must not be empty"),confirmed:Q(!0),takeoverConfirmed:be()}).passthrough(),f9=W({delegationId:N().min(1),idempotencyKey:N().min(1).max(200),sourceSessionId:N().min(1),sourceSeq:ne().int().positive().optional(),targetSessionId:N().min(1).optional(),targetAgent:p0,role:qt,contextScope:f0,settings:wt.optional(),depth:ne().int().min(1).max(Mu),status:Iu,failure:N().optional(),returnIdempotencyKey:N().min(1).max(200).optional(),returnedAt:ne().int().nonnegative().optional(),createdAt:ne().int().nonnegative(),updatedAt:ne().int().nonnegative()}).passthrough(),p9=W({v:ne().int().positive(),type:Q("delegation"),requestId:N().min(1).optional(),created:be().optional(),delegation:f9}).passthrough(),m9=W({v:ne().int().positive(),type:Q("delegationPreview"),requestId:N().min(1),source:W({sessionId:N().min(1),agent:un,cwd:N(),title:N(),origin:hn}).passthrough(),sourceSeq:ne().int().positive().optional(),targetAgent:p0,role:qt,contextScope:f0,briefing:N().min(1),context:W({includedFirstSeq:ne().int().positive(),includedLastSeq:ne().int().positive(),includedBlocks:ne().int().positive(),omittedEvents:ne().int().nonnegative(),omittedCharacters:ne().int().nonnegative(),truncated:be(),characterCount:ne().int().positive(),maxCharacters:ne().int().positive()}).passthrough()}).passthrough(),C9=W({v:ne().int().positive(),type:Q("delegationReturnPreview"),requestId:N().min(1),delegationId:N().min(1),parent:W({sessionId:N().min(1),agent:un,title:N(),cwd:N(),origin:hn,live:be()}).passthrough(),child:W({sessionId:N().min(1),agent:un,title:N()}).passthrough(),role:qt,returnText:N().min(1).max(Fx),attribution:N().min(1),requiresTakeover:be(),context:W({includedFirstSeq:ne().int().positive(),includedLastSeq:ne().int().positive(),omittedCharacters:ne().int().nonnegative(),truncated:be(),characterCount:ne().int().positive(),maxCharacters:ne().int().positive()}).passthrough()}).passthrough();kr("type",[Gu,Ju,Yu,Qu,Xu,n9,t9,e9,s9,o9,x9,a9,l9,c9,i9,d9,u9,h9,E9]);async function B9(e){const t=await mu(e.secret),n=btoa(String.fromCharCode(...crypto.getRandomValues(new Uint8Array(32)))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");if(e.signal.aborted)throw new Error("Pairing cancelled. Generate a fresh QR.");const r=await e.socket(t.roomTag);return new Promise((o,x)=>{let i=!1,a=!1,l=!1,d,u,c=null,p=null,B=Promise.resolve(),A=0,k=setTimeout(()=>C(new Error("Laptop did not answer. Update LongLeash on both devices and generate a fresh QR.")),15e3);const C=h=>{i||(i=!0,clearTimeout(k),clearInterval(f),e.signal.removeEventListener("abort",m),r.close(),h instanceof Error?x(h):o(h))},b=async(h,E=p)=>{const w=await px(E??t,JSON.stringify(h));!i&&r.readyState===WebSocket.OPEN&&r.send(JSON.stringify({v:1,type:"frame",payload:w}))},v=h=>{!c||i||b({v:2,type:h,attemptId:c.attemptId}).catch(()=>C(new Error("Pairing connection failed. Generate a fresh QR.")))},F={confirm(){!c||l||i||(l=!0,e.onProgress({state:"waiting",...d?{code:d}:{},expiresAt:u},F),v("pair-confirm"))},reject(){!c||i||b({v:2,type:"pair-reject",attemptId:c.attemptId}).catch(()=>{}).finally(()=>C(new Error("Pairing cancelled. Generate a fresh QR. If both devices were already confirmed, check longleash devices before retrying.")))}},m=()=>C(new Error("Pairing cancelled. Generate a fresh QR."));e.signal.addEventListener("abort",m,{once:!0});const f=setInterval(()=>{p&&v("pair-ping"),e.relay&&r.readyState===WebSocket.OPEN&&r.send(JSON.stringify({v:1,type:"ping"}))},5e3),D=()=>{a||i||(a=!0,b({v:2,type:"pair-begin",challengeId:e.challengeId,phoneNonce:n,deviceName:"Phone browser"},t).catch(()=>C(new Error("Pairing could not start. Generate a fresh QR."))))};r.onopen=()=>{e.relay&&r.send(JSON.stringify({v:1,type:"join",room:t.roomTag,role:"guest"}))},r.onerror=()=>C(new Error("Could not reach your laptop. Generate a fresh QR when the connection returns.")),r.onclose=()=>C(new Error(l?"Connection ended before pairing was saved. Check longleash devices on your laptop; revoke any incomplete pairing before trying again.":"Pairing connection ended. Keep both devices open and generate a fresh QR.")),r.onmessage=h=>{if(!i){if(String(h.data).length>wu+200||A>=8){C(new Error("Invalid pairing response. Generate a fresh QR."));return}A++,B=B.then(async()=>{if(i)return;let E;try{E=JSON.parse(String(h.data))}catch{return}if(E.type==="pair-ready"&&E.v===2&&!e.relay&&D(),e.relay&&(E.type==="joined"&&E.host||E.type==="peer"&&E.role==="host"&&E.event==="joined")&&D(),E.type==="peer"&&E.role==="host"&&E.event==="left"){r.onclose?.(new Event("close"));return}if(E.type!=="frame"||typeof E.payload!="string")return;const w=await mx(p??t,E.payload);if(i||w===null)return;const P=vu.safeParse(JSON.parse(w));if(!P.success)throw new Error("Unsupported pairing response. Update both devices and generate a fresh QR.");const I=P.data;if(I.type==="pair-error")throw new Error(`Pairing ended (${I.reason}). Generate a fresh QR; update both devices if their versions differ.`);if(I.type==="pair-transcript"&&!c){const j=I.transcript;if(j.challengeId!==e.challengeId||j.phoneNonce!==n||j.deviceName!=="Phone browser")throw new Error("Pairing verification did not match this phone. Generate a fresh QR.");c=j;const y=yu(e.secret,j);p=y.identity,d=y.code,u=Date.now()+I.remainingMs,clearTimeout(k),k=setTimeout(()=>C(new Error("Pairing expired. Generate a fresh QR.")),I.remainingMs),e.onProgress({state:"compare",code:y.code,expiresAt:u},F)}else if(I.type==="paired"){if(!l||!c||I.attemptId!==c.attemptId)throw new Error("Unconfirmed pairing response rejected.");C({token:I.token,relaySecret:I.relaySecret,deviceId:I.deviceId})}}).catch(E=>C(E instanceof Error?E:new Error("Pairing failed."))).finally(()=>{A--})}},e.onProgress({state:"connecting"},F),e.signal.aborted&&m()})}let r0=null,yt=!1;function ut(e,t=!1){r0=e,yt=e!==null&&t}async function jr(e,t={}){if(!r0)throw new Error("Sign-in is required.");const n=await r0();if(!n)throw new Error("Sign-in expired.");return fetch(e,{...t,cache:"no-store",credentials:"omit",signal:AbortSignal.timeout(1e4),headers:{Authorization:`Bearer ${n}`,...t.body?{"Content-Type":"application/json"}:{}}})}async function g9(){const e=await jr("/api/measurement/consent");if(!e.ok)throw new Error("Measurement preference is unavailable.");return yt=(await e.json()).enabled===!0,yt}async function Vs(e){const t=await jr("/api/measurement/consent",{method:"PUT",body:JSON.stringify({enabled:e})});if(!t.ok)throw new Error(e?"Could not save opt-in. Nothing was collected.":"Could not confirm deletion. Please retry.");return yt=(await t.json()).enabled===!0,yt}function He(e,t){if(!yt||!r0)return;const n={id:crypto.randomUUID(),type:e,outcome:t,occurredAt:Date.now(),build:"618e867"};jr("/api/measurement/events",{method:"POST",body:JSON.stringify(n)}).then(r=>{r.status===403&&(yt=!1)}).catch(()=>{})}const m0="longleash.token",C0="longleash.relaySecret",wn="longleash.relayUrl",A9="longleash-v1";let s0=null,ir=null;function Jt(e){s0=e}function Yt(e){ir=e}function Lt(e,t=s0){return t===null?e:`${e}.account.${encodeURIComponent(t)}`}function _r(e){return localStorage.getItem(Lt(e))}function Rn(e,t){localStorage.setItem(Lt(e),t)}function $0(e){localStorage.removeItem(Lt(e))}const Dx=4e3,F9=8e3,D9=15e3,k9=3e4;function y9(){return _r(m0)}function qs(){return _r(C0)}function ar(){return _r(wn)}async function kx(){try{const e=await fetch("/health",{cache:"no-store"});if(!e.ok)return"unknown";const t=await e.json();return t.role==="relay"?"relay":t.name==="longleash"?"daemon":"unknown"}catch{return"unknown"}}function yx(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/ws`}function v9(e,t){const n=new URL(e);return n.searchParams.set("room",t),n.toString()}function w9(e,t,n){const r=new URL(v9(e,t));return r.searchParams.set("role",n),r.toString()}function b9(e){const t=new URL(e);return t.protocol=t.protocol==="wss:"?"https:":"http:",t.pathname="/api/relay-ticket",t.search="",t.hash="",t.toString()}async function j9(e,t){if(ir===null)return;const n=await ir();if(n===null)throw new Error("Your LongLeash sign-in expired. Sign in again, then retry.");const r=await fetch(b9(e),{method:"POST",cache:"no-store",credentials:"omit",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json"},body:JSON.stringify({room:t,role:"guest"})});if(!r.ok)throw r.status===401?new Error("Your LongLeash sign-in expired. Sign in again, then retry."):r.status===429?new Error("Too many reconnects. Wait one minute, then retry."):new Error("The hosted relay could not authorize this connection.");const o=await r.json();if(typeof o.protocol!="string"||!o.protocol.startsWith("ll-ticket."))throw new Error("The hosted relay returned an invalid connection ticket.");return[A9,o.protocol]}async function vx(e,t){const n=await j9(e,t),r=w9(e,t,"guest");return n===void 0?new WebSocket(r):new WebSocket(r,n)}async function _9(e,t,n){if(n.version!==2)throw new Error("This QR uses an older pairing protocol. Update LongLeash on your laptop, restart it, then run longleash pair for a new QR.");const r=s0,o=await kx();if(o==="unknown")throw new Error("Cannot reach LongLeash. Check your connection and try a fresh QR.");const x=o==="relay";if(!x&&(await(await fetch("/health",{cache:"no-store",signal:n.signal})).json()).pairingVersion!==2)throw new Error("Update and restart the laptop daemon: verified pairing requires protocol v2.");const i=x?yx():"",a=await B9({challengeId:e,secret:t,relay:x,signal:n.signal,onProgress:n.onProgress,socket:async l=>x?vx(i,l):new WebSocket(`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/pair/v2?c=${encodeURIComponent(e)}`)});if(n.signal.aborted||s0!==r)throw new Error("Account changed during pairing. Revoke the incomplete device on your laptop, then pair again.");try{Rn(C0,a.relaySecret),x&&Rn(wn,i),Rn(m0,a.token)}catch{throw wx(),new Error("This browser could not save pairing. Allow browser storage, revoke the incomplete device with longleash devices/revoke, then pair again.")}return He("paired","success"),a.token}function wx(){$0(m0),$0(C0),$0(wn)}function S9(e){localStorage.removeItem(Lt(m0,e)),localStorage.removeItem(Lt(C0,e)),localStorage.removeItem(Lt(wn,e))}async function P9(){try{const e=await fetch("/health",{cache:"no-store"});return e.ok?{reachable:!0,detail:"Laptop is reachable."}:{reachable:!1,detail:`Laptop answered with ${e.status}.`}}catch{return{reachable:!1,detail:ar()?"Your laptop is not on this network — reaching it through the relay instead.":"Cannot reach your laptop. Check you are on the same network, and turn off any VPN — a full-tunnel VPN blocks phone-to-laptop traffic entirely."}}}function I9(e,t){const n=location.protocol==="https:"?"wss:":"ws:",r=new WebSocket(`${n}//${location.host}/ws?token=${encodeURIComponent(e)}`);let o=!1;const x=setTimeout(()=>{o||r.close()},Dx);return r.onopen=()=>{o=!0,clearTimeout(x),t.onReady()},r.onmessage=i=>t.onText(String(i.data)),r.onclose=i=>{clearTimeout(x),i.code===4401?t.onDown("auth"):i.code===4403?t.onDown("revoked"):t.onDown("net")},{send:i=>r.readyState!==WebSocket.OPEN?!1:(r.send(i),!0),close:()=>{r.onclose=null,r.close()}}}async function N9(e,t,n){const r=await vx(e,t.roomTag);let o=!1,x=Promise.resolve(),i=Promise.resolve(),a=null;const l=()=>{a!==null&&clearInterval(a),a=null},d=()=>{l(),a=setInterval(()=>{r.readyState===WebSocket.OPEN&&r.send(JSON.stringify({v:1,type:"ping"}))},k9)},u=setTimeout(()=>{o||r.close()},Dx);let c=null;return r.onopen=()=>{r.send(JSON.stringify({v:1,type:"join",room:t.roomTag,role:"guest"}))},r.onmessage=p=>{let B;try{B=JSON.parse(String(p.data))}catch{return}if(B.type==="joined"){clearTimeout(u),B.host===!0?(o=!0,d(),n.onReady()):c=setTimeout(()=>r.close(),F9);return}if(B.type==="peer"&&B.role==="host"){B.event==="joined"&&!o&&(c&&clearTimeout(c),o=!0,d(),n.onReady()),B.event==="left"&&r.close();return}if(B.type==="frame"&&typeof B.payload=="string"){const A=B.payload;x=x.then(async()=>{const k=await mx(t,A);k!==null&&n.onText(k)}).catch(()=>{})}},r.onclose=()=>{clearTimeout(u),c&&clearTimeout(c),l(),n.onDown("net")},{send:p=>!o||r.readyState!==WebSocket.OPEN?!1:(i=i.then(async()=>{const B=await px(t,p);r.readyState===WebSocket.OPEN&&r.send(JSON.stringify({v:1,type:"frame",payload:B}))}).catch(()=>{}),!0),close:()=>{r.onclose=null,l(),r.close()}}}function M9(e,t,n){let r=!1,o=null,x=0,i=null,a="lan",l=!1;const d=new Set,u=new Set,c=new Map;let p=0,B=null,A=null,k=null;const C=()=>{k!==null&&clearInterval(k),k=null},b=()=>{C(),k=setInterval(()=>{(async()=>{try{const y=new AbortController,_=setTimeout(()=>y.abort(),3e3),L=await fetch("/health",{cache:"no-store",signal:y.signal});if(clearTimeout(_),!L.ok)return}catch{return}C();const j=o;o=null,j?.close(),a="lan",n.onState("reconnecting"),I()})()},D9)},v=j=>o?.send(JSON.stringify(j))??!1,F=j=>{if(j!==p)return;B!==null&&clearTimeout(B),B=null,c.clear(),t.endHydration();const y=j;setTimeout(()=>{y===p&&n.onHydration?.(!1)},0)},m=(j,y)=>{d.add(j),v({v:we,type:"subscribe",sessionId:j,fromCursor:t.cursors()[j]??0,...y===void 0?{}:{syncId:y}})},f=j=>{const y=`sync-${p}-${j}-${Math.random().toString(36).slice(2,8)}`;c.set(j,y),m(j,y)},h={onReady:()=>{x=0,n.onState("connected"),n.onPath?.(a),a==="relay"&&!l?b():C();for(const j of d)m(j)},onText:j=>{const y=JSON.parse(j);if(y.type==="gap"){t.applyGap(String(y.sessionId)),c.has(String(y.sessionId))?f(String(y.sessionId)):m(String(y.sessionId));return}if(y.type==="sync.complete"&&typeof y.sessionId=="string"&&typeof y.syncId=="string"&&c.get(y.sessionId)===y.syncId){c.delete(y.sessionId),c.size===0&&F(p);return}if(y.type==="ack"&&y.of==="startSession"&&typeof y.sessionId=="string"){m(y.sessionId),n.onSessionStarted?.(typeof y.requestId=="string"?y.requestId:void 0,y.sessionId);return}if(y.type==="ack"&&y.of==="decision"&&He("approval",y.outcome==="decided"?"success":y.outcome==="unknown"?"unknown":"failure"),y.type==="ack"&&y.of==="sendMessage"&&He("reply",y.outcome==="sent"?"success":"failure"),y.type==="ack"&&y.of==="takeOver"&&He("handoff",y.outcome==="taken-over"?"success":"failure"),y.type==="ack"&&y.of==="reclaimSession"&&He("handoff",y.outcome==="phone-ready"?"success":"failure"),y.type==="ack"&&y.of==="stopSession"&&typeof y.sessionId=="string"&&(y.outcome==="stopped"||y.outcome==="not-running")){t.settleSession(y.sessionId),He("stop","success");return}if(y.type==="ack"&&y.of==="stopSession"&&He("stop","failure"),y.type==="ack"&&y.of==="updateSessionSettings"&&typeof y.requestId=="string"&&typeof y.sessionId=="string"&&(y.outcome==="next-response"||y.outcome==="next-continuation")){n.onSessionSettingsUpdated?.(y.requestId,y.sessionId,y.outcome),He("tuning","success");return}if(y.type==="hello"){const _=y;_.relay?.url&&Rn(wn,_.relay.url),p+=1;const L=p;c.clear(),t.beginHydration(),n.onHydration?.(!0),t.seedSessions(_.sessions??[]);for(const K of _.sessions??[])f(K.sessionId);(_.sessions??[]).length===0?F(L):(B!==null&&clearTimeout(B),B=setTimeout(()=>F(L),1500)),n.onHello(_);return}if(y.type==="folders"){n.onFolders(String(y.query??""),y.results??[]);return}if(y.type==="delegationPreview"){const _=m9.safeParse(y);_.success?n.onDelegationPreview?.(_.data):n.onError("The laptop returned an invalid delegation preview.");return}if(y.type==="delegationReturnPreview"){const _=C9.safeParse(y);_.success?n.onDelegationReturnPreview?.(_.data):n.onError("The laptop returned an invalid delegation return preview.");return}if(y.type==="delegation"){const _=p9.safeParse(y);_.success?(_.data.requestId&&u.delete(_.data.requestId)&&He("delegation",_.data.created===!0&&_.data.delegation.targetSessionId?"success":_.data.delegation.status==="failed"||_.data.delegation.status==="cancelled"?"failure":"unknown"),n.onDelegationUpdate?.(_.data.delegation,_.data.requestId,_.data.created)):n.onError("The laptop returned invalid delegation state.");return}if(y.type==="error"){const _=String(y.message??y.code??"Something went wrong");y.of==="startSession"?n.onSessionStartError?.(typeof y.requestId=="string"?y.requestId:void 0,_):y.of==="updateSessionSettings"&&typeof y.requestId=="string"?(He("tuning","failure"),n.onSessionSettingsError?.(y.requestId,_)):typeof y.requestId=="string"&&n.onDelegationError?(u.delete(y.requestId)&&He("delegation","failure"),n.onDelegationError(y.requestId,_)):n.onError(_);return}if(y.type==="ack"&&y.outcome==="unknown"){n.onError("That approval is no longer waiting — it may have expired.");return}typeof y.seq=="number"&&t.apply(y)},onDown:j=>{if(r)return;if(F(p),C(),o=null,j==="auth"){n.onState("unauthorized");return}if(j==="revoked"){n.onState("revoked");return}n.onState("reconnecting");const y=qs()!==null&&ar()!==null;if(!l&&a==="lan"&&y){a="relay",I();return}a=l?"relay":"lan";const _=Math.min(1e3*2**x,15e3);x+=1,i=setTimeout(()=>{I()},_)}},E=()=>{r||o!==null||(i!==null&&(clearTimeout(i),i=null),x=0,I())},w=()=>E(),P=()=>{document.visibilityState==="visible"&&E()};window.addEventListener("online",w),document.addEventListener("visibilitychange",P);const I=async()=>{if(!r){if(a==="relay"){const j=qs(),y=l?yx():ar();if(j!==null&&y!==null)try{A??=await pu(j),o=await N9(y,A,h);return}catch{}a="lan"}o=I9(e,h)}};return n.onState("connecting"),(async()=>(l=await kx()==="relay",l&&(a="relay"),I()))(),{subscribe:m,startSession:(j,y,_="claude",L={})=>{const K=v({v:we,type:"startSession",agent:_,root:j,prompt:y,workspaceMode:L.workspaceMode??"auto",...L.requestId===void 0?{}:{requestId:L.requestId},...L.settings===void 0?{}:{settings:L.settings}});return K||n.onError("Not connected to your laptop — the task was not sent."),K},stopSession:j=>v({v:we,type:"stopSession",sessionId:j}),findFolders:j=>v({v:we,type:"findFolders",query:j}),resumeSession:j=>{const y=v({v:we,type:"resumeSession",sessionId:j});return y||n.onError("Not connected to your laptop."),y},sendMessage:(j,y)=>{const _=v({v:we,type:"sendMessage",sessionId:j,text:y});return _||n.onError("Not connected to your laptop — the message was not sent."),_},pushSubscribe:j=>v({v:we,type:"pushSubscribe",subscription:j}),pushTest:()=>v({v:we,type:"pushTest"}),setGate:(j,y)=>v({v:we,type:"setGate",sessionId:j,gate:y}),takeOver:(j,y)=>v({v:we,type:"takeOver",sessionId:j,text:y}),reclaimSession:j=>{const y=v({v:we,type:"reclaimSession",sessionId:j});return y||n.onError("Not connected to your laptop — control stayed in the terminal."),y},renameSession:(j,y)=>{const _=v({v:we,type:"renameSession",sessionId:j,title:y});return _||n.onError("Not connected to your laptop — the session name was not changed."),_},previewDelegation:j=>{const y=v({v:we,type:"previewDelegation",...j});if(!y){const _="Not connected to your laptop — the briefing was not built.";n.onDelegationError?n.onDelegationError(j.requestId,_):n.onError(_)}return y},startDelegation:j=>{const y=v({v:we,type:"startDelegation",...j,confirmed:!0,workspaceTransferConfirmed:!0});if(y)u.add(j.requestId);else{const _="Not connected to your laptop — no child session was started.";n.onDelegationError?n.onDelegationError(j.requestId,_):n.onError(_)}return y},updateSessionSettings:j=>{const y=v({v:we,type:"updateSessionSettings",...j});return y||n.onSessionSettingsError?.(j.requestId,"Not connected to your laptop — settings were not changed."),y},prepareReturn:j=>{const y=v({v:we,type:"prepareReturn",...j});if(!y){const _="Not connected to your laptop — the return was not prepared.";n.onDelegationError?n.onDelegationError(j.requestId,_):n.onError(_)}return y},returnDelegation:j=>{const y=v({v:we,type:"returnDelegation",...j,confirmed:!0});if(!y){const _="Not connected to your laptop — the reviewed return was not delivered.";n.onDelegationError?n.onDelegationError(j.requestId,_):n.onError(_)}return y},decide:(j,y,_,L)=>v({v:we,type:"decision",approvalId:j,verdict:y,..._?{reply:_}:{},...L?{answers:L}:{}}),close:()=>{r=!0,C(),i!==null&&clearTimeout(i),B!==null&&clearTimeout(B),t.endHydration(),window.removeEventListener("online",w),document.removeEventListener("visibilitychange",P),o?.close()}}}const T9={phone:"from your phone",daemon:"from the laptop",terminal:"in a terminal",vscode:"in VS Code",external:"outside LongLeash",unknown:"origin unknown"},tn={claude:"Claude",codex:"Codex",gemini:"Gemini",terminal:"Terminal"},bx={running:"working",waiting:"waiting for you",ended:"finished",errored:"failed"};function Sr(e){const t=e.split("/").filter(Boolean);return t.length<=2?e:`…/${t.slice(-2).join("/")}`}function z0(e){return e.split("/").filter(Boolean).slice(-1)[0]??e}function O9(e){return e.split("/").slice(0,-1).join("/")}const L9={Read:xc,Write:Sn,Edit:Sn,MultiEdit:Sn,NotebookEdit:Sn,Bash:H0,BashOutput:H0,KillShell:Zo,Glob:sc,Grep:fn,WebFetch:gs,WebSearch:gs,TodoWrite:gc};function jx(e){return L9[e]??uo}function R9(e){const t=e.indexOf(": ");if(t===-1)return{name:e.trim(),detail:""};const n=e.slice(t+2).trim();return{name:e.slice(0,t).trim(),detail:n.startsWith("/")&&!n.includes(" ")?Sr(n):n}}const U9={default:"asks first",acceptEdits:"auto-accepts edits",bypassPermissions:"auto-approves everything",plan:"planning only"};function _x({approval:e,context:t,onDecide:n,onOpen:r}){const[o,x]=g.useState(""),[i,a]=g.useState(!1),l=e.outsideRoot?Vn:jx(e.toolName);return s.jsxs(ke.article,{layout:!0,className:`approval${e.outsideRoot?" outside":""}`,initial:{opacity:0,y:18,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,scale:.98,transition:We},transition:ze,children:[s.jsxs("div",{className:"head",children:[s.jsx("span",{className:"sigil",children:s.jsx(l,{size:17,strokeWidth:2,"aria-hidden":"true"})}),s.jsxs("div",{className:"headtext",children:[s.jsxs("h3",{children:["Claude wants to run ",s.jsx("strong",{children:e.toolName})]}),s.jsx("p",{className:"who",children:t??"Nothing happens until you answer."})]})]}),s.jsx("code",{className:"arg",children:s.jsx(Hs,{text:e.inputSummary})}),e.outsideRoot?s.jsxs("p",{className:"breach",children:[s.jsx(Vn,{size:16,strokeWidth:2.1,"aria-hidden":"true"}),s.jsxs("span",{children:["Outside your project folder —"," ",s.jsx("span",{className:"mono",children:s.jsx(Hs,{text:e.targetPath??""})})]})]}):null,s.jsxs("div",{className:"verdict",children:[s.jsxs(te,{className:"deny",onClick:()=>n(e,"deny",o||void 0),children:[s.jsx(Zo,{size:17,strokeWidth:2.2,"aria-hidden":"true"}),"Deny"]}),s.jsxs(te,{className:"allow",onClick:()=>n(e,"allow"),children:[s.jsx(Ke,{size:18,strokeWidth:2.6,"aria-hidden":"true"}),"Approve"]})]}),i?s.jsx(ke.input,{className:"field note",value:o,onChange:d=>x(d.target.value),placeholder:"Tell Claude what to do instead…","aria-label":"Note to send with your denial",autoFocus:!0,initial:{opacity:0,height:0},animate:{opacity:1,height:48},transition:ze}):s.jsxs("div",{className:"approvalfoot",children:[s.jsxs("button",{type:"button",className:"tap quiet",onClick:()=>a(!0),children:[s.jsx(Yo,{size:14,strokeWidth:2.6,"aria-hidden":"true"}),"Add a note"]}),r?s.jsxs("button",{type:"button",className:"tap",onClick:r,children:["Open session",s.jsx(pr,{size:14,strokeWidth:2.3,"aria-hidden":"true"})]}):null]})]})}function Hs({text:e}){const t=e.split("/");return s.jsx(s.Fragment,{children:t.map((n,r)=>s.jsxs(g.Fragment,{children:[r>0?"/":"",r>0?s.jsx("wbr",{}):null,n]},r))})}function Sx({approval:e,questions:t,context:n,onAnswer:r,onLeave:o}){const[x,i]=g.useState({}),[a,l]=g.useState(!1),[d,u]=g.useState(""),c=(C,b)=>{i(v=>{const F=v[C.question]??[];if(!C.multiSelect)return{...v,[C.question]:F[0]===b?[]:[b]};const m=F.includes(b)?F.filter(f=>f!==b):[...F,b];return{...v,[C.question]:m}})},p=t.filter(C=>(x[C.question]??[]).length>0).length,B=p===t.length,A=B||d.trim()!=="",k=()=>{const C={};for(const b of t){const v=x[b.question]??[];v.length>0&&(C[b.question]=v.join(", "))}r(e,C,d.trim()===""?void 0:d.trim())};return s.jsxs(ke.article,{layout:!0,className:"question",initial:{opacity:0,y:18,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,scale:.98,transition:We},transition:ze,children:[s.jsxs("div",{className:"head",children:[s.jsx("span",{className:"sigil",children:s.jsx(wc,{size:17,strokeWidth:2,"aria-hidden":"true"})}),s.jsxs("div",{className:"headtext",children:[s.jsx("h3",{children:"Claude is asking"}),s.jsx("p",{className:"who",children:n??"Nothing happens until you answer."})]}),t.length>1?s.jsxs("span",{className:"progress","aria-hidden":"true",children:[p,"/",t.length]}):null]}),t.map(C=>{const b=x[C.question]??[];return s.jsxs("div",{className:"qblock",children:[C.header?s.jsx("span",{className:"qchip",children:C.header}):null,s.jsx("p",{className:"qtext",children:C.question}),C.multiSelect?s.jsx("p",{className:"qhint",children:"Choose any that apply"}):null,s.jsx("div",{className:"qoptions",children:C.options.map(v=>{const F=b.includes(v.label);return s.jsxs(te,{className:`qoption${F?" on":""}`,onClick:()=>c(C,v.label),children:[s.jsx("span",{className:"qtick","aria-hidden":"true",children:F?s.jsx(Ke,{size:13,strokeWidth:3}):null}),s.jsxs("span",{className:"qbody",children:[s.jsx("span",{className:"qlabel",children:v.label}),v.description?s.jsx("span",{className:"qdesc",children:v.description}):null,v.preview&&F?s.jsx("span",{className:"qpreview",children:v.preview}):null]})]},v.label)})})]},C.question)}),a?s.jsx(ke.textarea,{className:"field note",value:d,onChange:C=>u(C.target.value),placeholder:"Say it in your own words…","aria-label":"Answer in your own words",autoFocus:!0,initial:{opacity:0,height:0},animate:{opacity:1,height:76},transition:ze}):null,s.jsx("div",{className:"qacts",children:s.jsx(te,{className:"primary",disabled:!A,onClick:k,children:B||d.trim()!==""?"Send answer":"Pick an option"})}),s.jsxs("div",{className:"approvalfoot",children:[a?s.jsx("span",{className:"small dim",children:"Your words are sent with any options you picked."}):s.jsxs("button",{type:"button",className:"tap quiet",onClick:()=>l(!0),children:[s.jsx(jc,{size:14,strokeWidth:2.3,"aria-hidden":"true"}),"Answer in my own words"]}),s.jsx("button",{type:"button",className:"tap quiet",onClick:()=>o(e),children:"Leave for the terminal"})]})]})}function En(e={},t,n="claude"){const r=e.model??"",o=t?.[n].models??Ix(n);return{mode:e.mode??"manual",model:r===""||o.includes(r)?r:"__custom__",customModel:r!==""&&!o.includes(r)?r:"",effort:e.effort??"",thinking:n==="claude"?e.thinking?.mode??"":"",thinkingBudget:e.thinking?.mode==="fixed"?String(e.thinking.budgetTokens??1e4):"10000"}}function o0(e,t){const n=e.model==="__custom__"?e.customModel.trim():e.model;if(e.model==="__custom__"&&n==="")return{settings:{},error:"Enter the provider model ID."};const r=Number(e.thinkingBudget);return t==="claude"&&e.thinking==="fixed"&&(!Number.isInteger(r)||r<1024||r>128e3)?{settings:{},error:"Thinking tokens must be a whole number from 1,024 to 128,000."}:{settings:{mode:e.mode,...n===""?{}:{model:n},...e.effort===""?{}:{effort:e.effort},...t!=="claude"||e.thinking===""?{}:{thinking:e.thinking==="fixed"?{mode:"fixed",budgetTokens:r}:{mode:e.thinking}}}}}function Pr({agent:e,value:t,onChange:n,catalog:r,disabled:o=!1,showMode:x=!0}){const i=d=>n({...t,...d}),a=r?.[e].models??Ix(e),l=r?.[e].efforts??["low","medium","high","xhigh","max"];return s.jsxs("div",{className:"settingsgrid",children:[x?s.jsx(Px,{agent:e,value:t.mode,onChange:d=>i({mode:d}),disabled:o,compact:!0}):null,s.jsxs("label",{children:[s.jsx("span",{children:"Model"}),s.jsxs("select",{value:t.model,disabled:o,onChange:d=>i({model:d.target.value}),children:[s.jsx("option",{value:"",children:"Provider default"}),a.map(d=>s.jsx("option",{value:d,children:d},d)),s.jsx("option",{value:"__custom__",children:"Custom model ID…"})]})]}),t.model==="__custom__"?s.jsxs("label",{children:[s.jsx("span",{children:"Custom model ID"}),s.jsx("input",{type:"text",value:t.customModel,disabled:o,onChange:d=>i({customModel:d.target.value}),placeholder:e==="claude"?"provider model alias":"model id",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1})]}):null,s.jsxs("label",{children:[s.jsx("span",{children:"Effort"}),s.jsxs("select",{value:t.effort,disabled:o,onChange:d=>i({effort:d.target.value}),children:[s.jsx("option",{value:"",children:"Provider default"}),l.map(d=>s.jsx("option",{value:d,children:d},d))]})]}),e==="claude"?s.jsxs("label",{children:[s.jsx("span",{children:"Thinking"}),s.jsxs("select",{value:t.thinking,disabled:o,onChange:d=>i({thinking:d.target.value}),children:[s.jsx("option",{value:"",children:"Provider default"}),s.jsx("option",{value:"adaptive",children:"Adaptive"}),s.jsx("option",{value:"disabled",children:"Off"}),s.jsx("option",{value:"fixed",children:"Fixed budget"})]})]}):null,e==="claude"&&t.thinking==="fixed"?s.jsxs("label",{children:[s.jsx("span",{children:"Thinking tokens"}),s.jsx("input",{type:"number",min:1024,max:128e3,step:1024,inputMode:"numeric",value:t.thinkingBudget,disabled:o,onChange:d=>i({thinkingBudget:d.target.value})})]}):null]})}const lr={manual:{name:"Manual",detail:"Ask before commands and edits."},auto:{name:"Auto"},plan:{name:"Plan",detail:"Read and reason only; make no workspace changes."}};function $9(e,t){return e==="auto"?t==="claude"?"Claude reviews routine permissions; unrestricted access stays off.":"Work inside the workspace sandbox; ask before leaving it.":e==="manual"?lr.manual.detail:lr.plan.detail}function Px({agent:e,value:t,onChange:n,disabled:r=!1,compact:o=!1}){return s.jsxs("fieldset",{className:`modepick${o?" compact":""}`,children:[s.jsx("legend",{children:o?"Working mode":`How ${e==="claude"?"Claude":"Codex"} should work`}),s.jsx("div",{className:"modeoptions",children:["manual","auto","plan"].map(x=>s.jsxs("button",{type:"button",className:`modeoption${t===x?" picked":""}`,"aria-pressed":t===x,disabled:r,onClick:()=>n(x),children:[s.jsx("strong",{children:lr[x].name}),s.jsx("small",{children:$9(x,e)})]},x))}),s.jsx("small",{className:"mode-safety",children:"Auto keeps provider safety controls on. It never enables unrestricted access."})]})}function Ix(e){return e==="claude"?["sonnet","opus","haiku"]:["gpt-5.6","gpt-5.4","gpt-5.3-codex"]}function z9({className:e}){return s.jsx("svg",{className:e,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:s.jsx("path",{fill:"currentColor",d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"})})}function Nx({className:e}){return s.jsx("svg",{className:e,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:s.jsx("path",{fill:"currentColor",d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654 2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})})}function W9({className:e}){return s.jsx("svg",{className:e,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:s.jsx("path",{fill:"currentColor",d:"M23.15 2.587 18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352Zm-5.146 14.861L10.826 12l7.178-5.448v10.896Z"})})}function V9({className:e}){return s.jsx("svg",{className:e,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:s.jsx("path",{d:"m3.75 6.6 5.15 5.4-5.15 5.4M11.7 17.4h8.55",fill:"none",stroke:"currentColor",strokeWidth:"2.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function q9({className:e}){return s.jsxs("svg",{className:e,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[s.jsx("rect",{x:"6.7",y:"1.6",width:"10.6",height:"20.8",rx:"2.7",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),s.jsx("path",{d:"M9.8 4.4h4.4M10.2 16.4a2.55 2.55 0 0 1 3.6 0m-2.25 2.05a.64.64 0 1 0 .9 0",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"})]})}function cr({className:e}){return s.jsxs("svg",{className:e,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[s.jsx("rect",{x:"4.1",y:"4",width:"15.8",height:"11.8",rx:"1.7",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),s.jsx("path",{d:"M2.5 18.5h19l-1.25 1.5H3.75Z",fill:"none",stroke:"currentColor",strokeWidth:"1.55",strokeLinejoin:"round"})]})}const H9={claude:z9,codex:Nx},K9={terminal:V9,vscode:W9,phone:q9,daemon:cr,external:cr};function $t({agent:e,decorative:t=!1}){const n=H9[e]??Nx,r=tn[e]??e;return s.jsx("span",{className:"identitymark providermark","data-agent":e,...t?{"aria-hidden":!0}:{role:"img","aria-label":r,title:r},children:s.jsx(n,{className:"identityglyph"})})}function nn({origin:e}){const t=K9[e]??cr,n=T9[e]??e;return s.jsx("span",{className:"identitymark surfacemark","data-origin":e,role:"img","aria-label":n,title:n,children:s.jsx(t,{className:"identityglyph"})})}function Z9(){return s.jsxs("div",{className:"identitylegend","aria-label":"Session icon legend",children:[s.jsxs("span",{children:[s.jsx($t,{agent:"claude"})," Claude"]}),s.jsxs("span",{children:[s.jsx($t,{agent:"codex"})," Codex"]}),s.jsxs("span",{children:[s.jsx(nn,{origin:"terminal"})," Terminal"]}),s.jsxs("span",{children:[s.jsx(nn,{origin:"vscode"})," VS Code"]}),s.jsxs("span",{children:[s.jsx(nn,{origin:"phone"})," Phone"]})]})}const Mt={claude:"Claude",codex:"Codex"},G9={claude:"Anthropic agent",codex:"OpenAI agent"};function St({number:e,children:t}){return s.jsxs("div",{className:"step-label",children:[s.jsx("span",{className:"step-number","aria-hidden":"true",children:e}),s.jsx("span",{children:t})]})}function W0({agent:e,onPick:t}){return s.jsx("div",{className:"agentpick",role:"group","aria-label":"Which agent",children:["claude","codex"].map(n=>{const r=e===n;return s.jsxs(te,{className:`agentoption${r?" picked":""}`,pressed:r,label:`Use ${Mt[n]}`,onClick:()=>t(n),children:[s.jsx($t,{agent:n,decorative:!0}),s.jsxs("span",{className:"agentcopy",children:[s.jsx("strong",{children:Mt[n]}),s.jsx("small",{children:G9[n]})]}),s.jsx(Ke,{className:"agentcheck",size:17,strokeWidth:2.7,"aria-hidden":"true"})]},n)})})}function J9({open:e,roots:t,folders:n,connected:r,settingsCatalog:o,starting:x=!1,startError:i,onSearch:a,onStart:l,onClose:d}){const u=zt(e),c=Wt(e);return s.jsx(xt,{children:e?s.jsxs(s.Fragment,{children:[s.jsx(ke.div,{className:"scrim",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,transition:We},onClick:d}),s.jsxs(ke.div,{className:"sheet",style:{...u>0?{bottom:u}:{},...c===null?{}:{maxHeight:`${Math.max(180,c-8)}px`}},role:"dialog","aria-modal":"true","aria-label":"Start a new session",initial:{y:"100%"},animate:{y:0},exit:{y:"100%",transition:We},transition:ze,children:[s.jsxs("div",{className:"sheetbar",children:[s.jsx("div",{className:"grab","aria-hidden":"true"}),s.jsx("button",{type:"button",className:"sheetclose",onClick:d,"aria-label":"Close new session",children:s.jsx(pt,{size:19,strokeWidth:2.2,"aria-hidden":"true"})})]}),s.jsx("div",{className:"sheet-in",children:s.jsx(Y9,{roots:t,folders:n,connected:r,...o===void 0?{}:{settingsCatalog:o},starting:x,...i===void 0?{}:{startError:i},onSearch:a,onStart:l,onClose:d})})]})]}):null})}function Y9({roots:e,folders:t,connected:n,settingsCatalog:r,starting:o,startError:x,onSearch:i,onStart:a,onClose:l}){const[d,u]=g.useState(""),[c,p]=g.useState(null),[B,A]=g.useState(""),[k,C]=g.useState("claude"),[b,v]=g.useState("auto"),[F,m]=g.useState(()=>En({},r,"claude")),f=g.useRef(null);g.useEffect(()=>{if(c)return;const h=setTimeout(()=>i(d),180);return()=>clearTimeout(h)},[d,c,i]),g.useEffect(()=>{c&&f.current?.focus()},[c]),g.useEffect(()=>{const h=E=>{E.key==="Escape"&&l()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[l]);const D=h=>{h!==k&&(C(h),m(En({},r,h)))};if(e.length===0)return s.jsxs(s.Fragment,{children:[s.jsx("h2",{children:"Start a session"}),s.jsx(St,{number:1,children:"Choose an agent"}),s.jsx(W0,{agent:k,onPick:D}),s.jsx("p",{className:"sub",children:"No project directories are configured on the laptop."})]});if(c){const h=c.kind==="file"?c.parent??c.label:c.label;return s.jsxs(s.Fragment,{children:[s.jsx("h2",{children:"Start a session"}),s.jsx("p",{className:"sub",children:"Review the agent and project, then describe the task."}),s.jsx(St,{number:1,children:"Agent"}),s.jsx(W0,{agent:k,onPick:D}),s.jsx(St,{number:2,children:"Project"}),s.jsxs("div",{className:"chosen",children:[s.jsx("span",{className:"fico",children:c.kind==="file"?s.jsx(G0,{size:16,strokeWidth:2,"aria-hidden":"true"}):s.jsx(J0,{size:16,strokeWidth:2,"aria-hidden":"true"})}),s.jsxs("span",{className:"body",children:[s.jsx("span",{className:"k",children:"Working in"}),s.jsx("span",{className:"v",title:h,children:h})]}),s.jsx("button",{type:"button",className:"tap",onClick:()=>{p(null),u("")},children:"Change"})]}),c.kind==="file"?s.jsxs("p",{className:"small dim",style:{margin:"10px 2px 0"},children:["The task will name ",s.jsx("span",{className:"mono",children:z0(c.label)})," so"," ",Mt[k]," starts on that file."]}):null,s.jsxs("label",{className:"step-label",htmlFor:"new-session-task",children:[s.jsx("span",{className:"step-number","aria-hidden":"true",children:"3"}),s.jsxs("span",{children:["Task for ",Mt[k]]})]}),s.jsx("textarea",{id:"new-session-task",ref:f,className:"field",value:B,onChange:E=>A(E.target.value),placeholder:`What should ${Mt[k]} do?`,"aria-label":`Task for ${Mt[k]}`,rows:3,onFocus:E=>{const w=E.currentTarget;setTimeout(()=>w.scrollIntoView({block:"center"}),80)}}),s.jsx(St,{number:4,children:"Working mode"}),s.jsx(Px,{agent:k,value:F.mode,onChange:E=>m({...F,mode:E})}),s.jsx(St,{number:5,children:"Workspace"}),s.jsxs("div",{className:"workspacepick",role:"group","aria-label":"Parallel workspace behavior",children:[s.jsxs("button",{type:"button",className:`workspaceoption${b==="auto"?" picked":""}`,"aria-pressed":b==="auto",onClick:()=>v("auto"),children:[s.jsx("strong",{children:"Safe parallel"}),s.jsx("small",{children:"Uses this checkout when free; creates an isolated Git branch when busy."})]}),s.jsxs("button",{type:"button",className:`workspaceoption${b==="shared"?" picked":""}`,"aria-pressed":b==="shared",onClick:()=>v("shared"),children:[s.jsx("strong",{children:"Same checkout"}),s.jsx("small",{children:"Starts only when no other agent owns these files."})]})]}),s.jsxs("details",{className:"session-settings",children:[s.jsx("summary",{children:"Model & reasoning"}),s.jsx("p",{children:"Optional. Defaults follow the provider installed on your laptop."}),s.jsx(Pr,{agent:k,value:F,onChange:m,showMode:!1,...r===void 0?{}:{catalog:r}}),s.jsx("small",{className:"settingsnote",children:"Mode, approvals, and sandbox safety remain visible and reversible."})]}),s.jsx(te,{className:"primary wide",disabled:!B.trim()||!n||o||o0(F,k).error!==void 0,onClick:()=>{const E=c.kind==="file"?O9(c.path):c.path,w=c.kind==="file"?`In the file ${z0(c.label)}: ${B.trim()}`:B.trim(),P=o0(F,k).settings;a(E,w,k,{workspaceMode:b,...Object.keys(P).length===0?{}:{settings:P}})},children:o?"Preparing a safe checkout…":n?"Start session":"Waiting for your laptop…"}),x?s.jsx("p",{className:"start-error",role:"alert",children:x}):null]})}return s.jsxs(s.Fragment,{children:[s.jsx("h2",{children:"Start a session"}),s.jsx("p",{className:"sub",children:"Pick who should work, then find the project on your laptop."}),s.jsx(St,{number:1,children:"Choose an agent"}),s.jsx(W0,{agent:k,onPick:D}),s.jsxs("label",{className:"step-label",htmlFor:"new-session-folder",children:[s.jsx("span",{className:"step-number","aria-hidden":"true",children:"2"}),s.jsx("span",{children:"Find a project"})]}),s.jsx("p",{className:"field-hint",children:"Type any part of the folder or file name."}),s.jsxs("div",{className:"searchwrap",children:[s.jsx(fn,{className:"glyph",size:17,strokeWidth:2.2,"aria-hidden":"true"}),s.jsx("input",{id:"new-session-folder",type:"search",className:"field",value:d,onChange:h=>u(h.target.value),onKeyDown:h=>{h.key==="Enter"&&t[0]&&(h.preventDefault(),p(t[0]))},onFocus:h=>{const E=h.currentTarget;setTimeout(()=>E.scrollIntoView({block:"center"}),80)},placeholder:"e.g. AgentMem-OS","aria-label":"Find a folder",enterKeyHint:"search",inputMode:"search",autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1})]}),t.length===0?s.jsx("p",{className:"folder-empty",role:"status",children:d.trim()?"No match inside the locations LongLeash is currently allowed to use.":"Type a name, or choose an allowed location below."}):s.jsx("ul",{className:"folders",children:t.map(h=>s.jsx("li",{children:s.jsxs("button",{type:"button",className:"folderbtn",onClick:()=>p(h),children:[s.jsx("span",{className:"fico",children:h.kind==="file"?s.jsx(G0,{size:15,strokeWidth:2,"aria-hidden":"true"}):s.jsx(J0,{size:15,strokeWidth:2,"aria-hidden":"true"})}),s.jsx("span",{className:"fl",title:h.label,children:h.label})]})},h.path))}),s.jsxs("p",{className:"scopehint",children:["Searching ",e.length===1?"1 allowed location":`${e.length} allowed locations`,":"," ",e.map(h=>z0(h)).join(", "),"."," ","Start LongLeash with another folder path to add it."]})]})}function Q9(e,t=42){if(e.length<=t)return e;const n=Math.ceil((t-1)/2),r=Math.floor((t-1)/2);return`${e.slice(0,n)}…${e.slice(e.length-r)}`}function Ir({text:e,kind:t="file",accent:n,max:r,expandable:o}){const[x,i]=g.useState(!1),a=t==="folder"?J0:t==="command"?Hc:G0,l=Q9(e,r),d=o===!0&&l!==e,u=s.jsxs(s.Fragment,{children:[s.jsx(a,{size:12,strokeWidth:2,"aria-hidden":"true"}),s.jsx("span",{className:"txt",children:x?e:l})]});return d?s.jsx("button",{type:"button",className:`pathchip tappable${n?" accent":""}${x?" open":""}`,"aria-expanded":x,"aria-label":x?`Collapse path ${e}`:`Show full path ${e}`,onClick:c=>{c.stopPropagation(),i(p=>!p)},children:u}):s.jsx("span",{className:`pathchip${n?" accent":""}`,title:e,children:u})}function Mx(e,t=Date.now()){if(e===void 0||!Number.isFinite(e)||e<=0)return null;const n=new Date(e);if(Number.isNaN(n.getTime()))return null;const r=Math.max(0,t-e),o=6e4,x=60*o,i=24*x;return{label:r<o?"now":r<x?`${Math.floor(r/o)}m ago`:r<i?`${Math.floor(r/x)}h ago`:r<7*i?`${Math.floor(r/i)}d ago`:n.toLocaleDateString(void 0,{month:"short",day:"numeric"}),title:n.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}),dateTime:n.toISOString()}}function Ks({session:e,pending:t,children:n,onOpen:r,settling:o=!1,searchMatch:x}){const i=e.output.trim().slice(-180),a=e.status==="ended"||e.status==="errored"||!e.live,l=e.control==="observe"?"observed in VS Code":!e.live&&e.status==="waiting"?"ready to reopen":bx[e.status]??e.status,d=vt(),u=Mx(e.lastActivityAt??e.startedAt);return s.jsxs(ke.article,{layout:o?!1:"position",transition:ze,className:`session${t>0?" needs":""}${a?" past":""}`,children:[s.jsxs("button",{type:"button",className:"opener",onClick:r,children:[s.jsx(i0,{status:e.status}),s.jsx(ke.h3,{className:"name",...d?{}:{layoutId:`title-${e.sessionId}`},transition:ze,children:e.title||e.sessionId}),s.jsx(Xl,{className:"chev",size:18,strokeWidth:2.2,"aria-hidden":"true"})]}),s.jsxs("p",{className:"meta",children:[s.jsxs("span",{className:"sessionidentity",children:[s.jsx($t,{agent:e.agent}),s.jsx("span",{className:`state ${e.status}`,children:l}),s.jsx("span",{className:"identitydivider","aria-hidden":"true"}),s.jsx(nn,{origin:e.surface??e.origin})]}),s.jsx(Ir,{text:e.cwd,kind:"folder",max:26,expandable:!0}),u?s.jsx("time",{className:"sessiontime",dateTime:u.dateTime,title:u.title,children:u.label}):null,e.settings?.mode?s.jsx("span",{className:"sessiontag modetag",children:e.settings.mode}):null,e.relationship?s.jsxs("span",{className:"sessiontag childtag",children:["child · ",e.relationship.role]}):null,n&&n.total>0?s.jsxs("span",{className:"sessiontag parenttag",children:["parent · ",n.active>0?`${n.active} active`:n.ready>0?`${n.ready} ready`:`${n.total} ${n.total===1?"child":"children"}`]}):null]}),t>0?s.jsxs("span",{className:"flag",children:[s.jsx(xi,{size:13,strokeWidth:2.4,"aria-hidden":"true"}),t===1?"1 decision waiting":`${t} decisions waiting`]}):null,x?s.jsxs("p",{className:"sessionmatch",children:[s.jsx("span",{children:"Match"}),x]}):i?s.jsx("p",{className:"preview",children:i}):null]})}const X9=/^\s{0,6}[-*•]\s+(.*)$/,e8=/^\s{0,6}(\d{1,3})[.)]\s+(.*)$/,t8=/^#{1,4}\s+(.*)$/,n8=/^\s{0,3}```([\w+-]*)\s*$/;function Zs(e){const t=[];for(const n of e.split(/(`[^`]+`)/g))n.length!==0&&(n.startsWith("`")&&n.endsWith("`")&&n.length>2?t.push({t:"code",text:n.slice(1,-1)}):t.push({t:"text",text:n}));return t}function On(e){const t=[];for(const n of e.split(/(\*\*[^*]+\*\*)/g))n.length!==0&&(n.startsWith("**")&&n.endsWith("**")&&n.length>4?t.push({t:"strong",inline:Zs(n.slice(2,-2))}):t.push(...Zs(n)));return t}function r8(e){const t=e.split(`
|
|
24
|
+
`),n=[];let r=[];const o=()=>{const x=r.join(`
|
|
25
|
+
`).trim();r=[],x.length>0&&n.push({t:"p",inline:On(x)})};for(let x=0;x<t.length;x++){const i=t[x],a=i.match(n8);if(a){o();const c=[];for(;++x<t.length&&!/^\s{0,3}```\s*$/.test(t[x]);)c.push(t[x]);n.push({t:"fence",lang:a[1]??"",code:c.join(`
|
|
26
|
+
`)});continue}const l=i.match(t8);if(l){o(),n.push({t:"heading",inline:On((l[1]??"").trim())});continue}const d=i.match(X9);if(d){o();const c=n[n.length-1],p=On((d[1]??"").trim());c?.t==="bullets"?c.items.push(p):n.push({t:"bullets",items:[p]});continue}const u=i.match(e8);if(u){o();const c=n[n.length-1],p=On((u[2]??"").trim());c?.t==="numbered"?c.items.push(p):n.push({t:"numbered",start:parseInt(u[1]??"1",10),items:[p]});continue}if(i.trim().length===0){o();continue}r.push(i)}return o(),n}function Qt({inline:e}){return s.jsx(s.Fragment,{children:e.map((t,n)=>t.t==="code"?s.jsx("code",{children:t.text},n):t.t==="strong"?s.jsx("strong",{children:s.jsx(Qt,{inline:t.inline})},n):s.jsx(g.Fragment,{children:t.text},n))})}function s8({text:e}){const t=r8(e);return s.jsx(s.Fragment,{children:t.map((n,r)=>n.t==="fence"?s.jsxs("pre",{className:"fence",children:[n.lang?s.jsx("span",{className:"lang",children:n.lang}):null,s.jsx("code",{children:n.code})]},r):n.t==="heading"?s.jsx("p",{className:"h",children:s.jsx(Qt,{inline:n.inline})},r):n.t==="bullets"?s.jsx("ul",{children:n.items.map((o,x)=>s.jsx("li",{children:s.jsx(Qt,{inline:o})},x))},r):n.t==="numbered"?s.jsx("ol",{start:n.start,children:n.items.map((o,x)=>s.jsx("li",{children:s.jsx(Qt,{inline:o})},x))},r):s.jsx("p",{className:"para",children:s.jsx(Qt,{inline:n.inline})},r))})}function o8({blocks:e,onDelegate:t}){const n=x8(e);return s.jsx(s.Fragment,{children:n.map((r,o)=>r.kind==="actions"?s.jsx(i8,{items:r.items},o):s.jsx(a8,{block:r.block,...t?{onDelegate:t}:{}},o))})}function x8(e){const t=[];for(const n of e){const r=t[t.length-1];n.kind==="tool"?r?.kind==="actions"?r.items.push(n.text):t.push({kind:"actions",items:[n.text]}):t.push({kind:"block",block:n})}return t}function i8({items:e}){return s.jsx("div",{className:"actions",children:e.map((t,n)=>{const{name:r,detail:o}=R9(t),x=jx(r),i=r==="Bash"||r==="BashOutput";return s.jsxs("div",{className:"action",title:t,children:[s.jsx("span",{className:"ico",children:s.jsx(x,{size:13,strokeWidth:2,"aria-hidden":"true"})}),s.jsx("span",{className:"verb",children:r}),o?s.jsx(Ir,{text:o,kind:i?"command":"file",max:38,expandable:!0}):null]},n)})})}function a8({block:e,onDelegate:t}){if(e.kind==="user"){const n=Md(e.text.replace(/^[\s›]+/,"")).trim();return n===""?null:n==="— reopened —"?s.jsx("div",{className:"blk divider",children:"reopened"}):s.jsx(Gs,{block:e,...t?{onDelegate:t}:{},children:s.jsx("div",{className:"blk mine",children:n})})}return e.kind==="thinking"?s.jsx("div",{className:"blk thinking",children:e.text.trim()}):s.jsx(Gs,{block:e,...t?{onDelegate:t}:{},children:s.jsx("div",{className:"blk say",children:s.jsx(s8,{text:e.text})})})}function Gs({block:e,onDelegate:t,children:n}){return t?s.jsxs("div",{className:`blk-wrap ${e.kind}`,children:[n,s.jsx("button",{type:"button",className:"delegate-block",onClick:()=>t(e),"aria-label":`Delegate ${e.kind==="user"?"this user message":"this agent response"}`,children:s.jsx(sn,{size:15,strokeWidth:2.2,"aria-hidden":"true"})})]}):n}const l8="longleash.delegation-draft.v1.",c8=new Set(["claude","codex"]),d8=new Set(["investigate","review","implement","test"]),u8=new Set(["selected","recent","task"]);function dr(){return globalThis.crypto?.randomUUID?.()??`delegate-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Nr(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function Mr(e,t){return`${l8}${encodeURIComponent(e)}.${t??"session"}`}function h8(e,t,n){try{const r=n===void 0?Nr():n;if(r===null)return null;const o=r.getItem(Mr(e,t));if(o===null)return null;const x=JSON.parse(o);return x.sourceSessionId!==e||x.sourceSeq!==t||!c8.has(x.targetAgent)||!d8.has(x.role)||!u8.has(x.contextScope)||typeof x.briefing!="string"||x.settings!==void 0&&!wt.safeParse(x.settings).success||typeof x.updatedAt!="number"?null:{...x,idempotencyKey:typeof x.idempotencyKey=="string"&&x.idempotencyKey.trim()!==""?x.idempotencyKey:dr()}}catch{return null}}function E8(e,t){try{const n=t===void 0?Nr():t;return n===null?!1:(n.setItem(Mr(e.sourceSessionId,e.sourceSeq),JSON.stringify(e)),!0)}catch{return!1}}function Tx(e,t,n){try{const r=n===void 0?Nr():n;if(r===null)return;r.removeItem(Mr(e,t))}catch{}}const Ct={claude:"Claude",codex:"Codex"},f8={claude:"Anthropic agent",codex:"OpenAI agent"},p8=[{value:"investigate",label:"Investigate",detail:"Find cause + evidence",Icon:Rc},{value:"review",label:"Review",detail:"Check work + gaps",Icon:a0},{value:"implement",label:"Implement",detail:"Make the change",Icon:uo},{value:"test",label:"Test",detail:"Verify behavior",Icon:lc}],m8=[{value:"selected",label:"This message",detail:"Exact message only"},{value:"recent",label:"Recent",detail:"Last conversation turns"},{value:"task",label:"Whole task",detail:"All retained conversation"}];function Js(){return globalThis.crypto?.randomUUID?.()??`preview-${Date.now()}-${Math.random().toString(36).slice(2)}`}function C8(e,t){return`${e.sessionId}:${t??"session"}`}function B8({open:e,session:t,sourceSeq:n,connected:r,preview:o,previewError:x,onPreview:i,onStart:a=()=>!1,launchEnabled:l=!1,workspaceMode:d="legacy",availableTargets:u={claude:!1,codex:!1},settingsCatalog:c,onClose:p}){const B=zt(e),A=Wt(e),k=vt(),C=g.useRef(null);return g.useEffect(()=>{if(!e)return;const b=document.activeElement,v=C.current,F=()=>Array.from(v?.querySelectorAll('button:not(:disabled), textarea:not(:disabled), input:not(:disabled), [tabindex="0"]')??[]).filter(f=>f.getAttribute("aria-hidden")!=="true");F()[0]?.focus();const m=f=>{if(f.key==="Escape"){f.preventDefault(),p();return}if(f.key!=="Tab")return;const D=F(),h=D[0],E=D[D.length-1];!h||!E||(f.shiftKey&&document.activeElement===h?(f.preventDefault(),E.focus()):!f.shiftKey&&document.activeElement===E&&(f.preventDefault(),h.focus()))};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m),b?.focus()}},[e,p]),s.jsx(xt,{children:e?s.jsxs(s.Fragment,{children:[s.jsx(ke.div,{className:"scrim",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,transition:We},onClick:p}),s.jsxs(ke.div,{ref:C,className:"sheet delegate-sheet",style:{...B>0?{bottom:B}:{},...A===null?{}:{maxHeight:`${Math.max(180,A-8)}px`}},role:"dialog","aria-modal":"true","aria-label":"Delegate work to another agent",initial:k?!1:{y:"100%"},animate:{y:0},...k?{}:{exit:{y:"100%",transition:We}},transition:ze,children:[s.jsxs("div",{className:"sheetbar",children:[s.jsx("div",{className:"grab","aria-hidden":"true"}),s.jsx("button",{type:"button",className:"sheetclose",onClick:p,"aria-label":"Close delegation",children:s.jsx(pt,{size:19,strokeWidth:2.2,"aria-hidden":"true"})})]}),s.jsx("div",{className:"sheet-in",children:s.jsx(g8,{session:t,...n===void 0?{}:{sourceSeq:n},connected:r,preview:o,previewError:x,onPreview:i,onStart:a,launchEnabled:l,workspaceMode:d,availableTargets:u,...c===void 0?{}:{settingsCatalog:c}},C8(t,n))})]})]}):null})}function g8({session:e,sourceSeq:t,connected:n,preview:r,previewError:o,onPreview:x,onStart:i,launchEnabled:a,workspaceMode:l,availableTargets:d,settingsCatalog:u}){const c=g.useMemo(()=>h8(e.sessionId,t),[e.sessionId,t]),p=r?.source.sessionId===e.sessionId&&r.sourceSeq===t?r:null,B=e.agent==="claude"?"codex":"claude",[A,k]=g.useState(c?.targetAgent??p?.targetAgent??B),[C,b]=g.useState(c?.role??p?.role??"review"),[v,F]=g.useState(c?.contextScope??p?.contextScope??(t===void 0?"recent":"selected")),[m,f]=g.useState(c?.briefing??p?.briefing??""),[D,h]=g.useState(()=>En(c?.settings??{},u,c?.targetAgent??p?.targetAgent??B)),[E,w]=g.useState(c?.idempotencyKey??dr()),[P,I]=g.useState(null),[j,y]=g.useState(null),[_,L]=g.useState(!1),[K,M]=g.useState(c?.briefing?`${c.targetAgent}:${c.role}:${c.contextScope}:${t??""}`:p?`${p.targetAgent}:${p.role}:${p.contextScope}:${t??""}`:null),[z,q]=g.useState(p?.requestId??null),[J,R]=g.useState("idle"),se=g.useRef(!1),$=g.useId(),Y=`${A}:${C}:${v}:${t??""}`,Pe=P!==null&&o?.requestId===P?o.message:null,pe=P!==null&&r?.requestId!==P&&Pe===null,Z=m!==""&&K!==null&&K!==Y,Ee=r?.requestId===z?r.context.maxCharacters:24e3,Fe=m.length>Ee,qe=j!==null&&o?.requestId===j?o.message:null,me=j!==null&&qe===null,it=d[A],Ie=g.useMemo(()=>o0(D,A),[D,A]),Ue=n&&a&&l==="sequential"&&_&&it&&m!==""&&!Z&&!Fe&&!me&&Ie.error===void 0;g.useEffect(()=>{if(se.current){se.current=!1;return}E8({idempotencyKey:E,sourceSessionId:e.sessionId,...t===void 0?{}:{sourceSeq:t},targetAgent:A,role:C,contextScope:v,briefing:m,...Object.keys(Ie.settings).length===0?{}:{settings:Ie.settings},updatedAt:Date.now()})},[e.sessionId,t,A,C,v,m,E,Ie.settings]),g.useEffect(()=>{qe!==null&&w(dr())},[qe]),g.useEffect(()=>{P===null||r?.requestId!==P||(f(r.briefing),M(`${r.targetAgent}:${r.role}:${r.contextScope}:${r.sourceSeq??""}`),q(r.requestId),I(null))},[P,r]);const Le=()=>{const re=Js();I(re),x({requestId:re,sourceSessionId:e.sessionId,...t===void 0?{}:{sourceSeq:t},targetAgent:A,role:C,contextScope:v})},$e=()=>{!navigator.clipboard||m===""||navigator.clipboard.writeText(m).then(()=>{R("copied"),setTimeout(()=>R("idle"),2200)}).catch(()=>R("failed"))},at=()=>{if(!Ue)return;const re=Js();y(re),i({requestId:re,idempotencyKey:E,sourceSessionId:e.sessionId,...t===void 0?{}:{sourceSeq:t},targetAgent:A,role:C,contextScope:v,briefing:m,...Object.keys(Ie.settings).length===0?{}:{settings:Ie.settings}})};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"delegate-title",children:[s.jsx("span",{className:"delegate-mark","aria-hidden":"true",children:s.jsx(sn,{size:18,strokeWidth:2.2})}),s.jsxs("div",{children:[s.jsx("h2",{children:"Delegate"}),s.jsx("p",{className:"sub",children:"Build the exact handoff, edit it on your phone, then review it before anything starts."})]})]}),s.jsxs("div",{className:"delegate-source","aria-label":"Delegation source",children:[s.jsx("span",{className:"k",children:"From"}),s.jsx("strong",{children:e.title||"Untitled session"}),s.jsx("span",{className:"mono",children:t===void 0?"recent context":`message ${t}`})]}),s.jsxs("fieldset",{className:"delegate-fieldset",children:[s.jsxs("legend",{children:[s.jsx("span",{className:"step-number","aria-hidden":"true",children:"1"})," Agent"]}),s.jsx("div",{className:"agentpick",role:"group","aria-label":"Target agent",children:["claude","codex"].map(re=>{const Ce=A===re;return s.jsxs(te,{className:`agentoption${Ce?" picked":""}`,pressed:Ce,label:`Delegate to ${Ct[re]}`,disabled:me||!d[re],onClick:()=>{k(re),h(En({},u,re))},children:[s.jsx($t,{agent:re,decorative:!0}),s.jsxs("span",{className:"agentcopy",children:[s.jsx("strong",{children:Ct[re]}),s.jsx("small",{children:d[re]?f8[re]:"Not available on laptop"})]}),s.jsx(Ke,{className:"agentcheck",size:17,strokeWidth:2.7,"aria-hidden":"true"})]},re)})})]}),s.jsxs("details",{className:"session-settings delegate-settings",children:[s.jsx("summary",{children:"Child model & reasoning"}),s.jsx("p",{children:"Optional. These controls belong only to the new child and can be changed later."}),s.jsx(Pr,{agent:A,value:D,onChange:h,disabled:me,...u===void 0?{}:{catalog:u}}),s.jsx("small",{className:"settingsnote",children:Ie.error??"Provider defaults are used for anything you leave unchanged."})]}),s.jsxs("fieldset",{className:"delegate-fieldset",children:[s.jsxs("legend",{children:[s.jsx("span",{className:"step-number","aria-hidden":"true",children:"2"})," Role"]}),s.jsx("div",{className:"rolepick",children:p8.map(({value:re,label:Ce,detail:Ht,Icon:je})=>s.jsxs(te,{className:`roleoption${C===re?" picked":""}`,pressed:C===re,disabled:me,onClick:()=>b(re),children:[s.jsx(je,{size:16,strokeWidth:2.1,"aria-hidden":"true"}),s.jsxs("span",{children:[s.jsx("strong",{children:Ce}),s.jsx("small",{children:Ht})]})]},re))})]}),s.jsxs("fieldset",{className:"delegate-fieldset",children:[s.jsxs("legend",{children:[s.jsx("span",{className:"step-number","aria-hidden":"true",children:"3"})," Context"]}),s.jsx("div",{className:"scopepick",children:m8.map(({value:re,label:Ce,detail:Ht})=>{const je=re==="selected"&&t===void 0;return s.jsxs(te,{className:`scopeoption${v===re?" picked":""}`,pressed:v===re,disabled:je||me,...je?{label:"This message is available when delegating from a transcript message"}:{},onClick:()=>F(re),children:[s.jsx("strong",{children:Ce}),s.jsx("small",{children:Ht})]},re)})})]}),s.jsx(te,{className:"primary wide delegate-build",disabled:!n||pe,onClick:Le,children:pe?"Building exact briefing…":m===""?"Build briefing":"Rebuild briefing"}),s.jsx("p",{className:`delegate-status${Fe?" bad":""}`,"aria-live":"polite",children:n?Pe||(Fe?`Briefing is ${(m.length-Ee).toLocaleString()} characters over the limit. Shorten it before launch.`:Z?"Controls changed. Rebuild before this briefing can be launched.":c?.briefing&&z===null?"Draft restored from this phone.":m?"Briefing ready. Your edits are saved automatically.":"Nothing starts while you build or edit this preview."):"Waiting for your laptop. Your choices and edits stay saved on this phone."}),m!==""?s.jsxs("div",{className:"briefing-editor",children:[s.jsxs("div",{className:"briefing-head",children:[s.jsx("label",{htmlFor:$,children:"Briefing"}),s.jsxs("button",{type:"button",className:"tap quiet",onClick:$e,"aria-label":"Copy briefing",children:[J==="copied"?s.jsx(Ke,{size:14,strokeWidth:2.4,"aria-hidden":"true"}):s.jsx(ho,{size:14,strokeWidth:2.2,"aria-hidden":"true"}),J==="copied"?"Copied":J==="failed"?"Select to copy":"Copy"]})]}),s.jsx("textarea",{id:$,className:"field briefing-field",value:m,onChange:re=>f(re.target.value),disabled:me,rows:14,spellCheck:!0,"aria-describedby":`${$}-meta`}),s.jsxs("div",{className:"briefing-meta",id:`${$}-meta`,children:[s.jsxs("span",{children:[m.length.toLocaleString()," / ",Ee.toLocaleString()," characters"]}),r?.requestId===z&&r.context.truncated?s.jsx("span",{children:"Context limit applied"}):null,s.jsx("button",{type:"button",className:"tap quiet",onClick:()=>{se.current=!0,Tx(e.sessionId,t),f(""),M(null)},children:"Discard draft"})]})]}):null,m!==""?s.jsxs("div",{className:"delegate-confirm",children:[s.jsxs("div",{children:[s.jsx("strong",{children:"Ready to hand off to one attributed child"}),s.jsxs("p",{children:[Ct[A]," will receive exactly the editable briefing above in",s.jsxs("span",{className:"mono",children:[" ",e.cwd]}),". Its approvals, Stop control, errors, and transcript stay independent."]})]}),s.jsxs("label",{className:"takeover-confirm transfer-confirm",children:[s.jsx("input",{type:"checkbox",checked:_,onChange:re=>L(re.target.checked),disabled:me||l!=="sequential"}),s.jsx("span",{className:"takeover-check","aria-hidden":"true",children:s.jsx(Ke,{size:15,strokeWidth:2.7})}),s.jsxs("span",{children:[s.jsxs("strong",{children:[s.jsx(a0,{size:15,strokeWidth:2.2,"aria-hidden":"true"})," Move sole workspace control"]}),s.jsx("small",{children:"The parent pauses if active. Only the child may write this checkout until you review and return its result."})]})]}),s.jsxs(te,{className:"primary wide delegate-launch",disabled:!Ue,onClick:at,label:`Start one ${Ct[A]} child session`,children:[s.jsx(sn,{size:17,strokeWidth:2.4,"aria-hidden":"true"}),me?`Starting ${Ct[A]}…`:`Start ${Ct[A]} child`]}),s.jsx("p",{className:`delegate-status${qe?" bad":""}`,role:"status","aria-live":"polite",children:qe||(!a||l!=="sequential"?"Update the laptop daemon to enable protected workspace handoffs.":it?Ie.error?Ie.error:Z?"Rebuild the briefing after changing its controls.":_?me?"Launch accepted. Waiting for the attributed child session…":"Nothing starts until you press this button.":"Confirm the exclusive workspace handoff before launch.":`${Ct[A]} is not configured on this laptop.`)})]}):s.jsxs("div",{className:"delegate-lockline",children:[s.jsx("span",{className:"led waiting","aria-hidden":"true"}),"Preview only — no child session has been started."]})]})}function A8(e,t,n){return e!==null&&(n===e.requestId||t.idempotencyKey===e.idempotencyKey)}function F8(){return"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}function Ys(){return F8()?Notification.permission:"unsupported"}async function D8(e){try{return await Notification.requestPermission()!=="granted"?null:await Ox(e)}catch{return null}}async function k8(e){try{return Notification.permission!=="granted"?null:await Ox(e)}catch{return null}}async function Ox(e){const t=await navigator.serviceWorker.ready,n=await t.pushManager.getSubscription();return n?n.toJSON():(await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:y8(e)})).toJSON()}function y8(e){const t=e+"=".repeat((4-e.length%4)%4),n=atob(t.replace(/-/g,"+").replace(/_/g,"/")),r=new Uint8Array(new ArrayBuffer(n.length));for(let o=0;o<n.length;o+=1)r[o]=n.charCodeAt(o);return r}var Un={exports:{}},v8=Un.exports,Qs;function w8(){return Qs||(Qs=1,(function(e,t){(function(r,o){e.exports=o()})(typeof self<"u"?self:v8,function(){return(function(n){var r={};function o(x){if(r[x])return r[x].exports;var i=r[x]={i:x,l:!1,exports:{}};return n[x].call(i.exports,i,i.exports,o),i.l=!0,i.exports}return o.m=n,o.c=r,o.d=function(x,i,a){o.o(x,i)||Object.defineProperty(x,i,{configurable:!1,enumerable:!0,get:a})},o.n=function(x){var i=x&&x.__esModule?function(){return x.default}:function(){return x};return o.d(i,"a",i),i},o.o=function(x,i){return Object.prototype.hasOwnProperty.call(x,i)},o.p="",o(o.s=3)})([(function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var x=(function(){function i(a,l){this.width=l,this.height=a.length/l,this.data=a}return i.createEmpty=function(a,l){return new i(new Uint8ClampedArray(a*l),a)},i.prototype.get=function(a,l){return a<0||a>=this.width||l<0||l>=this.height?!1:!!this.data[l*this.width+a]},i.prototype.set=function(a,l,d){this.data[l*this.width+a]=d?1:0},i.prototype.setRegion=function(a,l,d,u,c){for(var p=l;p<l+u;p++)for(var B=a;B<a+d;B++)this.set(B,p,!!c)},i})();r.BitMatrix=x}),(function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var x=o(2);function i(l,d){return l^d}r.addOrSubtractGF=i;var a=(function(){function l(d,u,c){this.primitive=d,this.size=u,this.generatorBase=c,this.expTable=new Array(this.size),this.logTable=new Array(this.size);for(var p=1,B=0;B<this.size;B++)this.expTable[B]=p,p=p*2,p>=this.size&&(p=(p^this.primitive)&this.size-1);for(var B=0;B<this.size-1;B++)this.logTable[this.expTable[B]]=B;this.zero=new x.default(this,Uint8ClampedArray.from([0])),this.one=new x.default(this,Uint8ClampedArray.from([1]))}return l.prototype.multiply=function(d,u){return d===0||u===0?0:this.expTable[(this.logTable[d]+this.logTable[u])%(this.size-1)]},l.prototype.inverse=function(d){if(d===0)throw new Error("Can't invert 0");return this.expTable[this.size-this.logTable[d]-1]},l.prototype.buildMonomial=function(d,u){if(d<0)throw new Error("Invalid monomial degree less than 0");if(u===0)return this.zero;var c=new Uint8ClampedArray(d+1);return c[0]=u,new x.default(this,c)},l.prototype.log=function(d){if(d===0)throw new Error("Can't take log(0)");return this.logTable[d]},l.prototype.exp=function(d){return this.expTable[d]},l})();r.default=a}),(function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var x=o(1),i=(function(){function a(l,d){if(d.length===0)throw new Error("No coefficients.");this.field=l;var u=d.length;if(u>1&&d[0]===0){for(var c=1;c<u&&d[c]===0;)c++;if(c===u)this.coefficients=l.zero.coefficients;else{this.coefficients=new Uint8ClampedArray(u-c);for(var p=0;p<this.coefficients.length;p++)this.coefficients[p]=d[c+p]}}else this.coefficients=d}return a.prototype.degree=function(){return this.coefficients.length-1},a.prototype.isZero=function(){return this.coefficients[0]===0},a.prototype.getCoefficient=function(l){return this.coefficients[this.coefficients.length-1-l]},a.prototype.addOrSubtract=function(l){var d;if(this.isZero())return l;if(l.isZero())return this;var u=this.coefficients,c=l.coefficients;u.length>c.length&&(d=[c,u],u=d[0],c=d[1]);for(var p=new Uint8ClampedArray(c.length),B=c.length-u.length,A=0;A<B;A++)p[A]=c[A];for(var A=B;A<c.length;A++)p[A]=x.addOrSubtractGF(u[A-B],c[A]);return new a(this.field,p)},a.prototype.multiply=function(l){if(l===0)return this.field.zero;if(l===1)return this;for(var d=this.coefficients.length,u=new Uint8ClampedArray(d),c=0;c<d;c++)u[c]=this.field.multiply(this.coefficients[c],l);return new a(this.field,u)},a.prototype.multiplyPoly=function(l){if(this.isZero()||l.isZero())return this.field.zero;for(var d=this.coefficients,u=d.length,c=l.coefficients,p=c.length,B=new Uint8ClampedArray(u+p-1),A=0;A<u;A++)for(var k=d[A],C=0;C<p;C++)B[A+C]=x.addOrSubtractGF(B[A+C],this.field.multiply(k,c[C]));return new a(this.field,B)},a.prototype.multiplyByMonomial=function(l,d){if(l<0)throw new Error("Invalid degree less than 0");if(d===0)return this.field.zero;for(var u=this.coefficients.length,c=new Uint8ClampedArray(u+l),p=0;p<u;p++)c[p]=this.field.multiply(this.coefficients[p],d);return new a(this.field,c)},a.prototype.evaluateAt=function(l){var d=0;if(l===0)return this.getCoefficient(0);var u=this.coefficients.length;if(l===1)return this.coefficients.forEach(function(p){d=x.addOrSubtractGF(d,p)}),d;d=this.coefficients[0];for(var c=1;c<u;c++)d=x.addOrSubtractGF(this.field.multiply(l,d),this.coefficients[c]);return d},a})();r.default=i}),(function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var x=o(4),i=o(5),a=o(11),l=o(12);function d(p){var B=l.locate(p);if(!B)return null;for(var A=0,k=B;A<k.length;A++){var C=k[A],b=a.extract(p,C),v=i.decode(b.matrix);if(v)return{binaryData:v.bytes,data:v.text,chunks:v.chunks,version:v.version,location:{topRightCorner:b.mappingFunction(C.dimension,0),topLeftCorner:b.mappingFunction(0,0),bottomRightCorner:b.mappingFunction(C.dimension,C.dimension),bottomLeftCorner:b.mappingFunction(0,C.dimension),topRightFinderPattern:C.topRight,topLeftFinderPattern:C.topLeft,bottomLeftFinderPattern:C.bottomLeft,bottomRightAlignmentPattern:C.alignmentPattern}}}return null}var u={inversionAttempts:"attemptBoth"};function c(p,B,A,k){k===void 0&&(k={});var C=u;Object.keys(C||{}).forEach(function(h){C[h]=k[h]||C[h]});var b=C.inversionAttempts==="attemptBoth"||C.inversionAttempts==="invertFirst",v=C.inversionAttempts==="onlyInvert"||C.inversionAttempts==="invertFirst",F=x.binarize(p,B,A,b),m=F.binarized,f=F.inverted,D=d(v?f:m);return!D&&(C.inversionAttempts==="attemptBoth"||C.inversionAttempts==="invertFirst")&&(D=d(v?m:f)),D}c.default=c,r.default=c}),(function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var x=o(0),i=8,a=24;function l(c,p,B){return c<p?p:c>B?B:c}var d=(function(){function c(p,B){this.width=p,this.data=new Uint8ClampedArray(p*B)}return c.prototype.get=function(p,B){return this.data[B*this.width+p]},c.prototype.set=function(p,B,A){this.data[B*this.width+p]=A},c})();function u(c,p,B,A){if(c.length!==p*B*4)throw new Error("Malformed data passed to binarizer.");for(var k=new d(p,B),C=0;C<p;C++)for(var b=0;b<B;b++){var v=c[(b*p+C)*4+0],F=c[(b*p+C)*4+1],m=c[(b*p+C)*4+2];k.set(C,b,.2126*v+.7152*F+.0722*m)}for(var f=Math.ceil(p/i),D=Math.ceil(B/i),h=new d(f,D),E=0;E<D;E++)for(var w=0;w<f;w++){for(var P=0,I=1/0,j=0,b=0;b<i;b++)for(var C=0;C<i;C++){var y=k.get(w*i+C,E*i+b);P+=y,I=Math.min(I,y),j=Math.max(j,y)}var _=P/Math.pow(i,2);if(j-I<=a&&(_=I/2,E>0&&w>0)){var L=(h.get(w,E-1)+2*h.get(w-1,E)+h.get(w-1,E-1))/4;I<L&&(_=L)}h.set(w,E,_)}var K=x.BitMatrix.createEmpty(p,B),M=null;A&&(M=x.BitMatrix.createEmpty(p,B));for(var E=0;E<D;E++)for(var w=0;w<f;w++){for(var z=l(w,2,f-3),q=l(E,2,D-3),P=0,J=-2;J<=2;J++)for(var R=-2;R<=2;R++)P+=h.get(z+J,q+R);for(var se=P/25,J=0;J<i;J++)for(var R=0;R<i;R++){var C=w*i+J,b=E*i+R,$=k.get(C,b);K.set(C,b,$<=se),A&&M.set(C,b,!($<=se))}}return A?{binarized:K,inverted:M}:{binarized:K}}r.binarize=u}),(function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var x=o(0),i=o(6),a=o(9),l=o(10);function d(m,f){for(var D=m^f,h=0;D;)h++,D&=D-1;return h}function u(m,f){return f<<1|m}var c=[{bits:21522,formatInfo:{errorCorrectionLevel:1,dataMask:0}},{bits:20773,formatInfo:{errorCorrectionLevel:1,dataMask:1}},{bits:24188,formatInfo:{errorCorrectionLevel:1,dataMask:2}},{bits:23371,formatInfo:{errorCorrectionLevel:1,dataMask:3}},{bits:17913,formatInfo:{errorCorrectionLevel:1,dataMask:4}},{bits:16590,formatInfo:{errorCorrectionLevel:1,dataMask:5}},{bits:20375,formatInfo:{errorCorrectionLevel:1,dataMask:6}},{bits:19104,formatInfo:{errorCorrectionLevel:1,dataMask:7}},{bits:30660,formatInfo:{errorCorrectionLevel:0,dataMask:0}},{bits:29427,formatInfo:{errorCorrectionLevel:0,dataMask:1}},{bits:32170,formatInfo:{errorCorrectionLevel:0,dataMask:2}},{bits:30877,formatInfo:{errorCorrectionLevel:0,dataMask:3}},{bits:26159,formatInfo:{errorCorrectionLevel:0,dataMask:4}},{bits:25368,formatInfo:{errorCorrectionLevel:0,dataMask:5}},{bits:27713,formatInfo:{errorCorrectionLevel:0,dataMask:6}},{bits:26998,formatInfo:{errorCorrectionLevel:0,dataMask:7}},{bits:5769,formatInfo:{errorCorrectionLevel:3,dataMask:0}},{bits:5054,formatInfo:{errorCorrectionLevel:3,dataMask:1}},{bits:7399,formatInfo:{errorCorrectionLevel:3,dataMask:2}},{bits:6608,formatInfo:{errorCorrectionLevel:3,dataMask:3}},{bits:1890,formatInfo:{errorCorrectionLevel:3,dataMask:4}},{bits:597,formatInfo:{errorCorrectionLevel:3,dataMask:5}},{bits:3340,formatInfo:{errorCorrectionLevel:3,dataMask:6}},{bits:2107,formatInfo:{errorCorrectionLevel:3,dataMask:7}},{bits:13663,formatInfo:{errorCorrectionLevel:2,dataMask:0}},{bits:12392,formatInfo:{errorCorrectionLevel:2,dataMask:1}},{bits:16177,formatInfo:{errorCorrectionLevel:2,dataMask:2}},{bits:14854,formatInfo:{errorCorrectionLevel:2,dataMask:3}},{bits:9396,formatInfo:{errorCorrectionLevel:2,dataMask:4}},{bits:8579,formatInfo:{errorCorrectionLevel:2,dataMask:5}},{bits:11994,formatInfo:{errorCorrectionLevel:2,dataMask:6}},{bits:11245,formatInfo:{errorCorrectionLevel:2,dataMask:7}}],p=[function(m){return(m.y+m.x)%2===0},function(m){return m.y%2===0},function(m){return m.x%3===0},function(m){return(m.y+m.x)%3===0},function(m){return(Math.floor(m.y/2)+Math.floor(m.x/3))%2===0},function(m){return m.x*m.y%2+m.x*m.y%3===0},function(m){return(m.y*m.x%2+m.y*m.x%3)%2===0},function(m){return((m.y+m.x)%2+m.y*m.x%3)%2===0}];function B(m){var f=17+4*m.versionNumber,D=x.BitMatrix.createEmpty(f,f);D.setRegion(0,0,9,9,!0),D.setRegion(f-8,0,8,9,!0),D.setRegion(0,f-8,9,8,!0);for(var h=0,E=m.alignmentPatternCenters;h<E.length;h++)for(var w=E[h],P=0,I=m.alignmentPatternCenters;P<I.length;P++){var j=I[P];w===6&&j===6||w===6&&j===f-7||w===f-7&&j===6||D.setRegion(w-2,j-2,5,5,!0)}return D.setRegion(6,9,1,f-17,!0),D.setRegion(9,6,f-17,1,!0),m.versionNumber>6&&(D.setRegion(f-11,0,3,6,!0),D.setRegion(0,f-11,6,3,!0)),D}function A(m,f,D){for(var h=p[D.dataMask],E=m.height,w=B(f),P=[],I=0,j=0,y=!0,_=E-1;_>0;_-=2){_===6&&_--;for(var L=0;L<E;L++)for(var K=y?E-1-L:L,M=0;M<2;M++){var z=_-M;if(!w.get(z,K)){j++;var q=m.get(z,K);h({y:K,x:z})&&(q=!q),I=u(q,I),j===8&&(P.push(I),j=0,I=0)}}y=!y}return P}function k(m){var f=m.height,D=Math.floor((f-17)/4);if(D<=6)return l.VERSIONS[D-1];for(var h=0,E=5;E>=0;E--)for(var w=f-9;w>=f-11;w--)h=u(m.get(w,E),h);for(var P=0,w=5;w>=0;w--)for(var E=f-9;E>=f-11;E--)P=u(m.get(w,E),P);for(var I=1/0,j,y=0,_=l.VERSIONS;y<_.length;y++){var L=_[y];if(L.infoBits===h||L.infoBits===P)return L;var K=d(h,L.infoBits);K<I&&(j=L,I=K),K=d(P,L.infoBits),K<I&&(j=L,I=K)}if(I<=3)return j}function C(m){for(var f=0,D=0;D<=8;D++)D!==6&&(f=u(m.get(D,8),f));for(var h=7;h>=0;h--)h!==6&&(f=u(m.get(8,h),f));for(var E=m.height,w=0,h=E-1;h>=E-7;h--)w=u(m.get(8,h),w);for(var D=E-8;D<E;D++)w=u(m.get(D,8),w);for(var P=1/0,I=null,j=0,y=c;j<y.length;j++){var _=y[j],L=_.bits,K=_.formatInfo;if(L===f||L===w)return K;var M=d(f,L);M<P&&(I=K,P=M),f!==w&&(M=d(w,L),M<P&&(I=K,P=M))}return P<=3?I:null}function b(m,f,D){var h=f.errorCorrectionLevels[D],E=[],w=0;if(h.ecBlocks.forEach(function(q){for(var J=0;J<q.numBlocks;J++)E.push({numDataCodewords:q.dataCodewordsPerBlock,codewords:[]}),w+=q.dataCodewordsPerBlock+h.ecCodewordsPerBlock}),m.length<w)return null;m=m.slice(0,w);for(var P=h.ecBlocks[0].dataCodewordsPerBlock,I=0;I<P;I++)for(var j=0,y=E;j<y.length;j++){var _=y[j];_.codewords.push(m.shift())}if(h.ecBlocks.length>1)for(var L=h.ecBlocks[0].numBlocks,K=h.ecBlocks[1].numBlocks,I=0;I<K;I++)E[L+I].codewords.push(m.shift());for(;m.length>0;)for(var M=0,z=E;M<z.length;M++){var _=z[M];_.codewords.push(m.shift())}return E}function v(m){var f=k(m);if(!f)return null;var D=C(m);if(!D)return null;var h=A(m,f,D),E=b(h,f,D.errorCorrectionLevel);if(!E)return null;for(var w=E.reduce(function(M,z){return M+z.numDataCodewords},0),P=new Uint8ClampedArray(w),I=0,j=0,y=E;j<y.length;j++){var _=y[j],L=a.decode(_.codewords,_.codewords.length-_.numDataCodewords);if(!L)return null;for(var K=0;K<_.numDataCodewords;K++)P[I++]=L[K]}try{return i.decode(P,f.versionNumber)}catch{return null}}function F(m){if(m==null)return null;var f=v(m);if(f)return f;for(var D=0;D<m.width;D++)for(var h=D+1;h<m.height;h++)m.get(D,h)!==m.get(h,D)&&(m.set(D,h,!m.get(D,h)),m.set(h,D,!m.get(h,D)));return v(m)}r.decode=F}),(function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var x=o(7),i=o(8),a;(function(k){k.Numeric="numeric",k.Alphanumeric="alphanumeric",k.Byte="byte",k.Kanji="kanji",k.ECI="eci"})(a=r.Mode||(r.Mode={}));var l;(function(k){k[k.Terminator=0]="Terminator",k[k.Numeric=1]="Numeric",k[k.Alphanumeric=2]="Alphanumeric",k[k.Byte=4]="Byte",k[k.Kanji=8]="Kanji",k[k.ECI=7]="ECI"})(l||(l={}));function d(k,C){for(var b=[],v="",F=[10,12,14][C],m=k.readBits(F);m>=3;){var f=k.readBits(10);if(f>=1e3)throw new Error("Invalid numeric value above 999");var D=Math.floor(f/100),h=Math.floor(f/10)%10,E=f%10;b.push(48+D,48+h,48+E),v+=D.toString()+h.toString()+E.toString(),m-=3}if(m===2){var f=k.readBits(7);if(f>=100)throw new Error("Invalid numeric value above 99");var D=Math.floor(f/10),h=f%10;b.push(48+D,48+h),v+=D.toString()+h.toString()}else if(m===1){var f=k.readBits(4);if(f>=10)throw new Error("Invalid numeric value above 9");b.push(48+f),v+=f.toString()}return{bytes:b,text:v}}var u=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function c(k,C){for(var b=[],v="",F=[9,11,13][C],m=k.readBits(F);m>=2;){var f=k.readBits(11),D=Math.floor(f/45),h=f%45;b.push(u[D].charCodeAt(0),u[h].charCodeAt(0)),v+=u[D]+u[h],m-=2}if(m===1){var D=k.readBits(6);b.push(u[D].charCodeAt(0)),v+=u[D]}return{bytes:b,text:v}}function p(k,C){for(var b=[],v="",F=[8,16,16][C],m=k.readBits(F),f=0;f<m;f++){var D=k.readBits(8);b.push(D)}try{v+=decodeURIComponent(b.map(function(h){return"%"+("0"+h.toString(16)).substr(-2)}).join(""))}catch{}return{bytes:b,text:v}}function B(k,C){for(var b=[],v="",F=[8,10,12][C],m=k.readBits(F),f=0;f<m;f++){var D=k.readBits(13),h=Math.floor(D/192)<<8|D%192;h<7936?h+=33088:h+=49472,b.push(h>>8,h&255),v+=String.fromCharCode(i.shiftJISTable[h])}return{bytes:b,text:v}}function A(k,C){for(var b,v,F,m,f=new x.BitStream(k),D=C<=9?0:C<=26?1:2,h={text:"",bytes:[],chunks:[],version:C};f.available()>=4;){var E=f.readBits(4);if(E===l.Terminator)return h;if(E===l.ECI)f.readBits(1)===0?h.chunks.push({type:a.ECI,assignmentNumber:f.readBits(7)}):f.readBits(1)===0?h.chunks.push({type:a.ECI,assignmentNumber:f.readBits(14)}):f.readBits(1)===0?h.chunks.push({type:a.ECI,assignmentNumber:f.readBits(21)}):h.chunks.push({type:a.ECI,assignmentNumber:-1});else if(E===l.Numeric){var w=d(f,D);h.text+=w.text,(b=h.bytes).push.apply(b,w.bytes),h.chunks.push({type:a.Numeric,text:w.text})}else if(E===l.Alphanumeric){var P=c(f,D);h.text+=P.text,(v=h.bytes).push.apply(v,P.bytes),h.chunks.push({type:a.Alphanumeric,text:P.text})}else if(E===l.Byte){var I=p(f,D);h.text+=I.text,(F=h.bytes).push.apply(F,I.bytes),h.chunks.push({type:a.Byte,bytes:I.bytes,text:I.text})}else if(E===l.Kanji){var j=B(f,D);h.text+=j.text,(m=h.bytes).push.apply(m,j.bytes),h.chunks.push({type:a.Kanji,bytes:j.bytes,text:j.text})}}if(f.available()===0||f.readBits(f.available())===0)return h}r.decode=A}),(function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var x=(function(){function i(a){this.byteOffset=0,this.bitOffset=0,this.bytes=a}return i.prototype.readBits=function(a){if(a<1||a>32||a>this.available())throw new Error("Cannot read "+a.toString()+" bits");var l=0;if(this.bitOffset>0){var d=8-this.bitOffset,u=a<d?a:d,c=d-u,p=255>>8-u<<c;l=(this.bytes[this.byteOffset]&p)>>c,a-=u,this.bitOffset+=u,this.bitOffset===8&&(this.bitOffset=0,this.byteOffset++)}if(a>0){for(;a>=8;)l=l<<8|this.bytes[this.byteOffset]&255,this.byteOffset++,a-=8;if(a>0){var c=8-a,p=255>>c<<c;l=l<<a|(this.bytes[this.byteOffset]&p)>>c,this.bitOffset+=a}}return l},i.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},i})();r.BitStream=x}),(function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.shiftJISTable={32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:165,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:8254,33088:12288,33089:12289,33090:12290,33091:65292,33092:65294,33093:12539,33094:65306,33095:65307,33096:65311,33097:65281,33098:12443,33099:12444,33100:180,33101:65344,33102:168,33103:65342,33104:65507,33105:65343,33106:12541,33107:12542,33108:12445,33109:12446,33110:12291,33111:20189,33112:12293,33113:12294,33114:12295,33115:12540,33116:8213,33117:8208,33118:65295,33119:92,33120:12316,33121:8214,33122:65372,33123:8230,33124:8229,33125:8216,33126:8217,33127:8220,33128:8221,33129:65288,33130:65289,33131:12308,33132:12309,33133:65339,33134:65341,33135:65371,33136:65373,33137:12296,33138:12297,33139:12298,33140:12299,33141:12300,33142:12301,33143:12302,33144:12303,33145:12304,33146:12305,33147:65291,33148:8722,33149:177,33150:215,33152:247,33153:65309,33154:8800,33155:65308,33156:65310,33157:8806,33158:8807,33159:8734,33160:8756,33161:9794,33162:9792,33163:176,33164:8242,33165:8243,33166:8451,33167:65509,33168:65284,33169:162,33170:163,33171:65285,33172:65283,33173:65286,33174:65290,33175:65312,33176:167,33177:9734,33178:9733,33179:9675,33180:9679,33181:9678,33182:9671,33183:9670,33184:9633,33185:9632,33186:9651,33187:9650,33188:9661,33189:9660,33190:8251,33191:12306,33192:8594,33193:8592,33194:8593,33195:8595,33196:12307,33208:8712,33209:8715,33210:8838,33211:8839,33212:8834,33213:8835,33214:8746,33215:8745,33224:8743,33225:8744,33226:172,33227:8658,33228:8660,33229:8704,33230:8707,33242:8736,33243:8869,33244:8978,33245:8706,33246:8711,33247:8801,33248:8786,33249:8810,33250:8811,33251:8730,33252:8765,33253:8733,33254:8757,33255:8747,33256:8748,33264:8491,33265:8240,33266:9839,33267:9837,33268:9834,33269:8224,33270:8225,33271:182,33276:9711,33359:65296,33360:65297,33361:65298,33362:65299,33363:65300,33364:65301,33365:65302,33366:65303,33367:65304,33368:65305,33376:65313,33377:65314,33378:65315,33379:65316,33380:65317,33381:65318,33382:65319,33383:65320,33384:65321,33385:65322,33386:65323,33387:65324,33388:65325,33389:65326,33390:65327,33391:65328,33392:65329,33393:65330,33394:65331,33395:65332,33396:65333,33397:65334,33398:65335,33399:65336,33400:65337,33401:65338,33409:65345,33410:65346,33411:65347,33412:65348,33413:65349,33414:65350,33415:65351,33416:65352,33417:65353,33418:65354,33419:65355,33420:65356,33421:65357,33422:65358,33423:65359,33424:65360,33425:65361,33426:65362,33427:65363,33428:65364,33429:65365,33430:65366,33431:65367,33432:65368,33433:65369,33434:65370,33439:12353,33440:12354,33441:12355,33442:12356,33443:12357,33444:12358,33445:12359,33446:12360,33447:12361,33448:12362,33449:12363,33450:12364,33451:12365,33452:12366,33453:12367,33454:12368,33455:12369,33456:12370,33457:12371,33458:12372,33459:12373,33460:12374,33461:12375,33462:12376,33463:12377,33464:12378,33465:12379,33466:12380,33467:12381,33468:12382,33469:12383,33470:12384,33471:12385,33472:12386,33473:12387,33474:12388,33475:12389,33476:12390,33477:12391,33478:12392,33479:12393,33480:12394,33481:12395,33482:12396,33483:12397,33484:12398,33485:12399,33486:12400,33487:12401,33488:12402,33489:12403,33490:12404,33491:12405,33492:12406,33493:12407,33494:12408,33495:12409,33496:12410,33497:12411,33498:12412,33499:12413,33500:12414,33501:12415,33502:12416,33503:12417,33504:12418,33505:12419,33506:12420,33507:12421,33508:12422,33509:12423,33510:12424,33511:12425,33512:12426,33513:12427,33514:12428,33515:12429,33516:12430,33517:12431,33518:12432,33519:12433,33520:12434,33521:12435,33600:12449,33601:12450,33602:12451,33603:12452,33604:12453,33605:12454,33606:12455,33607:12456,33608:12457,33609:12458,33610:12459,33611:12460,33612:12461,33613:12462,33614:12463,33615:12464,33616:12465,33617:12466,33618:12467,33619:12468,33620:12469,33621:12470,33622:12471,33623:12472,33624:12473,33625:12474,33626:12475,33627:12476,33628:12477,33629:12478,33630:12479,33631:12480,33632:12481,33633:12482,33634:12483,33635:12484,33636:12485,33637:12486,33638:12487,33639:12488,33640:12489,33641:12490,33642:12491,33643:12492,33644:12493,33645:12494,33646:12495,33647:12496,33648:12497,33649:12498,33650:12499,33651:12500,33652:12501,33653:12502,33654:12503,33655:12504,33656:12505,33657:12506,33658:12507,33659:12508,33660:12509,33661:12510,33662:12511,33664:12512,33665:12513,33666:12514,33667:12515,33668:12516,33669:12517,33670:12518,33671:12519,33672:12520,33673:12521,33674:12522,33675:12523,33676:12524,33677:12525,33678:12526,33679:12527,33680:12528,33681:12529,33682:12530,33683:12531,33684:12532,33685:12533,33686:12534,33695:913,33696:914,33697:915,33698:916,33699:917,33700:918,33701:919,33702:920,33703:921,33704:922,33705:923,33706:924,33707:925,33708:926,33709:927,33710:928,33711:929,33712:931,33713:932,33714:933,33715:934,33716:935,33717:936,33718:937,33727:945,33728:946,33729:947,33730:948,33731:949,33732:950,33733:951,33734:952,33735:953,33736:954,33737:955,33738:956,33739:957,33740:958,33741:959,33742:960,33743:961,33744:963,33745:964,33746:965,33747:966,33748:967,33749:968,33750:969,33856:1040,33857:1041,33858:1042,33859:1043,33860:1044,33861:1045,33862:1025,33863:1046,33864:1047,33865:1048,33866:1049,33867:1050,33868:1051,33869:1052,33870:1053,33871:1054,33872:1055,33873:1056,33874:1057,33875:1058,33876:1059,33877:1060,33878:1061,33879:1062,33880:1063,33881:1064,33882:1065,33883:1066,33884:1067,33885:1068,33886:1069,33887:1070,33888:1071,33904:1072,33905:1073,33906:1074,33907:1075,33908:1076,33909:1077,33910:1105,33911:1078,33912:1079,33913:1080,33914:1081,33915:1082,33916:1083,33917:1084,33918:1085,33920:1086,33921:1087,33922:1088,33923:1089,33924:1090,33925:1091,33926:1092,33927:1093,33928:1094,33929:1095,33930:1096,33931:1097,33932:1098,33933:1099,33934:1100,33935:1101,33936:1102,33937:1103,33951:9472,33952:9474,33953:9484,33954:9488,33955:9496,33956:9492,33957:9500,33958:9516,33959:9508,33960:9524,33961:9532,33962:9473,33963:9475,33964:9487,33965:9491,33966:9499,33967:9495,33968:9507,33969:9523,33970:9515,33971:9531,33972:9547,33973:9504,33974:9519,33975:9512,33976:9527,33977:9535,33978:9501,33979:9520,33980:9509,33981:9528,33982:9538,34975:20124,34976:21782,34977:23043,34978:38463,34979:21696,34980:24859,34981:25384,34982:23030,34983:36898,34984:33909,34985:33564,34986:31312,34987:24746,34988:25569,34989:28197,34990:26093,34991:33894,34992:33446,34993:39925,34994:26771,34995:22311,34996:26017,34997:25201,34998:23451,34999:22992,35e3:34427,35001:39156,35002:32098,35003:32190,35004:39822,35005:25110,35006:31903,35007:34999,35008:23433,35009:24245,35010:25353,35011:26263,35012:26696,35013:38343,35014:38797,35015:26447,35016:20197,35017:20234,35018:20301,35019:20381,35020:20553,35021:22258,35022:22839,35023:22996,35024:23041,35025:23561,35026:24799,35027:24847,35028:24944,35029:26131,35030:26885,35031:28858,35032:30031,35033:30064,35034:31227,35035:32173,35036:32239,35037:32963,35038:33806,35039:34915,35040:35586,35041:36949,35042:36986,35043:21307,35044:20117,35045:20133,35046:22495,35047:32946,35048:37057,35049:30959,35050:19968,35051:22769,35052:28322,35053:36920,35054:31282,35055:33576,35056:33419,35057:39983,35058:20801,35059:21360,35060:21693,35061:21729,35062:22240,35063:23035,35064:24341,35065:39154,35066:28139,35067:32996,35068:34093,35136:38498,35137:38512,35138:38560,35139:38907,35140:21515,35141:21491,35142:23431,35143:28879,35144:32701,35145:36802,35146:38632,35147:21359,35148:40284,35149:31418,35150:19985,35151:30867,35152:33276,35153:28198,35154:22040,35155:21764,35156:27421,35157:34074,35158:39995,35159:23013,35160:21417,35161:28006,35162:29916,35163:38287,35164:22082,35165:20113,35166:36939,35167:38642,35168:33615,35169:39180,35170:21473,35171:21942,35172:23344,35173:24433,35174:26144,35175:26355,35176:26628,35177:27704,35178:27891,35179:27945,35180:29787,35181:30408,35182:31310,35183:38964,35184:33521,35185:34907,35186:35424,35187:37613,35188:28082,35189:30123,35190:30410,35191:39365,35192:24742,35193:35585,35194:36234,35195:38322,35196:27022,35197:21421,35198:20870,35200:22290,35201:22576,35202:22852,35203:23476,35204:24310,35205:24616,35206:25513,35207:25588,35208:27839,35209:28436,35210:28814,35211:28948,35212:29017,35213:29141,35214:29503,35215:32257,35216:33398,35217:33489,35218:34199,35219:36960,35220:37467,35221:40219,35222:22633,35223:26044,35224:27738,35225:29989,35226:20985,35227:22830,35228:22885,35229:24448,35230:24540,35231:25276,35232:26106,35233:27178,35234:27431,35235:27572,35236:29579,35237:32705,35238:35158,35239:40236,35240:40206,35241:40644,35242:23713,35243:27798,35244:33659,35245:20740,35246:23627,35247:25014,35248:33222,35249:26742,35250:29281,35251:20057,35252:20474,35253:21368,35254:24681,35255:28201,35256:31311,35257:38899,35258:19979,35259:21270,35260:20206,35261:20309,35262:20285,35263:20385,35264:20339,35265:21152,35266:21487,35267:22025,35268:22799,35269:23233,35270:23478,35271:23521,35272:31185,35273:26247,35274:26524,35275:26550,35276:27468,35277:27827,35278:28779,35279:29634,35280:31117,35281:31166,35282:31292,35283:31623,35284:33457,35285:33499,35286:33540,35287:33655,35288:33775,35289:33747,35290:34662,35291:35506,35292:22057,35293:36008,35294:36838,35295:36942,35296:38686,35297:34442,35298:20420,35299:23784,35300:25105,35301:29273,35302:30011,35303:33253,35304:33469,35305:34558,35306:36032,35307:38597,35308:39187,35309:39381,35310:20171,35311:20250,35312:35299,35313:22238,35314:22602,35315:22730,35316:24315,35317:24555,35318:24618,35319:24724,35320:24674,35321:25040,35322:25106,35323:25296,35324:25913,35392:39745,35393:26214,35394:26800,35395:28023,35396:28784,35397:30028,35398:30342,35399:32117,35400:33445,35401:34809,35402:38283,35403:38542,35404:35997,35405:20977,35406:21182,35407:22806,35408:21683,35409:23475,35410:23830,35411:24936,35412:27010,35413:28079,35414:30861,35415:33995,35416:34903,35417:35442,35418:37799,35419:39608,35420:28012,35421:39336,35422:34521,35423:22435,35424:26623,35425:34510,35426:37390,35427:21123,35428:22151,35429:21508,35430:24275,35431:25313,35432:25785,35433:26684,35434:26680,35435:27579,35436:29554,35437:30906,35438:31339,35439:35226,35440:35282,35441:36203,35442:36611,35443:37101,35444:38307,35445:38548,35446:38761,35447:23398,35448:23731,35449:27005,35450:38989,35451:38990,35452:25499,35453:31520,35454:27179,35456:27263,35457:26806,35458:39949,35459:28511,35460:21106,35461:21917,35462:24688,35463:25324,35464:27963,35465:28167,35466:28369,35467:33883,35468:35088,35469:36676,35470:19988,35471:39993,35472:21494,35473:26907,35474:27194,35475:38788,35476:26666,35477:20828,35478:31427,35479:33970,35480:37340,35481:37772,35482:22107,35483:40232,35484:26658,35485:33541,35486:33841,35487:31909,35488:21e3,35489:33477,35490:29926,35491:20094,35492:20355,35493:20896,35494:23506,35495:21002,35496:21208,35497:21223,35498:24059,35499:21914,35500:22570,35501:23014,35502:23436,35503:23448,35504:23515,35505:24178,35506:24185,35507:24739,35508:24863,35509:24931,35510:25022,35511:25563,35512:25954,35513:26577,35514:26707,35515:26874,35516:27454,35517:27475,35518:27735,35519:28450,35520:28567,35521:28485,35522:29872,35523:29976,35524:30435,35525:30475,35526:31487,35527:31649,35528:31777,35529:32233,35530:32566,35531:32752,35532:32925,35533:33382,35534:33694,35535:35251,35536:35532,35537:36011,35538:36996,35539:37969,35540:38291,35541:38289,35542:38306,35543:38501,35544:38867,35545:39208,35546:33304,35547:20024,35548:21547,35549:23736,35550:24012,35551:29609,35552:30284,35553:30524,35554:23721,35555:32747,35556:36107,35557:38593,35558:38929,35559:38996,35560:39e3,35561:20225,35562:20238,35563:21361,35564:21916,35565:22120,35566:22522,35567:22855,35568:23305,35569:23492,35570:23696,35571:24076,35572:24190,35573:24524,35574:25582,35575:26426,35576:26071,35577:26082,35578:26399,35579:26827,35580:26820,35648:27231,35649:24112,35650:27589,35651:27671,35652:27773,35653:30079,35654:31048,35655:23395,35656:31232,35657:32e3,35658:24509,35659:35215,35660:35352,35661:36020,35662:36215,35663:36556,35664:36637,35665:39138,35666:39438,35667:39740,35668:20096,35669:20605,35670:20736,35671:22931,35672:23452,35673:25135,35674:25216,35675:25836,35676:27450,35677:29344,35678:30097,35679:31047,35680:32681,35681:34811,35682:35516,35683:35696,35684:25516,35685:33738,35686:38816,35687:21513,35688:21507,35689:21931,35690:26708,35691:27224,35692:35440,35693:30759,35694:26485,35695:40653,35696:21364,35697:23458,35698:33050,35699:34384,35700:36870,35701:19992,35702:20037,35703:20167,35704:20241,35705:21450,35706:21560,35707:23470,35708:24339,35709:24613,35710:25937,35712:26429,35713:27714,35714:27762,35715:27875,35716:28792,35717:29699,35718:31350,35719:31406,35720:31496,35721:32026,35722:31998,35723:32102,35724:26087,35725:29275,35726:21435,35727:23621,35728:24040,35729:25298,35730:25312,35731:25369,35732:28192,35733:34394,35734:35377,35735:36317,35736:37624,35737:28417,35738:31142,35739:39770,35740:20136,35741:20139,35742:20140,35743:20379,35744:20384,35745:20689,35746:20807,35747:31478,35748:20849,35749:20982,35750:21332,35751:21281,35752:21375,35753:21483,35754:21932,35755:22659,35756:23777,35757:24375,35758:24394,35759:24623,35760:24656,35761:24685,35762:25375,35763:25945,35764:27211,35765:27841,35766:29378,35767:29421,35768:30703,35769:33016,35770:33029,35771:33288,35772:34126,35773:37111,35774:37857,35775:38911,35776:39255,35777:39514,35778:20208,35779:20957,35780:23597,35781:26241,35782:26989,35783:23616,35784:26354,35785:26997,35786:29577,35787:26704,35788:31873,35789:20677,35790:21220,35791:22343,35792:24062,35793:37670,35794:26020,35795:27427,35796:27453,35797:29748,35798:31105,35799:31165,35800:31563,35801:32202,35802:33465,35803:33740,35804:34943,35805:35167,35806:35641,35807:36817,35808:37329,35809:21535,35810:37504,35811:20061,35812:20534,35813:21477,35814:21306,35815:29399,35816:29590,35817:30697,35818:33510,35819:36527,35820:39366,35821:39368,35822:39378,35823:20855,35824:24858,35825:34398,35826:21936,35827:31354,35828:20598,35829:23507,35830:36935,35831:38533,35832:20018,35833:27355,35834:37351,35835:23633,35836:23624,35904:25496,35905:31391,35906:27795,35907:38772,35908:36705,35909:31402,35910:29066,35911:38536,35912:31874,35913:26647,35914:32368,35915:26705,35916:37740,35917:21234,35918:21531,35919:34219,35920:35347,35921:32676,35922:36557,35923:37089,35924:21350,35925:34952,35926:31041,35927:20418,35928:20670,35929:21009,35930:20804,35931:21843,35932:22317,35933:29674,35934:22411,35935:22865,35936:24418,35937:24452,35938:24693,35939:24950,35940:24935,35941:25001,35942:25522,35943:25658,35944:25964,35945:26223,35946:26690,35947:28179,35948:30054,35949:31293,35950:31995,35951:32076,35952:32153,35953:32331,35954:32619,35955:33550,35956:33610,35957:34509,35958:35336,35959:35427,35960:35686,35961:36605,35962:38938,35963:40335,35964:33464,35965:36814,35966:39912,35968:21127,35969:25119,35970:25731,35971:28608,35972:38553,35973:26689,35974:20625,35975:27424,35976:27770,35977:28500,35978:31348,35979:32080,35980:34880,35981:35363,35982:26376,35983:20214,35984:20537,35985:20518,35986:20581,35987:20860,35988:21048,35989:21091,35990:21927,35991:22287,35992:22533,35993:23244,35994:24314,35995:25010,35996:25080,35997:25331,35998:25458,35999:26908,36e3:27177,36001:29309,36002:29356,36003:29486,36004:30740,36005:30831,36006:32121,36007:30476,36008:32937,36009:35211,36010:35609,36011:36066,36012:36562,36013:36963,36014:37749,36015:38522,36016:38997,36017:39443,36018:40568,36019:20803,36020:21407,36021:21427,36022:24187,36023:24358,36024:28187,36025:28304,36026:29572,36027:29694,36028:32067,36029:33335,36030:35328,36031:35578,36032:38480,36033:20046,36034:20491,36035:21476,36036:21628,36037:22266,36038:22993,36039:23396,36040:24049,36041:24235,36042:24359,36043:25144,36044:25925,36045:26543,36046:28246,36047:29392,36048:31946,36049:34996,36050:32929,36051:32993,36052:33776,36053:34382,36054:35463,36055:36328,36056:37431,36057:38599,36058:39015,36059:40723,36060:20116,36061:20114,36062:20237,36063:21320,36064:21577,36065:21566,36066:23087,36067:24460,36068:24481,36069:24735,36070:26791,36071:27278,36072:29786,36073:30849,36074:35486,36075:35492,36076:35703,36077:37264,36078:20062,36079:39881,36080:20132,36081:20348,36082:20399,36083:20505,36084:20502,36085:20809,36086:20844,36087:21151,36088:21177,36089:21246,36090:21402,36091:21475,36092:21521,36160:21518,36161:21897,36162:22353,36163:22434,36164:22909,36165:23380,36166:23389,36167:23439,36168:24037,36169:24039,36170:24055,36171:24184,36172:24195,36173:24218,36174:24247,36175:24344,36176:24658,36177:24908,36178:25239,36179:25304,36180:25511,36181:25915,36182:26114,36183:26179,36184:26356,36185:26477,36186:26657,36187:26775,36188:27083,36189:27743,36190:27946,36191:28009,36192:28207,36193:28317,36194:30002,36195:30343,36196:30828,36197:31295,36198:31968,36199:32005,36200:32024,36201:32094,36202:32177,36203:32789,36204:32771,36205:32943,36206:32945,36207:33108,36208:33167,36209:33322,36210:33618,36211:34892,36212:34913,36213:35611,36214:36002,36215:36092,36216:37066,36217:37237,36218:37489,36219:30783,36220:37628,36221:38308,36222:38477,36224:38917,36225:39321,36226:39640,36227:40251,36228:21083,36229:21163,36230:21495,36231:21512,36232:22741,36233:25335,36234:28640,36235:35946,36236:36703,36237:40633,36238:20811,36239:21051,36240:21578,36241:22269,36242:31296,36243:37239,36244:40288,36245:40658,36246:29508,36247:28425,36248:33136,36249:29969,36250:24573,36251:24794,36252:39592,36253:29403,36254:36796,36255:27492,36256:38915,36257:20170,36258:22256,36259:22372,36260:22718,36261:23130,36262:24680,36263:25031,36264:26127,36265:26118,36266:26681,36267:26801,36268:28151,36269:30165,36270:32058,36271:33390,36272:39746,36273:20123,36274:20304,36275:21449,36276:21766,36277:23919,36278:24038,36279:24046,36280:26619,36281:27801,36282:29811,36283:30722,36284:35408,36285:37782,36286:35039,36287:22352,36288:24231,36289:25387,36290:20661,36291:20652,36292:20877,36293:26368,36294:21705,36295:22622,36296:22971,36297:23472,36298:24425,36299:25165,36300:25505,36301:26685,36302:27507,36303:28168,36304:28797,36305:37319,36306:29312,36307:30741,36308:30758,36309:31085,36310:25998,36311:32048,36312:33756,36313:35009,36314:36617,36315:38555,36316:21092,36317:22312,36318:26448,36319:32618,36320:36001,36321:20916,36322:22338,36323:38442,36324:22586,36325:27018,36326:32948,36327:21682,36328:23822,36329:22524,36330:30869,36331:40442,36332:20316,36333:21066,36334:21643,36335:25662,36336:26152,36337:26388,36338:26613,36339:31364,36340:31574,36341:32034,36342:37679,36343:26716,36344:39853,36345:31545,36346:21273,36347:20874,36348:21047,36416:23519,36417:25334,36418:25774,36419:25830,36420:26413,36421:27578,36422:34217,36423:38609,36424:30352,36425:39894,36426:25420,36427:37638,36428:39851,36429:30399,36430:26194,36431:19977,36432:20632,36433:21442,36434:23665,36435:24808,36436:25746,36437:25955,36438:26719,36439:29158,36440:29642,36441:29987,36442:31639,36443:32386,36444:34453,36445:35715,36446:36059,36447:37240,36448:39184,36449:26028,36450:26283,36451:27531,36452:20181,36453:20180,36454:20282,36455:20351,36456:21050,36457:21496,36458:21490,36459:21987,36460:22235,36461:22763,36462:22987,36463:22985,36464:23039,36465:23376,36466:23629,36467:24066,36468:24107,36469:24535,36470:24605,36471:25351,36472:25903,36473:23388,36474:26031,36475:26045,36476:26088,36477:26525,36478:27490,36480:27515,36481:27663,36482:29509,36483:31049,36484:31169,36485:31992,36486:32025,36487:32043,36488:32930,36489:33026,36490:33267,36491:35222,36492:35422,36493:35433,36494:35430,36495:35468,36496:35566,36497:36039,36498:36060,36499:38604,36500:39164,36501:27503,36502:20107,36503:20284,36504:20365,36505:20816,36506:23383,36507:23546,36508:24904,36509:25345,36510:26178,36511:27425,36512:28363,36513:27835,36514:29246,36515:29885,36516:30164,36517:30913,36518:31034,36519:32780,36520:32819,36521:33258,36522:33940,36523:36766,36524:27728,36525:40575,36526:24335,36527:35672,36528:40235,36529:31482,36530:36600,36531:23437,36532:38635,36533:19971,36534:21489,36535:22519,36536:22833,36537:23241,36538:23460,36539:24713,36540:28287,36541:28422,36542:30142,36543:36074,36544:23455,36545:34048,36546:31712,36547:20594,36548:26612,36549:33437,36550:23649,36551:34122,36552:32286,36553:33294,36554:20889,36555:23556,36556:25448,36557:36198,36558:26012,36559:29038,36560:31038,36561:32023,36562:32773,36563:35613,36564:36554,36565:36974,36566:34503,36567:37034,36568:20511,36569:21242,36570:23610,36571:26451,36572:28796,36573:29237,36574:37196,36575:37320,36576:37675,36577:33509,36578:23490,36579:24369,36580:24825,36581:20027,36582:21462,36583:23432,36584:25163,36585:26417,36586:27530,36587:29417,36588:29664,36589:31278,36590:33131,36591:36259,36592:37202,36593:39318,36594:20754,36595:21463,36596:21610,36597:23551,36598:25480,36599:27193,36600:32172,36601:38656,36602:22234,36603:21454,36604:21608,36672:23447,36673:23601,36674:24030,36675:20462,36676:24833,36677:25342,36678:27954,36679:31168,36680:31179,36681:32066,36682:32333,36683:32722,36684:33261,36685:33311,36686:33936,36687:34886,36688:35186,36689:35728,36690:36468,36691:36655,36692:36913,36693:37195,36694:37228,36695:38598,36696:37276,36697:20160,36698:20303,36699:20805,36700:21313,36701:24467,36702:25102,36703:26580,36704:27713,36705:28171,36706:29539,36707:32294,36708:37325,36709:37507,36710:21460,36711:22809,36712:23487,36713:28113,36714:31069,36715:32302,36716:31899,36717:22654,36718:29087,36719:20986,36720:34899,36721:36848,36722:20426,36723:23803,36724:26149,36725:30636,36726:31459,36727:33308,36728:39423,36729:20934,36730:24490,36731:26092,36732:26991,36733:27529,36734:28147,36736:28310,36737:28516,36738:30462,36739:32020,36740:24033,36741:36981,36742:37255,36743:38918,36744:20966,36745:21021,36746:25152,36747:26257,36748:26329,36749:28186,36750:24246,36751:32210,36752:32626,36753:26360,36754:34223,36755:34295,36756:35576,36757:21161,36758:21465,36759:22899,36760:24207,36761:24464,36762:24661,36763:37604,36764:38500,36765:20663,36766:20767,36767:21213,36768:21280,36769:21319,36770:21484,36771:21736,36772:21830,36773:21809,36774:22039,36775:22888,36776:22974,36777:23100,36778:23477,36779:23558,36780:23567,36781:23569,36782:23578,36783:24196,36784:24202,36785:24288,36786:24432,36787:25215,36788:25220,36789:25307,36790:25484,36791:25463,36792:26119,36793:26124,36794:26157,36795:26230,36796:26494,36797:26786,36798:27167,36799:27189,36800:27836,36801:28040,36802:28169,36803:28248,36804:28988,36805:28966,36806:29031,36807:30151,36808:30465,36809:30813,36810:30977,36811:31077,36812:31216,36813:31456,36814:31505,36815:31911,36816:32057,36817:32918,36818:33750,36819:33931,36820:34121,36821:34909,36822:35059,36823:35359,36824:35388,36825:35412,36826:35443,36827:35937,36828:36062,36829:37284,36830:37478,36831:37758,36832:37912,36833:38556,36834:38808,36835:19978,36836:19976,36837:19998,36838:20055,36839:20887,36840:21104,36841:22478,36842:22580,36843:22732,36844:23330,36845:24120,36846:24773,36847:25854,36848:26465,36849:26454,36850:27972,36851:29366,36852:30067,36853:31331,36854:33976,36855:35698,36856:37304,36857:37664,36858:22065,36859:22516,36860:39166,36928:25325,36929:26893,36930:27542,36931:29165,36932:32340,36933:32887,36934:33394,36935:35302,36936:39135,36937:34645,36938:36785,36939:23611,36940:20280,36941:20449,36942:20405,36943:21767,36944:23072,36945:23517,36946:23529,36947:24515,36948:24910,36949:25391,36950:26032,36951:26187,36952:26862,36953:27035,36954:28024,36955:28145,36956:30003,36957:30137,36958:30495,36959:31070,36960:31206,36961:32051,36962:33251,36963:33455,36964:34218,36965:35242,36966:35386,36967:36523,36968:36763,36969:36914,36970:37341,36971:38663,36972:20154,36973:20161,36974:20995,36975:22645,36976:22764,36977:23563,36978:29978,36979:23613,36980:33102,36981:35338,36982:36805,36983:38499,36984:38765,36985:31525,36986:35535,36987:38920,36988:37218,36989:22259,36990:21416,36992:36887,36993:21561,36994:22402,36995:24101,36996:25512,36997:27700,36998:28810,36999:30561,37e3:31883,37001:32736,37002:34928,37003:36930,37004:37204,37005:37648,37006:37656,37007:38543,37008:29790,37009:39620,37010:23815,37011:23913,37012:25968,37013:26530,37014:36264,37015:38619,37016:25454,37017:26441,37018:26905,37019:33733,37020:38935,37021:38592,37022:35070,37023:28548,37024:25722,37025:23544,37026:19990,37027:28716,37028:30045,37029:26159,37030:20932,37031:21046,37032:21218,37033:22995,37034:24449,37035:24615,37036:25104,37037:25919,37038:25972,37039:26143,37040:26228,37041:26866,37042:26646,37043:27491,37044:28165,37045:29298,37046:29983,37047:30427,37048:31934,37049:32854,37050:22768,37051:35069,37052:35199,37053:35488,37054:35475,37055:35531,37056:36893,37057:37266,37058:38738,37059:38745,37060:25993,37061:31246,37062:33030,37063:38587,37064:24109,37065:24796,37066:25114,37067:26021,37068:26132,37069:26512,37070:30707,37071:31309,37072:31821,37073:32318,37074:33034,37075:36012,37076:36196,37077:36321,37078:36447,37079:30889,37080:20999,37081:25305,37082:25509,37083:25666,37084:25240,37085:35373,37086:31363,37087:31680,37088:35500,37089:38634,37090:32118,37091:33292,37092:34633,37093:20185,37094:20808,37095:21315,37096:21344,37097:23459,37098:23554,37099:23574,37100:24029,37101:25126,37102:25159,37103:25776,37104:26643,37105:26676,37106:27849,37107:27973,37108:27927,37109:26579,37110:28508,37111:29006,37112:29053,37113:26059,37114:31359,37115:31661,37116:32218,37184:32330,37185:32680,37186:33146,37187:33307,37188:33337,37189:34214,37190:35438,37191:36046,37192:36341,37193:36984,37194:36983,37195:37549,37196:37521,37197:38275,37198:39854,37199:21069,37200:21892,37201:28472,37202:28982,37203:20840,37204:31109,37205:32341,37206:33203,37207:31950,37208:22092,37209:22609,37210:23720,37211:25514,37212:26366,37213:26365,37214:26970,37215:29401,37216:30095,37217:30094,37218:30990,37219:31062,37220:31199,37221:31895,37222:32032,37223:32068,37224:34311,37225:35380,37226:38459,37227:36961,37228:40736,37229:20711,37230:21109,37231:21452,37232:21474,37233:20489,37234:21930,37235:22766,37236:22863,37237:29245,37238:23435,37239:23652,37240:21277,37241:24803,37242:24819,37243:25436,37244:25475,37245:25407,37246:25531,37248:25805,37249:26089,37250:26361,37251:24035,37252:27085,37253:27133,37254:28437,37255:29157,37256:20105,37257:30185,37258:30456,37259:31379,37260:31967,37261:32207,37262:32156,37263:32865,37264:33609,37265:33624,37266:33900,37267:33980,37268:34299,37269:35013,37270:36208,37271:36865,37272:36973,37273:37783,37274:38684,37275:39442,37276:20687,37277:22679,37278:24974,37279:33235,37280:34101,37281:36104,37282:36896,37283:20419,37284:20596,37285:21063,37286:21363,37287:24687,37288:25417,37289:26463,37290:28204,37291:36275,37292:36895,37293:20439,37294:23646,37295:36042,37296:26063,37297:32154,37298:21330,37299:34966,37300:20854,37301:25539,37302:23384,37303:23403,37304:23562,37305:25613,37306:26449,37307:36956,37308:20182,37309:22810,37310:22826,37311:27760,37312:35409,37313:21822,37314:22549,37315:22949,37316:24816,37317:25171,37318:26561,37319:33333,37320:26965,37321:38464,37322:39364,37323:39464,37324:20307,37325:22534,37326:23550,37327:32784,37328:23729,37329:24111,37330:24453,37331:24608,37332:24907,37333:25140,37334:26367,37335:27888,37336:28382,37337:32974,37338:33151,37339:33492,37340:34955,37341:36024,37342:36864,37343:36910,37344:38538,37345:40667,37346:39899,37347:20195,37348:21488,37349:22823,37350:31532,37351:37261,37352:38988,37353:40441,37354:28381,37355:28711,37356:21331,37357:21828,37358:23429,37359:25176,37360:25246,37361:25299,37362:27810,37363:28655,37364:29730,37365:35351,37366:37944,37367:28609,37368:35582,37369:33592,37370:20967,37371:34552,37372:21482,37440:21481,37441:20294,37442:36948,37443:36784,37444:22890,37445:33073,37446:24061,37447:31466,37448:36799,37449:26842,37450:35895,37451:29432,37452:40008,37453:27197,37454:35504,37455:20025,37456:21336,37457:22022,37458:22374,37459:25285,37460:25506,37461:26086,37462:27470,37463:28129,37464:28251,37465:28845,37466:30701,37467:31471,37468:31658,37469:32187,37470:32829,37471:32966,37472:34507,37473:35477,37474:37723,37475:22243,37476:22727,37477:24382,37478:26029,37479:26262,37480:27264,37481:27573,37482:30007,37483:35527,37484:20516,37485:30693,37486:22320,37487:24347,37488:24677,37489:26234,37490:27744,37491:30196,37492:31258,37493:32622,37494:33268,37495:34584,37496:36933,37497:39347,37498:31689,37499:30044,37500:31481,37501:31569,37502:33988,37504:36880,37505:31209,37506:31378,37507:33590,37508:23265,37509:30528,37510:20013,37511:20210,37512:23449,37513:24544,37514:25277,37515:26172,37516:26609,37517:27880,37518:34411,37519:34935,37520:35387,37521:37198,37522:37619,37523:39376,37524:27159,37525:28710,37526:29482,37527:33511,37528:33879,37529:36015,37530:19969,37531:20806,37532:20939,37533:21899,37534:23541,37535:24086,37536:24115,37537:24193,37538:24340,37539:24373,37540:24427,37541:24500,37542:25074,37543:25361,37544:26274,37545:26397,37546:28526,37547:29266,37548:30010,37549:30522,37550:32884,37551:33081,37552:33144,37553:34678,37554:35519,37555:35548,37556:36229,37557:36339,37558:37530,37559:38263,37560:38914,37561:40165,37562:21189,37563:25431,37564:30452,37565:26389,37566:27784,37567:29645,37568:36035,37569:37806,37570:38515,37571:27941,37572:22684,37573:26894,37574:27084,37575:36861,37576:37786,37577:30171,37578:36890,37579:22618,37580:26626,37581:25524,37582:27131,37583:20291,37584:28460,37585:26584,37586:36795,37587:34086,37588:32180,37589:37716,37590:26943,37591:28528,37592:22378,37593:22775,37594:23340,37595:32044,37596:29226,37597:21514,37598:37347,37599:40372,37600:20141,37601:20302,37602:20572,37603:20597,37604:21059,37605:35998,37606:21576,37607:22564,37608:23450,37609:24093,37610:24213,37611:24237,37612:24311,37613:24351,37614:24716,37615:25269,37616:25402,37617:25552,37618:26799,37619:27712,37620:30855,37621:31118,37622:31243,37623:32224,37624:33351,37625:35330,37626:35558,37627:36420,37628:36883,37696:37048,37697:37165,37698:37336,37699:40718,37700:27877,37701:25688,37702:25826,37703:25973,37704:28404,37705:30340,37706:31515,37707:36969,37708:37841,37709:28346,37710:21746,37711:24505,37712:25764,37713:36685,37714:36845,37715:37444,37716:20856,37717:22635,37718:22825,37719:23637,37720:24215,37721:28155,37722:32399,37723:29980,37724:36028,37725:36578,37726:39003,37727:28857,37728:20253,37729:27583,37730:28593,37731:3e4,37732:38651,37733:20814,37734:21520,37735:22581,37736:22615,37737:22956,37738:23648,37739:24466,37740:26007,37741:26460,37742:28193,37743:30331,37744:33759,37745:36077,37746:36884,37747:37117,37748:37709,37749:30757,37750:30778,37751:21162,37752:24230,37753:22303,37754:22900,37755:24594,37756:20498,37757:20826,37758:20908,37760:20941,37761:20992,37762:21776,37763:22612,37764:22616,37765:22871,37766:23445,37767:23798,37768:23947,37769:24764,37770:25237,37771:25645,37772:26481,37773:26691,37774:26812,37775:26847,37776:30423,37777:28120,37778:28271,37779:28059,37780:28783,37781:29128,37782:24403,37783:30168,37784:31095,37785:31561,37786:31572,37787:31570,37788:31958,37789:32113,37790:21040,37791:33891,37792:34153,37793:34276,37794:35342,37795:35588,37796:35910,37797:36367,37798:36867,37799:36879,37800:37913,37801:38518,37802:38957,37803:39472,37804:38360,37805:20685,37806:21205,37807:21516,37808:22530,37809:23566,37810:24999,37811:25758,37812:27934,37813:30643,37814:31461,37815:33012,37816:33796,37817:36947,37818:37509,37819:23776,37820:40199,37821:21311,37822:24471,37823:24499,37824:28060,37825:29305,37826:30563,37827:31167,37828:31716,37829:27602,37830:29420,37831:35501,37832:26627,37833:27233,37834:20984,37835:31361,37836:26932,37837:23626,37838:40182,37839:33515,37840:23493,37841:37193,37842:28702,37843:22136,37844:23663,37845:24775,37846:25958,37847:27788,37848:35930,37849:36929,37850:38931,37851:21585,37852:26311,37853:37389,37854:22856,37855:37027,37856:20869,37857:20045,37858:20970,37859:34201,37860:35598,37861:28760,37862:25466,37863:37707,37864:26978,37865:39348,37866:32260,37867:30071,37868:21335,37869:26976,37870:36575,37871:38627,37872:27741,37873:20108,37874:23612,37875:24336,37876:36841,37877:21250,37878:36049,37879:32905,37880:34425,37881:24319,37882:26085,37883:20083,37884:20837,37952:22914,37953:23615,37954:38894,37955:20219,37956:22922,37957:24525,37958:35469,37959:28641,37960:31152,37961:31074,37962:23527,37963:33905,37964:29483,37965:29105,37966:24180,37967:24565,37968:25467,37969:25754,37970:29123,37971:31896,37972:20035,37973:24316,37974:20043,37975:22492,37976:22178,37977:24745,37978:28611,37979:32013,37980:33021,37981:33075,37982:33215,37983:36786,37984:35223,37985:34468,37986:24052,37987:25226,37988:25773,37989:35207,37990:26487,37991:27874,37992:27966,37993:29750,37994:30772,37995:23110,37996:32629,37997:33453,37998:39340,37999:20467,38e3:24259,38001:25309,38002:25490,38003:25943,38004:26479,38005:30403,38006:29260,38007:32972,38008:32954,38009:36649,38010:37197,38011:20493,38012:22521,38013:23186,38014:26757,38016:26995,38017:29028,38018:29437,38019:36023,38020:22770,38021:36064,38022:38506,38023:36889,38024:34687,38025:31204,38026:30695,38027:33833,38028:20271,38029:21093,38030:21338,38031:25293,38032:26575,38033:27850,38034:30333,38035:31636,38036:31893,38037:33334,38038:34180,38039:36843,38040:26333,38041:28448,38042:29190,38043:32283,38044:33707,38045:39361,38046:40614,38047:20989,38048:31665,38049:30834,38050:31672,38051:32903,38052:31560,38053:27368,38054:24161,38055:32908,38056:30033,38057:30048,38058:20843,38059:37474,38060:28300,38061:30330,38062:37271,38063:39658,38064:20240,38065:32624,38066:25244,38067:31567,38068:38309,38069:40169,38070:22138,38071:22617,38072:34532,38073:38588,38074:20276,38075:21028,38076:21322,38077:21453,38078:21467,38079:24070,38080:25644,38081:26001,38082:26495,38083:27710,38084:27726,38085:29256,38086:29359,38087:29677,38088:30036,38089:32321,38090:33324,38091:34281,38092:36009,38093:31684,38094:37318,38095:29033,38096:38930,38097:39151,38098:25405,38099:26217,38100:30058,38101:30436,38102:30928,38103:34115,38104:34542,38105:21290,38106:21329,38107:21542,38108:22915,38109:24199,38110:24444,38111:24754,38112:25161,38113:25209,38114:25259,38115:26e3,38116:27604,38117:27852,38118:30130,38119:30382,38120:30865,38121:31192,38122:32203,38123:32631,38124:32933,38125:34987,38126:35513,38127:36027,38128:36991,38129:38750,38130:39131,38131:27147,38132:31800,38133:20633,38134:23614,38135:24494,38136:26503,38137:27608,38138:29749,38139:30473,38140:32654,38208:40763,38209:26570,38210:31255,38211:21305,38212:30091,38213:39661,38214:24422,38215:33181,38216:33777,38217:32920,38218:24380,38219:24517,38220:30050,38221:31558,38222:36924,38223:26727,38224:23019,38225:23195,38226:32016,38227:30334,38228:35628,38229:20469,38230:24426,38231:27161,38232:27703,38233:28418,38234:29922,38235:31080,38236:34920,38237:35413,38238:35961,38239:24287,38240:25551,38241:30149,38242:31186,38243:33495,38244:37672,38245:37618,38246:33948,38247:34541,38248:39981,38249:21697,38250:24428,38251:25996,38252:27996,38253:28693,38254:36007,38255:36051,38256:38971,38257:25935,38258:29942,38259:19981,38260:20184,38261:22496,38262:22827,38263:23142,38264:23500,38265:20904,38266:24067,38267:24220,38268:24598,38269:25206,38270:25975,38272:26023,38273:26222,38274:28014,38275:29238,38276:31526,38277:33104,38278:33178,38279:33433,38280:35676,38281:36e3,38282:36070,38283:36212,38284:38428,38285:38468,38286:20398,38287:25771,38288:27494,38289:33310,38290:33889,38291:34154,38292:37096,38293:23553,38294:26963,38295:39080,38296:33914,38297:34135,38298:20239,38299:21103,38300:24489,38301:24133,38302:26381,38303:31119,38304:33145,38305:35079,38306:35206,38307:28149,38308:24343,38309:25173,38310:27832,38311:20175,38312:29289,38313:39826,38314:20998,38315:21563,38316:22132,38317:22707,38318:24996,38319:25198,38320:28954,38321:22894,38322:31881,38323:31966,38324:32027,38325:38640,38326:25991,38327:32862,38328:19993,38329:20341,38330:20853,38331:22592,38332:24163,38333:24179,38334:24330,38335:26564,38336:20006,38337:34109,38338:38281,38339:38491,38340:31859,38341:38913,38342:20731,38343:22721,38344:30294,38345:30887,38346:21029,38347:30629,38348:34065,38349:31622,38350:20559,38351:22793,38352:29255,38353:31687,38354:32232,38355:36794,38356:36820,38357:36941,38358:20415,38359:21193,38360:23081,38361:24321,38362:38829,38363:20445,38364:33303,38365:37610,38366:22275,38367:25429,38368:27497,38369:29995,38370:35036,38371:36628,38372:31298,38373:21215,38374:22675,38375:24917,38376:25098,38377:26286,38378:27597,38379:31807,38380:33769,38381:20515,38382:20472,38383:21253,38384:21574,38385:22577,38386:22857,38387:23453,38388:23792,38389:23791,38390:23849,38391:24214,38392:25265,38393:25447,38394:25918,38395:26041,38396:26379,38464:27861,38465:27873,38466:28921,38467:30770,38468:32299,38469:32990,38470:33459,38471:33804,38472:34028,38473:34562,38474:35090,38475:35370,38476:35914,38477:37030,38478:37586,38479:39165,38480:40179,38481:40300,38482:20047,38483:20129,38484:20621,38485:21078,38486:22346,38487:22952,38488:24125,38489:24536,38490:24537,38491:25151,38492:26292,38493:26395,38494:26576,38495:26834,38496:20882,38497:32033,38498:32938,38499:33192,38500:35584,38501:35980,38502:36031,38503:37502,38504:38450,38505:21536,38506:38956,38507:21271,38508:20693,38509:21340,38510:22696,38511:25778,38512:26420,38513:29287,38514:30566,38515:31302,38516:37350,38517:21187,38518:27809,38519:27526,38520:22528,38521:24140,38522:22868,38523:26412,38524:32763,38525:20961,38526:30406,38528:25705,38529:30952,38530:39764,38531:40635,38532:22475,38533:22969,38534:26151,38535:26522,38536:27598,38537:21737,38538:27097,38539:24149,38540:33180,38541:26517,38542:39850,38543:26622,38544:40018,38545:26717,38546:20134,38547:20451,38548:21448,38549:25273,38550:26411,38551:27819,38552:36804,38553:20397,38554:32365,38555:40639,38556:19975,38557:24930,38558:28288,38559:28459,38560:34067,38561:21619,38562:26410,38563:39749,38564:24051,38565:31637,38566:23724,38567:23494,38568:34588,38569:28234,38570:34001,38571:31252,38572:33032,38573:22937,38574:31885,38575:27665,38576:30496,38577:21209,38578:22818,38579:28961,38580:29279,38581:30683,38582:38695,38583:40289,38584:26891,38585:23167,38586:23064,38587:20901,38588:21517,38589:21629,38590:26126,38591:30431,38592:36855,38593:37528,38594:40180,38595:23018,38596:29277,38597:28357,38598:20813,38599:26825,38600:32191,38601:32236,38602:38754,38603:40634,38604:25720,38605:27169,38606:33538,38607:22916,38608:23391,38609:27611,38610:29467,38611:30450,38612:32178,38613:32791,38614:33945,38615:20786,38616:26408,38617:40665,38618:30446,38619:26466,38620:21247,38621:39173,38622:23588,38623:25147,38624:31870,38625:36016,38626:21839,38627:24758,38628:32011,38629:38272,38630:21249,38631:20063,38632:20918,38633:22812,38634:29242,38635:32822,38636:37326,38637:24357,38638:30690,38639:21380,38640:24441,38641:32004,38642:34220,38643:35379,38644:36493,38645:38742,38646:26611,38647:34222,38648:37971,38649:24841,38650:24840,38651:27833,38652:30290,38720:35565,38721:36664,38722:21807,38723:20305,38724:20778,38725:21191,38726:21451,38727:23461,38728:24189,38729:24736,38730:24962,38731:25558,38732:26377,38733:26586,38734:28263,38735:28044,38736:29494,38737:29495,38738:30001,38739:31056,38740:35029,38741:35480,38742:36938,38743:37009,38744:37109,38745:38596,38746:34701,38747:22805,38748:20104,38749:20313,38750:19982,38751:35465,38752:36671,38753:38928,38754:20653,38755:24188,38756:22934,38757:23481,38758:24248,38759:25562,38760:25594,38761:25793,38762:26332,38763:26954,38764:27096,38765:27915,38766:28342,38767:29076,38768:29992,38769:31407,38770:32650,38771:32768,38772:33865,38773:33993,38774:35201,38775:35617,38776:36362,38777:36965,38778:38525,38779:39178,38780:24958,38781:25233,38782:27442,38784:27779,38785:28020,38786:32716,38787:32764,38788:28096,38789:32645,38790:34746,38791:35064,38792:26469,38793:33713,38794:38972,38795:38647,38796:27931,38797:32097,38798:33853,38799:37226,38800:20081,38801:21365,38802:23888,38803:27396,38804:28651,38805:34253,38806:34349,38807:35239,38808:21033,38809:21519,38810:23653,38811:26446,38812:26792,38813:29702,38814:29827,38815:30178,38816:35023,38817:35041,38818:37324,38819:38626,38820:38520,38821:24459,38822:29575,38823:31435,38824:33870,38825:25504,38826:30053,38827:21129,38828:27969,38829:28316,38830:29705,38831:30041,38832:30827,38833:31890,38834:38534,38835:31452,38836:40845,38837:20406,38838:24942,38839:26053,38840:34396,38841:20102,38842:20142,38843:20698,38844:20001,38845:20940,38846:23534,38847:26009,38848:26753,38849:28092,38850:29471,38851:30274,38852:30637,38853:31260,38854:31975,38855:33391,38856:35538,38857:36988,38858:37327,38859:38517,38860:38936,38861:21147,38862:32209,38863:20523,38864:21400,38865:26519,38866:28107,38867:29136,38868:29747,38869:33256,38870:36650,38871:38563,38872:40023,38873:40607,38874:29792,38875:22593,38876:28057,38877:32047,38878:39006,38879:20196,38880:20278,38881:20363,38882:20919,38883:21169,38884:23994,38885:24604,38886:29618,38887:31036,38888:33491,38889:37428,38890:38583,38891:38646,38892:38666,38893:40599,38894:40802,38895:26278,38896:27508,38897:21015,38898:21155,38899:28872,38900:35010,38901:24265,38902:24651,38903:24976,38904:28451,38905:29001,38906:31806,38907:32244,38908:32879,38976:34030,38977:36899,38978:37676,38979:21570,38980:39791,38981:27347,38982:28809,38983:36034,38984:36335,38985:38706,38986:21172,38987:23105,38988:24266,38989:24324,38990:26391,38991:27004,38992:27028,38993:28010,38994:28431,38995:29282,38996:29436,38997:31725,38998:32769,38999:32894,39e3:34635,39001:37070,39002:20845,39003:40595,39004:31108,39005:32907,39006:37682,39007:35542,39008:20525,39009:21644,39010:35441,39011:27498,39012:36036,39013:33031,39014:24785,39015:26528,39016:40434,39017:20121,39018:20120,39019:39952,39020:35435,39021:34241,39022:34152,39023:26880,39024:28286,39025:30871,39026:33109,39071:24332,39072:19984,39073:19989,39074:20010,39075:20017,39076:20022,39077:20028,39078:20031,39079:20034,39080:20054,39081:20056,39082:20098,39083:20101,39084:35947,39085:20106,39086:33298,39087:24333,39088:20110,39089:20126,39090:20127,39091:20128,39092:20130,39093:20144,39094:20147,39095:20150,39096:20174,39097:20173,39098:20164,39099:20166,39100:20162,39101:20183,39102:20190,39103:20205,39104:20191,39105:20215,39106:20233,39107:20314,39108:20272,39109:20315,39110:20317,39111:20311,39112:20295,39113:20342,39114:20360,39115:20367,39116:20376,39117:20347,39118:20329,39119:20336,39120:20369,39121:20335,39122:20358,39123:20374,39124:20760,39125:20436,39126:20447,39127:20430,39128:20440,39129:20443,39130:20433,39131:20442,39132:20432,39133:20452,39134:20453,39135:20506,39136:20520,39137:20500,39138:20522,39139:20517,39140:20485,39141:20252,39142:20470,39143:20513,39144:20521,39145:20524,39146:20478,39147:20463,39148:20497,39149:20486,39150:20547,39151:20551,39152:26371,39153:20565,39154:20560,39155:20552,39156:20570,39157:20566,39158:20588,39159:20600,39160:20608,39161:20634,39162:20613,39163:20660,39164:20658,39232:20681,39233:20682,39234:20659,39235:20674,39236:20694,39237:20702,39238:20709,39239:20717,39240:20707,39241:20718,39242:20729,39243:20725,39244:20745,39245:20737,39246:20738,39247:20758,39248:20757,39249:20756,39250:20762,39251:20769,39252:20794,39253:20791,39254:20796,39255:20795,39256:20799,39257:20800,39258:20818,39259:20812,39260:20820,39261:20834,39262:31480,39263:20841,39264:20842,39265:20846,39266:20864,39267:20866,39268:22232,39269:20876,39270:20873,39271:20879,39272:20881,39273:20883,39274:20885,39275:20886,39276:20900,39277:20902,39278:20898,39279:20905,39280:20906,39281:20907,39282:20915,39283:20913,39284:20914,39285:20912,39286:20917,39287:20925,39288:20933,39289:20937,39290:20955,39291:20960,39292:34389,39293:20969,39294:20973,39296:20976,39297:20981,39298:20990,39299:20996,39300:21003,39301:21012,39302:21006,39303:21031,39304:21034,39305:21038,39306:21043,39307:21049,39308:21071,39309:21060,39310:21067,39311:21068,39312:21086,39313:21076,39314:21098,39315:21108,39316:21097,39317:21107,39318:21119,39319:21117,39320:21133,39321:21140,39322:21138,39323:21105,39324:21128,39325:21137,39326:36776,39327:36775,39328:21164,39329:21165,39330:21180,39331:21173,39332:21185,39333:21197,39334:21207,39335:21214,39336:21219,39337:21222,39338:39149,39339:21216,39340:21235,39341:21237,39342:21240,39343:21241,39344:21254,39345:21256,39346:30008,39347:21261,39348:21264,39349:21263,39350:21269,39351:21274,39352:21283,39353:21295,39354:21297,39355:21299,39356:21304,39357:21312,39358:21318,39359:21317,39360:19991,39361:21321,39362:21325,39363:20950,39364:21342,39365:21353,39366:21358,39367:22808,39368:21371,39369:21367,39370:21378,39371:21398,39372:21408,39373:21414,39374:21413,39375:21422,39376:21424,39377:21430,39378:21443,39379:31762,39380:38617,39381:21471,39382:26364,39383:29166,39384:21486,39385:21480,39386:21485,39387:21498,39388:21505,39389:21565,39390:21568,39391:21548,39392:21549,39393:21564,39394:21550,39395:21558,39396:21545,39397:21533,39398:21582,39399:21647,39400:21621,39401:21646,39402:21599,39403:21617,39404:21623,39405:21616,39406:21650,39407:21627,39408:21632,39409:21622,39410:21636,39411:21648,39412:21638,39413:21703,39414:21666,39415:21688,39416:21669,39417:21676,39418:21700,39419:21704,39420:21672,39488:21675,39489:21698,39490:21668,39491:21694,39492:21692,39493:21720,39494:21733,39495:21734,39496:21775,39497:21780,39498:21757,39499:21742,39500:21741,39501:21754,39502:21730,39503:21817,39504:21824,39505:21859,39506:21836,39507:21806,39508:21852,39509:21829,39510:21846,39511:21847,39512:21816,39513:21811,39514:21853,39515:21913,39516:21888,39517:21679,39518:21898,39519:21919,39520:21883,39521:21886,39522:21912,39523:21918,39524:21934,39525:21884,39526:21891,39527:21929,39528:21895,39529:21928,39530:21978,39531:21957,39532:21983,39533:21956,39534:21980,39535:21988,39536:21972,39537:22036,39538:22007,39539:22038,39540:22014,39541:22013,39542:22043,39543:22009,39544:22094,39545:22096,39546:29151,39547:22068,39548:22070,39549:22066,39550:22072,39552:22123,39553:22116,39554:22063,39555:22124,39556:22122,39557:22150,39558:22144,39559:22154,39560:22176,39561:22164,39562:22159,39563:22181,39564:22190,39565:22198,39566:22196,39567:22210,39568:22204,39569:22209,39570:22211,39571:22208,39572:22216,39573:22222,39574:22225,39575:22227,39576:22231,39577:22254,39578:22265,39579:22272,39580:22271,39581:22276,39582:22281,39583:22280,39584:22283,39585:22285,39586:22291,39587:22296,39588:22294,39589:21959,39590:22300,39591:22310,39592:22327,39593:22328,39594:22350,39595:22331,39596:22336,39597:22351,39598:22377,39599:22464,39600:22408,39601:22369,39602:22399,39603:22409,39604:22419,39605:22432,39606:22451,39607:22436,39608:22442,39609:22448,39610:22467,39611:22470,39612:22484,39613:22482,39614:22483,39615:22538,39616:22486,39617:22499,39618:22539,39619:22553,39620:22557,39621:22642,39622:22561,39623:22626,39624:22603,39625:22640,39626:27584,39627:22610,39628:22589,39629:22649,39630:22661,39631:22713,39632:22687,39633:22699,39634:22714,39635:22750,39636:22715,39637:22712,39638:22702,39639:22725,39640:22739,39641:22737,39642:22743,39643:22745,39644:22744,39645:22757,39646:22748,39647:22756,39648:22751,39649:22767,39650:22778,39651:22777,39652:22779,39653:22780,39654:22781,39655:22786,39656:22794,39657:22800,39658:22811,39659:26790,39660:22821,39661:22828,39662:22829,39663:22834,39664:22840,39665:22846,39666:31442,39667:22869,39668:22864,39669:22862,39670:22874,39671:22872,39672:22882,39673:22880,39674:22887,39675:22892,39676:22889,39744:22904,39745:22913,39746:22941,39747:20318,39748:20395,39749:22947,39750:22962,39751:22982,39752:23016,39753:23004,39754:22925,39755:23001,39756:23002,39757:23077,39758:23071,39759:23057,39760:23068,39761:23049,39762:23066,39763:23104,39764:23148,39765:23113,39766:23093,39767:23094,39768:23138,39769:23146,39770:23194,39771:23228,39772:23230,39773:23243,39774:23234,39775:23229,39776:23267,39777:23255,39778:23270,39779:23273,39780:23254,39781:23290,39782:23291,39783:23308,39784:23307,39785:23318,39786:23346,39787:23248,39788:23338,39789:23350,39790:23358,39791:23363,39792:23365,39793:23360,39794:23377,39795:23381,39796:23386,39797:23387,39798:23397,39799:23401,39800:23408,39801:23411,39802:23413,39803:23416,39804:25992,39805:23418,39806:23424,39808:23427,39809:23462,39810:23480,39811:23491,39812:23495,39813:23497,39814:23508,39815:23504,39816:23524,39817:23526,39818:23522,39819:23518,39820:23525,39821:23531,39822:23536,39823:23542,39824:23539,39825:23557,39826:23559,39827:23560,39828:23565,39829:23571,39830:23584,39831:23586,39832:23592,39833:23608,39834:23609,39835:23617,39836:23622,39837:23630,39838:23635,39839:23632,39840:23631,39841:23409,39842:23660,39843:23662,39844:20066,39845:23670,39846:23673,39847:23692,39848:23697,39849:23700,39850:22939,39851:23723,39852:23739,39853:23734,39854:23740,39855:23735,39856:23749,39857:23742,39858:23751,39859:23769,39860:23785,39861:23805,39862:23802,39863:23789,39864:23948,39865:23786,39866:23819,39867:23829,39868:23831,39869:23900,39870:23839,39871:23835,39872:23825,39873:23828,39874:23842,39875:23834,39876:23833,39877:23832,39878:23884,39879:23890,39880:23886,39881:23883,39882:23916,39883:23923,39884:23926,39885:23943,39886:23940,39887:23938,39888:23970,39889:23965,39890:23980,39891:23982,39892:23997,39893:23952,39894:23991,39895:23996,39896:24009,39897:24013,39898:24019,39899:24018,39900:24022,39901:24027,39902:24043,39903:24050,39904:24053,39905:24075,39906:24090,39907:24089,39908:24081,39909:24091,39910:24118,39911:24119,39912:24132,39913:24131,39914:24128,39915:24142,39916:24151,39917:24148,39918:24159,39919:24162,39920:24164,39921:24135,39922:24181,39923:24182,39924:24186,39925:40636,39926:24191,39927:24224,39928:24257,39929:24258,39930:24264,39931:24272,39932:24271,4e4:24278,40001:24291,40002:24285,40003:24282,40004:24283,40005:24290,40006:24289,40007:24296,40008:24297,40009:24300,40010:24305,40011:24307,40012:24304,40013:24308,40014:24312,40015:24318,40016:24323,40017:24329,40018:24413,40019:24412,40020:24331,40021:24337,40022:24342,40023:24361,40024:24365,40025:24376,40026:24385,40027:24392,40028:24396,40029:24398,40030:24367,40031:24401,40032:24406,40033:24407,40034:24409,40035:24417,40036:24429,40037:24435,40038:24439,40039:24451,40040:24450,40041:24447,40042:24458,40043:24456,40044:24465,40045:24455,40046:24478,40047:24473,40048:24472,40049:24480,40050:24488,40051:24493,40052:24508,40053:24534,40054:24571,40055:24548,40056:24568,40057:24561,40058:24541,40059:24755,40060:24575,40061:24609,40062:24672,40064:24601,40065:24592,40066:24617,40067:24590,40068:24625,40069:24603,40070:24597,40071:24619,40072:24614,40073:24591,40074:24634,40075:24666,40076:24641,40077:24682,40078:24695,40079:24671,40080:24650,40081:24646,40082:24653,40083:24675,40084:24643,40085:24676,40086:24642,40087:24684,40088:24683,40089:24665,40090:24705,40091:24717,40092:24807,40093:24707,40094:24730,40095:24708,40096:24731,40097:24726,40098:24727,40099:24722,40100:24743,40101:24715,40102:24801,40103:24760,40104:24800,40105:24787,40106:24756,40107:24560,40108:24765,40109:24774,40110:24757,40111:24792,40112:24909,40113:24853,40114:24838,40115:24822,40116:24823,40117:24832,40118:24820,40119:24826,40120:24835,40121:24865,40122:24827,40123:24817,40124:24845,40125:24846,40126:24903,40127:24894,40128:24872,40129:24871,40130:24906,40131:24895,40132:24892,40133:24876,40134:24884,40135:24893,40136:24898,40137:24900,40138:24947,40139:24951,40140:24920,40141:24921,40142:24922,40143:24939,40144:24948,40145:24943,40146:24933,40147:24945,40148:24927,40149:24925,40150:24915,40151:24949,40152:24985,40153:24982,40154:24967,40155:25004,40156:24980,40157:24986,40158:24970,40159:24977,40160:25003,40161:25006,40162:25036,40163:25034,40164:25033,40165:25079,40166:25032,40167:25027,40168:25030,40169:25018,40170:25035,40171:32633,40172:25037,40173:25062,40174:25059,40175:25078,40176:25082,40177:25076,40178:25087,40179:25085,40180:25084,40181:25086,40182:25088,40183:25096,40184:25097,40185:25101,40186:25100,40187:25108,40188:25115,40256:25118,40257:25121,40258:25130,40259:25134,40260:25136,40261:25138,40262:25139,40263:25153,40264:25166,40265:25182,40266:25187,40267:25179,40268:25184,40269:25192,40270:25212,40271:25218,40272:25225,40273:25214,40274:25234,40275:25235,40276:25238,40277:25300,40278:25219,40279:25236,40280:25303,40281:25297,40282:25275,40283:25295,40284:25343,40285:25286,40286:25812,40287:25288,40288:25308,40289:25292,40290:25290,40291:25282,40292:25287,40293:25243,40294:25289,40295:25356,40296:25326,40297:25329,40298:25383,40299:25346,40300:25352,40301:25327,40302:25333,40303:25424,40304:25406,40305:25421,40306:25628,40307:25423,40308:25494,40309:25486,40310:25472,40311:25515,40312:25462,40313:25507,40314:25487,40315:25481,40316:25503,40317:25525,40318:25451,40320:25449,40321:25534,40322:25577,40323:25536,40324:25542,40325:25571,40326:25545,40327:25554,40328:25590,40329:25540,40330:25622,40331:25652,40332:25606,40333:25619,40334:25638,40335:25654,40336:25885,40337:25623,40338:25640,40339:25615,40340:25703,40341:25711,40342:25718,40343:25678,40344:25898,40345:25749,40346:25747,40347:25765,40348:25769,40349:25736,40350:25788,40351:25818,40352:25810,40353:25797,40354:25799,40355:25787,40356:25816,40357:25794,40358:25841,40359:25831,40360:33289,40361:25824,40362:25825,40363:25260,40364:25827,40365:25839,40366:25900,40367:25846,40368:25844,40369:25842,40370:25850,40371:25856,40372:25853,40373:25880,40374:25884,40375:25861,40376:25892,40377:25891,40378:25899,40379:25908,40380:25909,40381:25911,40382:25910,40383:25912,40384:30027,40385:25928,40386:25942,40387:25941,40388:25933,40389:25944,40390:25950,40391:25949,40392:25970,40393:25976,40394:25986,40395:25987,40396:35722,40397:26011,40398:26015,40399:26027,40400:26039,40401:26051,40402:26054,40403:26049,40404:26052,40405:26060,40406:26066,40407:26075,40408:26073,40409:26080,40410:26081,40411:26097,40412:26482,40413:26122,40414:26115,40415:26107,40416:26483,40417:26165,40418:26166,40419:26164,40420:26140,40421:26191,40422:26180,40423:26185,40424:26177,40425:26206,40426:26205,40427:26212,40428:26215,40429:26216,40430:26207,40431:26210,40432:26224,40433:26243,40434:26248,40435:26254,40436:26249,40437:26244,40438:26264,40439:26269,40440:26305,40441:26297,40442:26313,40443:26302,40444:26300,40512:26308,40513:26296,40514:26326,40515:26330,40516:26336,40517:26175,40518:26342,40519:26345,40520:26352,40521:26357,40522:26359,40523:26383,40524:26390,40525:26398,40526:26406,40527:26407,40528:38712,40529:26414,40530:26431,40531:26422,40532:26433,40533:26424,40534:26423,40535:26438,40536:26462,40537:26464,40538:26457,40539:26467,40540:26468,40541:26505,40542:26480,40543:26537,40544:26492,40545:26474,40546:26508,40547:26507,40548:26534,40549:26529,40550:26501,40551:26551,40552:26607,40553:26548,40554:26604,40555:26547,40556:26601,40557:26552,40558:26596,40559:26590,40560:26589,40561:26594,40562:26606,40563:26553,40564:26574,40565:26566,40566:26599,40567:27292,40568:26654,40569:26694,40570:26665,40571:26688,40572:26701,40573:26674,40574:26702,40576:26803,40577:26667,40578:26713,40579:26723,40580:26743,40581:26751,40582:26783,40583:26767,40584:26797,40585:26772,40586:26781,40587:26779,40588:26755,40589:27310,40590:26809,40591:26740,40592:26805,40593:26784,40594:26810,40595:26895,40596:26765,40597:26750,40598:26881,40599:26826,40600:26888,40601:26840,40602:26914,40603:26918,40604:26849,40605:26892,40606:26829,40607:26836,40608:26855,40609:26837,40610:26934,40611:26898,40612:26884,40613:26839,40614:26851,40615:26917,40616:26873,40617:26848,40618:26863,40619:26920,40620:26922,40621:26906,40622:26915,40623:26913,40624:26822,40625:27001,40626:26999,40627:26972,40628:27e3,40629:26987,40630:26964,40631:27006,40632:26990,40633:26937,40634:26996,40635:26941,40636:26969,40637:26928,40638:26977,40639:26974,40640:26973,40641:27009,40642:26986,40643:27058,40644:27054,40645:27088,40646:27071,40647:27073,40648:27091,40649:27070,40650:27086,40651:23528,40652:27082,40653:27101,40654:27067,40655:27075,40656:27047,40657:27182,40658:27025,40659:27040,40660:27036,40661:27029,40662:27060,40663:27102,40664:27112,40665:27138,40666:27163,40667:27135,40668:27402,40669:27129,40670:27122,40671:27111,40672:27141,40673:27057,40674:27166,40675:27117,40676:27156,40677:27115,40678:27146,40679:27154,40680:27329,40681:27171,40682:27155,40683:27204,40684:27148,40685:27250,40686:27190,40687:27256,40688:27207,40689:27234,40690:27225,40691:27238,40692:27208,40693:27192,40694:27170,40695:27280,40696:27277,40697:27296,40698:27268,40699:27298,40700:27299,40768:27287,40769:34327,40770:27323,40771:27331,40772:27330,40773:27320,40774:27315,40775:27308,40776:27358,40777:27345,40778:27359,40779:27306,40780:27354,40781:27370,40782:27387,40783:27397,40784:34326,40785:27386,40786:27410,40787:27414,40788:39729,40789:27423,40790:27448,40791:27447,40792:30428,40793:27449,40794:39150,40795:27463,40796:27459,40797:27465,40798:27472,40799:27481,40800:27476,40801:27483,40802:27487,40803:27489,40804:27512,40805:27513,40806:27519,40807:27520,40808:27524,40809:27523,40810:27533,40811:27544,40812:27541,40813:27550,40814:27556,40815:27562,40816:27563,40817:27567,40818:27570,40819:27569,40820:27571,40821:27575,40822:27580,40823:27590,40824:27595,40825:27603,40826:27615,40827:27628,40828:27627,40829:27635,40830:27631,40832:40638,40833:27656,40834:27667,40835:27668,40836:27675,40837:27684,40838:27683,40839:27742,40840:27733,40841:27746,40842:27754,40843:27778,40844:27789,40845:27802,40846:27777,40847:27803,40848:27774,40849:27752,40850:27763,40851:27794,40852:27792,40853:27844,40854:27889,40855:27859,40856:27837,40857:27863,40858:27845,40859:27869,40860:27822,40861:27825,40862:27838,40863:27834,40864:27867,40865:27887,40866:27865,40867:27882,40868:27935,40869:34893,40870:27958,40871:27947,40872:27965,40873:27960,40874:27929,40875:27957,40876:27955,40877:27922,40878:27916,40879:28003,40880:28051,40881:28004,40882:27994,40883:28025,40884:27993,40885:28046,40886:28053,40887:28644,40888:28037,40889:28153,40890:28181,40891:28170,40892:28085,40893:28103,40894:28134,40895:28088,40896:28102,40897:28140,40898:28126,40899:28108,40900:28136,40901:28114,40902:28101,40903:28154,40904:28121,40905:28132,40906:28117,40907:28138,40908:28142,40909:28205,40910:28270,40911:28206,40912:28185,40913:28274,40914:28255,40915:28222,40916:28195,40917:28267,40918:28203,40919:28278,40920:28237,40921:28191,40922:28227,40923:28218,40924:28238,40925:28196,40926:28415,40927:28189,40928:28216,40929:28290,40930:28330,40931:28312,40932:28361,40933:28343,40934:28371,40935:28349,40936:28335,40937:28356,40938:28338,40939:28372,40940:28373,40941:28303,40942:28325,40943:28354,40944:28319,40945:28481,40946:28433,40947:28748,40948:28396,40949:28408,40950:28414,40951:28479,40952:28402,40953:28465,40954:28399,40955:28466,40956:28364,161:65377,162:65378,163:65379,164:65380,165:65381,166:65382,167:65383,168:65384,169:65385,170:65386,171:65387,172:65388,173:65389,174:65390,175:65391,176:65392,177:65393,178:65394,179:65395,180:65396,181:65397,182:65398,183:65399,184:65400,185:65401,186:65402,187:65403,188:65404,189:65405,190:65406,191:65407,192:65408,193:65409,194:65410,195:65411,196:65412,197:65413,198:65414,199:65415,200:65416,201:65417,202:65418,203:65419,204:65420,205:65421,206:65422,207:65423,208:65424,209:65425,210:65426,211:65427,212:65428,213:65429,214:65430,215:65431,216:65432,217:65433,218:65434,219:65435,220:65436,221:65437,222:65438,223:65439,57408:28478,57409:28435,57410:28407,57411:28550,57412:28538,57413:28536,57414:28545,57415:28544,57416:28527,57417:28507,57418:28659,57419:28525,57420:28546,57421:28540,57422:28504,57423:28558,57424:28561,57425:28610,57426:28518,57427:28595,57428:28579,57429:28577,57430:28580,57431:28601,57432:28614,57433:28586,57434:28639,57435:28629,57436:28652,57437:28628,57438:28632,57439:28657,57440:28654,57441:28635,57442:28681,57443:28683,57444:28666,57445:28689,57446:28673,57447:28687,57448:28670,57449:28699,57450:28698,57451:28532,57452:28701,57453:28696,57454:28703,57455:28720,57456:28734,57457:28722,57458:28753,57459:28771,57460:28825,57461:28818,57462:28847,57463:28913,57464:28844,57465:28856,57466:28851,57467:28846,57468:28895,57469:28875,57470:28893,57472:28889,57473:28937,57474:28925,57475:28956,57476:28953,57477:29029,57478:29013,57479:29064,57480:29030,57481:29026,57482:29004,57483:29014,57484:29036,57485:29071,57486:29179,57487:29060,57488:29077,57489:29096,57490:29100,57491:29143,57492:29113,57493:29118,57494:29138,57495:29129,57496:29140,57497:29134,57498:29152,57499:29164,57500:29159,57501:29173,57502:29180,57503:29177,57504:29183,57505:29197,57506:29200,57507:29211,57508:29224,57509:29229,57510:29228,57511:29232,57512:29234,57513:29243,57514:29244,57515:29247,57516:29248,57517:29254,57518:29259,57519:29272,57520:29300,57521:29310,57522:29314,57523:29313,57524:29319,57525:29330,57526:29334,57527:29346,57528:29351,57529:29369,57530:29362,57531:29379,57532:29382,57533:29380,57534:29390,57535:29394,57536:29410,57537:29408,57538:29409,57539:29433,57540:29431,57541:20495,57542:29463,57543:29450,57544:29468,57545:29462,57546:29469,57547:29492,57548:29487,57549:29481,57550:29477,57551:29502,57552:29518,57553:29519,57554:40664,57555:29527,57556:29546,57557:29544,57558:29552,57559:29560,57560:29557,57561:29563,57562:29562,57563:29640,57564:29619,57565:29646,57566:29627,57567:29632,57568:29669,57569:29678,57570:29662,57571:29858,57572:29701,57573:29807,57574:29733,57575:29688,57576:29746,57577:29754,57578:29781,57579:29759,57580:29791,57581:29785,57582:29761,57583:29788,57584:29801,57585:29808,57586:29795,57587:29802,57588:29814,57589:29822,57590:29835,57591:29854,57592:29863,57593:29898,57594:29903,57595:29908,57596:29681,57664:29920,57665:29923,57666:29927,57667:29929,57668:29934,57669:29938,57670:29936,57671:29937,57672:29944,57673:29943,57674:29956,57675:29955,57676:29957,57677:29964,57678:29966,57679:29965,57680:29973,57681:29971,57682:29982,57683:29990,57684:29996,57685:30012,57686:30020,57687:30029,57688:30026,57689:30025,57690:30043,57691:30022,57692:30042,57693:30057,57694:30052,57695:30055,57696:30059,57697:30061,57698:30072,57699:30070,57700:30086,57701:30087,57702:30068,57703:30090,57704:30089,57705:30082,57706:30100,57707:30106,57708:30109,57709:30117,57710:30115,57711:30146,57712:30131,57713:30147,57714:30133,57715:30141,57716:30136,57717:30140,57718:30129,57719:30157,57720:30154,57721:30162,57722:30169,57723:30179,57724:30174,57725:30206,57726:30207,57728:30204,57729:30209,57730:30192,57731:30202,57732:30194,57733:30195,57734:30219,57735:30221,57736:30217,57737:30239,57738:30247,57739:30240,57740:30241,57741:30242,57742:30244,57743:30260,57744:30256,57745:30267,57746:30279,57747:30280,57748:30278,57749:30300,57750:30296,57751:30305,57752:30306,57753:30312,57754:30313,57755:30314,57756:30311,57757:30316,57758:30320,57759:30322,57760:30326,57761:30328,57762:30332,57763:30336,57764:30339,57765:30344,57766:30347,57767:30350,57768:30358,57769:30355,57770:30361,57771:30362,57772:30384,57773:30388,57774:30392,57775:30393,57776:30394,57777:30402,57778:30413,57779:30422,57780:30418,57781:30430,57782:30433,57783:30437,57784:30439,57785:30442,57786:34351,57787:30459,57788:30472,57789:30471,57790:30468,57791:30505,57792:30500,57793:30494,57794:30501,57795:30502,57796:30491,57797:30519,57798:30520,57799:30535,57800:30554,57801:30568,57802:30571,57803:30555,57804:30565,57805:30591,57806:30590,57807:30585,57808:30606,57809:30603,57810:30609,57811:30624,57812:30622,57813:30640,57814:30646,57815:30649,57816:30655,57817:30652,57818:30653,57819:30651,57820:30663,57821:30669,57822:30679,57823:30682,57824:30684,57825:30691,57826:30702,57827:30716,57828:30732,57829:30738,57830:31014,57831:30752,57832:31018,57833:30789,57834:30862,57835:30836,57836:30854,57837:30844,57838:30874,57839:30860,57840:30883,57841:30901,57842:30890,57843:30895,57844:30929,57845:30918,57846:30923,57847:30932,57848:30910,57849:30908,57850:30917,57851:30922,57852:30956,57920:30951,57921:30938,57922:30973,57923:30964,57924:30983,57925:30994,57926:30993,57927:31001,57928:31020,57929:31019,57930:31040,57931:31072,57932:31063,57933:31071,57934:31066,57935:31061,57936:31059,57937:31098,57938:31103,57939:31114,57940:31133,57941:31143,57942:40779,57943:31146,57944:31150,57945:31155,57946:31161,57947:31162,57948:31177,57949:31189,57950:31207,57951:31212,57952:31201,57953:31203,57954:31240,57955:31245,57956:31256,57957:31257,57958:31264,57959:31263,57960:31104,57961:31281,57962:31291,57963:31294,57964:31287,57965:31299,57966:31319,57967:31305,57968:31329,57969:31330,57970:31337,57971:40861,57972:31344,57973:31353,57974:31357,57975:31368,57976:31383,57977:31381,57978:31384,57979:31382,57980:31401,57981:31432,57982:31408,57984:31414,57985:31429,57986:31428,57987:31423,57988:36995,57989:31431,57990:31434,57991:31437,57992:31439,57993:31445,57994:31443,57995:31449,57996:31450,57997:31453,57998:31457,57999:31458,58e3:31462,58001:31469,58002:31472,58003:31490,58004:31503,58005:31498,58006:31494,58007:31539,58008:31512,58009:31513,58010:31518,58011:31541,58012:31528,58013:31542,58014:31568,58015:31610,58016:31492,58017:31565,58018:31499,58019:31564,58020:31557,58021:31605,58022:31589,58023:31604,58024:31591,58025:31600,58026:31601,58027:31596,58028:31598,58029:31645,58030:31640,58031:31647,58032:31629,58033:31644,58034:31642,58035:31627,58036:31634,58037:31631,58038:31581,58039:31641,58040:31691,58041:31681,58042:31692,58043:31695,58044:31668,58045:31686,58046:31709,58047:31721,58048:31761,58049:31764,58050:31718,58051:31717,58052:31840,58053:31744,58054:31751,58055:31763,58056:31731,58057:31735,58058:31767,58059:31757,58060:31734,58061:31779,58062:31783,58063:31786,58064:31775,58065:31799,58066:31787,58067:31805,58068:31820,58069:31811,58070:31828,58071:31823,58072:31808,58073:31824,58074:31832,58075:31839,58076:31844,58077:31830,58078:31845,58079:31852,58080:31861,58081:31875,58082:31888,58083:31908,58084:31917,58085:31906,58086:31915,58087:31905,58088:31912,58089:31923,58090:31922,58091:31921,58092:31918,58093:31929,58094:31933,58095:31936,58096:31941,58097:31938,58098:31960,58099:31954,58100:31964,58101:31970,58102:39739,58103:31983,58104:31986,58105:31988,58106:31990,58107:31994,58108:32006,58176:32002,58177:32028,58178:32021,58179:32010,58180:32069,58181:32075,58182:32046,58183:32050,58184:32063,58185:32053,58186:32070,58187:32115,58188:32086,58189:32078,58190:32114,58191:32104,58192:32110,58193:32079,58194:32099,58195:32147,58196:32137,58197:32091,58198:32143,58199:32125,58200:32155,58201:32186,58202:32174,58203:32163,58204:32181,58205:32199,58206:32189,58207:32171,58208:32317,58209:32162,58210:32175,58211:32220,58212:32184,58213:32159,58214:32176,58215:32216,58216:32221,58217:32228,58218:32222,58219:32251,58220:32242,58221:32225,58222:32261,58223:32266,58224:32291,58225:32289,58226:32274,58227:32305,58228:32287,58229:32265,58230:32267,58231:32290,58232:32326,58233:32358,58234:32315,58235:32309,58236:32313,58237:32323,58238:32311,58240:32306,58241:32314,58242:32359,58243:32349,58244:32342,58245:32350,58246:32345,58247:32346,58248:32377,58249:32362,58250:32361,58251:32380,58252:32379,58253:32387,58254:32213,58255:32381,58256:36782,58257:32383,58258:32392,58259:32393,58260:32396,58261:32402,58262:32400,58263:32403,58264:32404,58265:32406,58266:32398,58267:32411,58268:32412,58269:32568,58270:32570,58271:32581,58272:32588,58273:32589,58274:32590,58275:32592,58276:32593,58277:32597,58278:32596,58279:32600,58280:32607,58281:32608,58282:32616,58283:32617,58284:32615,58285:32632,58286:32642,58287:32646,58288:32643,58289:32648,58290:32647,58291:32652,58292:32660,58293:32670,58294:32669,58295:32666,58296:32675,58297:32687,58298:32690,58299:32697,58300:32686,58301:32694,58302:32696,58303:35697,58304:32709,58305:32710,58306:32714,58307:32725,58308:32724,58309:32737,58310:32742,58311:32745,58312:32755,58313:32761,58314:39132,58315:32774,58316:32772,58317:32779,58318:32786,58319:32792,58320:32793,58321:32796,58322:32801,58323:32808,58324:32831,58325:32827,58326:32842,58327:32838,58328:32850,58329:32856,58330:32858,58331:32863,58332:32866,58333:32872,58334:32883,58335:32882,58336:32880,58337:32886,58338:32889,58339:32893,58340:32895,58341:32900,58342:32902,58343:32901,58344:32923,58345:32915,58346:32922,58347:32941,58348:20880,58349:32940,58350:32987,58351:32997,58352:32985,58353:32989,58354:32964,58355:32986,58356:32982,58357:33033,58358:33007,58359:33009,58360:33051,58361:33065,58362:33059,58363:33071,58364:33099,58432:38539,58433:33094,58434:33086,58435:33107,58436:33105,58437:33020,58438:33137,58439:33134,58440:33125,58441:33126,58442:33140,58443:33155,58444:33160,58445:33162,58446:33152,58447:33154,58448:33184,58449:33173,58450:33188,58451:33187,58452:33119,58453:33171,58454:33193,58455:33200,58456:33205,58457:33214,58458:33208,58459:33213,58460:33216,58461:33218,58462:33210,58463:33225,58464:33229,58465:33233,58466:33241,58467:33240,58468:33224,58469:33242,58470:33247,58471:33248,58472:33255,58473:33274,58474:33275,58475:33278,58476:33281,58477:33282,58478:33285,58479:33287,58480:33290,58481:33293,58482:33296,58483:33302,58484:33321,58485:33323,58486:33336,58487:33331,58488:33344,58489:33369,58490:33368,58491:33373,58492:33370,58493:33375,58494:33380,58496:33378,58497:33384,58498:33386,58499:33387,58500:33326,58501:33393,58502:33399,58503:33400,58504:33406,58505:33421,58506:33426,58507:33451,58508:33439,58509:33467,58510:33452,58511:33505,58512:33507,58513:33503,58514:33490,58515:33524,58516:33523,58517:33530,58518:33683,58519:33539,58520:33531,58521:33529,58522:33502,58523:33542,58524:33500,58525:33545,58526:33497,58527:33589,58528:33588,58529:33558,58530:33586,58531:33585,58532:33600,58533:33593,58534:33616,58535:33605,58536:33583,58537:33579,58538:33559,58539:33560,58540:33669,58541:33690,58542:33706,58543:33695,58544:33698,58545:33686,58546:33571,58547:33678,58548:33671,58549:33674,58550:33660,58551:33717,58552:33651,58553:33653,58554:33696,58555:33673,58556:33704,58557:33780,58558:33811,58559:33771,58560:33742,58561:33789,58562:33795,58563:33752,58564:33803,58565:33729,58566:33783,58567:33799,58568:33760,58569:33778,58570:33805,58571:33826,58572:33824,58573:33725,58574:33848,58575:34054,58576:33787,58577:33901,58578:33834,58579:33852,58580:34138,58581:33924,58582:33911,58583:33899,58584:33965,58585:33902,58586:33922,58587:33897,58588:33862,58589:33836,58590:33903,58591:33913,58592:33845,58593:33994,58594:33890,58595:33977,58596:33983,58597:33951,58598:34009,58599:33997,58600:33979,58601:34010,58602:34e3,58603:33985,58604:33990,58605:34006,58606:33953,58607:34081,58608:34047,58609:34036,58610:34071,58611:34072,58612:34092,58613:34079,58614:34069,58615:34068,58616:34044,58617:34112,58618:34147,58619:34136,58620:34120,58688:34113,58689:34306,58690:34123,58691:34133,58692:34176,58693:34212,58694:34184,58695:34193,58696:34186,58697:34216,58698:34157,58699:34196,58700:34203,58701:34282,58702:34183,58703:34204,58704:34167,58705:34174,58706:34192,58707:34249,58708:34234,58709:34255,58710:34233,58711:34256,58712:34261,58713:34269,58714:34277,58715:34268,58716:34297,58717:34314,58718:34323,58719:34315,58720:34302,58721:34298,58722:34310,58723:34338,58724:34330,58725:34352,58726:34367,58727:34381,58728:20053,58729:34388,58730:34399,58731:34407,58732:34417,58733:34451,58734:34467,58735:34473,58736:34474,58737:34443,58738:34444,58739:34486,58740:34479,58741:34500,58742:34502,58743:34480,58744:34505,58745:34851,58746:34475,58747:34516,58748:34526,58749:34537,58750:34540,58752:34527,58753:34523,58754:34543,58755:34578,58756:34566,58757:34568,58758:34560,58759:34563,58760:34555,58761:34577,58762:34569,58763:34573,58764:34553,58765:34570,58766:34612,58767:34623,58768:34615,58769:34619,58770:34597,58771:34601,58772:34586,58773:34656,58774:34655,58775:34680,58776:34636,58777:34638,58778:34676,58779:34647,58780:34664,58781:34670,58782:34649,58783:34643,58784:34659,58785:34666,58786:34821,58787:34722,58788:34719,58789:34690,58790:34735,58791:34763,58792:34749,58793:34752,58794:34768,58795:38614,58796:34731,58797:34756,58798:34739,58799:34759,58800:34758,58801:34747,58802:34799,58803:34802,58804:34784,58805:34831,58806:34829,58807:34814,58808:34806,58809:34807,58810:34830,58811:34770,58812:34833,58813:34838,58814:34837,58815:34850,58816:34849,58817:34865,58818:34870,58819:34873,58820:34855,58821:34875,58822:34884,58823:34882,58824:34898,58825:34905,58826:34910,58827:34914,58828:34923,58829:34945,58830:34942,58831:34974,58832:34933,58833:34941,58834:34997,58835:34930,58836:34946,58837:34967,58838:34962,58839:34990,58840:34969,58841:34978,58842:34957,58843:34980,58844:34992,58845:35007,58846:34993,58847:35011,58848:35012,58849:35028,58850:35032,58851:35033,58852:35037,58853:35065,58854:35074,58855:35068,58856:35060,58857:35048,58858:35058,58859:35076,58860:35084,58861:35082,58862:35091,58863:35139,58864:35102,58865:35109,58866:35114,58867:35115,58868:35137,58869:35140,58870:35131,58871:35126,58872:35128,58873:35148,58874:35101,58875:35168,58876:35166,58944:35174,58945:35172,58946:35181,58947:35178,58948:35183,58949:35188,58950:35191,58951:35198,58952:35203,58953:35208,58954:35210,58955:35219,58956:35224,58957:35233,58958:35241,58959:35238,58960:35244,58961:35247,58962:35250,58963:35258,58964:35261,58965:35263,58966:35264,58967:35290,58968:35292,58969:35293,58970:35303,58971:35316,58972:35320,58973:35331,58974:35350,58975:35344,58976:35340,58977:35355,58978:35357,58979:35365,58980:35382,58981:35393,58982:35419,58983:35410,58984:35398,58985:35400,58986:35452,58987:35437,58988:35436,58989:35426,58990:35461,58991:35458,58992:35460,58993:35496,58994:35489,58995:35473,58996:35493,58997:35494,58998:35482,58999:35491,59e3:35524,59001:35533,59002:35522,59003:35546,59004:35563,59005:35571,59006:35559,59008:35556,59009:35569,59010:35604,59011:35552,59012:35554,59013:35575,59014:35550,59015:35547,59016:35596,59017:35591,59018:35610,59019:35553,59020:35606,59021:35600,59022:35607,59023:35616,59024:35635,59025:38827,59026:35622,59027:35627,59028:35646,59029:35624,59030:35649,59031:35660,59032:35663,59033:35662,59034:35657,59035:35670,59036:35675,59037:35674,59038:35691,59039:35679,59040:35692,59041:35695,59042:35700,59043:35709,59044:35712,59045:35724,59046:35726,59047:35730,59048:35731,59049:35734,59050:35737,59051:35738,59052:35898,59053:35905,59054:35903,59055:35912,59056:35916,59057:35918,59058:35920,59059:35925,59060:35938,59061:35948,59062:35960,59063:35962,59064:35970,59065:35977,59066:35973,59067:35978,59068:35981,59069:35982,59070:35988,59071:35964,59072:35992,59073:25117,59074:36013,59075:36010,59076:36029,59077:36018,59078:36019,59079:36014,59080:36022,59081:36040,59082:36033,59083:36068,59084:36067,59085:36058,59086:36093,59087:36090,59088:36091,59089:36100,59090:36101,59091:36106,59092:36103,59093:36111,59094:36109,59095:36112,59096:40782,59097:36115,59098:36045,59099:36116,59100:36118,59101:36199,59102:36205,59103:36209,59104:36211,59105:36225,59106:36249,59107:36290,59108:36286,59109:36282,59110:36303,59111:36314,59112:36310,59113:36300,59114:36315,59115:36299,59116:36330,59117:36331,59118:36319,59119:36323,59120:36348,59121:36360,59122:36361,59123:36351,59124:36381,59125:36382,59126:36368,59127:36383,59128:36418,59129:36405,59130:36400,59131:36404,59132:36426,59200:36423,59201:36425,59202:36428,59203:36432,59204:36424,59205:36441,59206:36452,59207:36448,59208:36394,59209:36451,59210:36437,59211:36470,59212:36466,59213:36476,59214:36481,59215:36487,59216:36485,59217:36484,59218:36491,59219:36490,59220:36499,59221:36497,59222:36500,59223:36505,59224:36522,59225:36513,59226:36524,59227:36528,59228:36550,59229:36529,59230:36542,59231:36549,59232:36552,59233:36555,59234:36571,59235:36579,59236:36604,59237:36603,59238:36587,59239:36606,59240:36618,59241:36613,59242:36629,59243:36626,59244:36633,59245:36627,59246:36636,59247:36639,59248:36635,59249:36620,59250:36646,59251:36659,59252:36667,59253:36665,59254:36677,59255:36674,59256:36670,59257:36684,59258:36681,59259:36678,59260:36686,59261:36695,59262:36700,59264:36706,59265:36707,59266:36708,59267:36764,59268:36767,59269:36771,59270:36781,59271:36783,59272:36791,59273:36826,59274:36837,59275:36834,59276:36842,59277:36847,59278:36999,59279:36852,59280:36869,59281:36857,59282:36858,59283:36881,59284:36885,59285:36897,59286:36877,59287:36894,59288:36886,59289:36875,59290:36903,59291:36918,59292:36917,59293:36921,59294:36856,59295:36943,59296:36944,59297:36945,59298:36946,59299:36878,59300:36937,59301:36926,59302:36950,59303:36952,59304:36958,59305:36968,59306:36975,59307:36982,59308:38568,59309:36978,59310:36994,59311:36989,59312:36993,59313:36992,59314:37002,59315:37001,59316:37007,59317:37032,59318:37039,59319:37041,59320:37045,59321:37090,59322:37092,59323:25160,59324:37083,59325:37122,59326:37138,59327:37145,59328:37170,59329:37168,59330:37194,59331:37206,59332:37208,59333:37219,59334:37221,59335:37225,59336:37235,59337:37234,59338:37259,59339:37257,59340:37250,59341:37282,59342:37291,59343:37295,59344:37290,59345:37301,59346:37300,59347:37306,59348:37312,59349:37313,59350:37321,59351:37323,59352:37328,59353:37334,59354:37343,59355:37345,59356:37339,59357:37372,59358:37365,59359:37366,59360:37406,59361:37375,59362:37396,59363:37420,59364:37397,59365:37393,59366:37470,59367:37463,59368:37445,59369:37449,59370:37476,59371:37448,59372:37525,59373:37439,59374:37451,59375:37456,59376:37532,59377:37526,59378:37523,59379:37531,59380:37466,59381:37583,59382:37561,59383:37559,59384:37609,59385:37647,59386:37626,59387:37700,59388:37678,59456:37657,59457:37666,59458:37658,59459:37667,59460:37690,59461:37685,59462:37691,59463:37724,59464:37728,59465:37756,59466:37742,59467:37718,59468:37808,59469:37804,59470:37805,59471:37780,59472:37817,59473:37846,59474:37847,59475:37864,59476:37861,59477:37848,59478:37827,59479:37853,59480:37840,59481:37832,59482:37860,59483:37914,59484:37908,59485:37907,59486:37891,59487:37895,59488:37904,59489:37942,59490:37931,59491:37941,59492:37921,59493:37946,59494:37953,59495:37970,59496:37956,59497:37979,59498:37984,59499:37986,59500:37982,59501:37994,59502:37417,59503:38e3,59504:38005,59505:38007,59506:38013,59507:37978,59508:38012,59509:38014,59510:38017,59511:38015,59512:38274,59513:38279,59514:38282,59515:38292,59516:38294,59517:38296,59518:38297,59520:38304,59521:38312,59522:38311,59523:38317,59524:38332,59525:38331,59526:38329,59527:38334,59528:38346,59529:28662,59530:38339,59531:38349,59532:38348,59533:38357,59534:38356,59535:38358,59536:38364,59537:38369,59538:38373,59539:38370,59540:38433,59541:38440,59542:38446,59543:38447,59544:38466,59545:38476,59546:38479,59547:38475,59548:38519,59549:38492,59550:38494,59551:38493,59552:38495,59553:38502,59554:38514,59555:38508,59556:38541,59557:38552,59558:38549,59559:38551,59560:38570,59561:38567,59562:38577,59563:38578,59564:38576,59565:38580,59566:38582,59567:38584,59568:38585,59569:38606,59570:38603,59571:38601,59572:38605,59573:35149,59574:38620,59575:38669,59576:38613,59577:38649,59578:38660,59579:38662,59580:38664,59581:38675,59582:38670,59583:38673,59584:38671,59585:38678,59586:38681,59587:38692,59588:38698,59589:38704,59590:38713,59591:38717,59592:38718,59593:38724,59594:38726,59595:38728,59596:38722,59597:38729,59598:38748,59599:38752,59600:38756,59601:38758,59602:38760,59603:21202,59604:38763,59605:38769,59606:38777,59607:38789,59608:38780,59609:38785,59610:38778,59611:38790,59612:38795,59613:38799,59614:38800,59615:38812,59616:38824,59617:38822,59618:38819,59619:38835,59620:38836,59621:38851,59622:38854,59623:38856,59624:38859,59625:38876,59626:38893,59627:40783,59628:38898,59629:31455,59630:38902,59631:38901,59632:38927,59633:38924,59634:38968,59635:38948,59636:38945,59637:38967,59638:38973,59639:38982,59640:38991,59641:38987,59642:39019,59643:39023,59644:39024,59712:39025,59713:39028,59714:39027,59715:39082,59716:39087,59717:39089,59718:39094,59719:39108,59720:39107,59721:39110,59722:39145,59723:39147,59724:39171,59725:39177,59726:39186,59727:39188,59728:39192,59729:39201,59730:39197,59731:39198,59732:39204,59733:39200,59734:39212,59735:39214,59736:39229,59737:39230,59738:39234,59739:39241,59740:39237,59741:39248,59742:39243,59743:39249,59744:39250,59745:39244,59746:39253,59747:39319,59748:39320,59749:39333,59750:39341,59751:39342,59752:39356,59753:39391,59754:39387,59755:39389,59756:39384,59757:39377,59758:39405,59759:39406,59760:39409,59761:39410,59762:39419,59763:39416,59764:39425,59765:39439,59766:39429,59767:39394,59768:39449,59769:39467,59770:39479,59771:39493,59772:39490,59773:39488,59774:39491,59776:39486,59777:39509,59778:39501,59779:39515,59780:39511,59781:39519,59782:39522,59783:39525,59784:39524,59785:39529,59786:39531,59787:39530,59788:39597,59789:39600,59790:39612,59791:39616,59792:39631,59793:39633,59794:39635,59795:39636,59796:39646,59797:39647,59798:39650,59799:39651,59800:39654,59801:39663,59802:39659,59803:39662,59804:39668,59805:39665,59806:39671,59807:39675,59808:39686,59809:39704,59810:39706,59811:39711,59812:39714,59813:39715,59814:39717,59815:39719,59816:39720,59817:39721,59818:39722,59819:39726,59820:39727,59821:39730,59822:39748,59823:39747,59824:39759,59825:39757,59826:39758,59827:39761,59828:39768,59829:39796,59830:39827,59831:39811,59832:39825,59833:39830,59834:39831,59835:39839,59836:39840,59837:39848,59838:39860,59839:39872,59840:39882,59841:39865,59842:39878,59843:39887,59844:39889,59845:39890,59846:39907,59847:39906,59848:39908,59849:39892,59850:39905,59851:39994,59852:39922,59853:39921,59854:39920,59855:39957,59856:39956,59857:39945,59858:39955,59859:39948,59860:39942,59861:39944,59862:39954,59863:39946,59864:39940,59865:39982,59866:39963,59867:39973,59868:39972,59869:39969,59870:39984,59871:40007,59872:39986,59873:40006,59874:39998,59875:40026,59876:40032,59877:40039,59878:40054,59879:40056,59880:40167,59881:40172,59882:40176,59883:40201,59884:40200,59885:40171,59886:40195,59887:40198,59888:40234,59889:40230,59890:40367,59891:40227,59892:40223,59893:40260,59894:40213,59895:40210,59896:40257,59897:40255,59898:40254,59899:40262,59900:40264,59968:40285,59969:40286,59970:40292,59971:40273,59972:40272,59973:40281,59974:40306,59975:40329,59976:40327,59977:40363,59978:40303,59979:40314,59980:40346,59981:40356,59982:40361,59983:40370,59984:40388,59985:40385,59986:40379,59987:40376,59988:40378,59989:40390,59990:40399,59991:40386,59992:40409,59993:40403,59994:40440,59995:40422,59996:40429,59997:40431,59998:40445,59999:40474,6e4:40475,60001:40478,60002:40565,60003:40569,60004:40573,60005:40577,60006:40584,60007:40587,60008:40588,60009:40594,60010:40597,60011:40593,60012:40605,60013:40613,60014:40617,60015:40632,60016:40618,60017:40621,60018:38753,60019:40652,60020:40654,60021:40655,60022:40656,60023:40660,60024:40668,60025:40670,60026:40669,60027:40672,60028:40677,60029:40680,60030:40687,60032:40692,60033:40694,60034:40695,60035:40697,60036:40699,60037:40700,60038:40701,60039:40711,60040:40712,60041:30391,60042:40725,60043:40737,60044:40748,60045:40766,60046:40778,60047:40786,60048:40788,60049:40803,60050:40799,60051:40800,60052:40801,60053:40806,60054:40807,60055:40812,60056:40810,60057:40823,60058:40818,60059:40822,60060:40853,60061:40860,60062:40864,60063:22575,60064:27079,60065:36953,60066:29796,60067:20956,60068:29081}}),(function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var x=o(1),i=o(2);function a(c,p,B,A){var k;p.degree()<B.degree()&&(k=[B,p],p=k[0],B=k[1]);for(var C=p,b=B,v=c.zero,F=c.one;b.degree()>=A/2;){var m=C,f=v;if(C=b,v=F,C.isZero())return null;b=m;for(var D=c.zero,h=C.getCoefficient(C.degree()),E=c.inverse(h);b.degree()>=C.degree()&&!b.isZero();){var w=b.degree()-C.degree(),P=c.multiply(b.getCoefficient(b.degree()),E);D=D.addOrSubtract(c.buildMonomial(w,P)),b=b.addOrSubtract(C.multiplyByMonomial(w,P))}if(F=D.multiplyPoly(v).addOrSubtract(f),b.degree()>=C.degree())return null}var I=F.getCoefficient(0);if(I===0)return null;var j=c.inverse(I);return[F.multiply(j),b.multiply(j)]}function l(c,p){var B=p.degree();if(B===1)return[p.getCoefficient(1)];for(var A=new Array(B),k=0,C=1;C<c.size&&k<B;C++)p.evaluateAt(C)===0&&(A[k]=c.inverse(C),k++);return k!==B?null:A}function d(c,p,B){for(var A=B.length,k=new Array(A),C=0;C<A;C++){for(var b=c.inverse(B[C]),v=1,F=0;F<A;F++)C!==F&&(v=c.multiply(v,x.addOrSubtractGF(1,c.multiply(B[F],b))));k[C]=c.multiply(p.evaluateAt(b),c.inverse(v)),c.generatorBase!==0&&(k[C]=c.multiply(k[C],b))}return k}function u(c,p){var B=new Uint8ClampedArray(c.length);B.set(c);for(var A=new x.default(285,256,0),k=new i.default(A,B),C=new Uint8ClampedArray(p),b=!1,v=0;v<p;v++){var F=k.evaluateAt(A.exp(v+A.generatorBase));C[C.length-1-v]=F,F!==0&&(b=!0)}if(!b)return B;var m=new i.default(A,C),f=a(A,A.buildMonomial(p,1),m,p);if(f===null)return null;var D=l(A,f[0]);if(D==null)return null;for(var h=d(A,f[1],D),E=0;E<D.length;E++){var w=B.length-1-A.log(D[E]);if(w<0)return null;B[w]=x.addOrSubtractGF(B[w],h[E])}return B}r.decode=u}),(function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.VERSIONS=[{infoBits:null,versionNumber:1,alignmentPatternCenters:[],errorCorrectionLevels:[{ecCodewordsPerBlock:7,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:13,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:13}]},{ecCodewordsPerBlock:17,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:2,alignmentPatternCenters:[6,18],errorCorrectionLevels:[{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:34}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:28}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]}]},{infoBits:null,versionNumber:3,alignmentPatternCenters:[6,22],errorCorrectionLevels:[{ecCodewordsPerBlock:15,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:55}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:13}]}]},{infoBits:null,versionNumber:4,alignmentPatternCenters:[6,26],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:80}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:32}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:5,alignmentPatternCenters:[6,30],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:43}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:11},{numBlocks:2,dataCodewordsPerBlock:12}]}]},{infoBits:null,versionNumber:6,alignmentPatternCenters:[6,34],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:27}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:31892,versionNumber:7,alignmentPatternCenters:[6,22,38],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:78}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:31}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:13},{numBlocks:1,dataCodewordsPerBlock:14}]}]},{infoBits:34236,versionNumber:8,alignmentPatternCenters:[6,24,42],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:97}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:38},{numBlocks:2,dataCodewordsPerBlock:39}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:18},{numBlocks:2,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:14},{numBlocks:2,dataCodewordsPerBlock:15}]}]},{infoBits:39577,versionNumber:9,alignmentPatternCenters:[6,26,46],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:12},{numBlocks:4,dataCodewordsPerBlock:13}]}]},{infoBits:42195,versionNumber:10,alignmentPatternCenters:[6,28,50],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68},{numBlocks:2,dataCodewordsPerBlock:69}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:43},{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]}]},{infoBits:48118,versionNumber:11,alignmentPatternCenters:[6,30,54],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:81}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:50},{numBlocks:4,dataCodewordsPerBlock:51}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:22},{numBlocks:4,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:12},{numBlocks:8,dataCodewordsPerBlock:13}]}]},{infoBits:51042,versionNumber:12,alignmentPatternCenters:[6,32,58],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:92},{numBlocks:2,dataCodewordsPerBlock:93}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:20},{numBlocks:6,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:55367,versionNumber:13,alignmentPatternCenters:[6,34,62],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:37},{numBlocks:1,dataCodewordsPerBlock:38}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:20},{numBlocks:4,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:11},{numBlocks:4,dataCodewordsPerBlock:12}]}]},{infoBits:58893,versionNumber:14,alignmentPatternCenters:[6,26,46,66],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:40},{numBlocks:5,dataCodewordsPerBlock:41}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:16},{numBlocks:5,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:5,dataCodewordsPerBlock:13}]}]},{infoBits:63784,versionNumber:15,alignmentPatternCenters:[6,26,48,70],errorCorrectionLevels:[{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:87},{numBlocks:1,dataCodewordsPerBlock:88}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:41},{numBlocks:5,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:7,dataCodewordsPerBlock:13}]}]},{infoBits:68472,versionNumber:16,alignmentPatternCenters:[6,26,50,74],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:98},{numBlocks:1,dataCodewordsPerBlock:99}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:70749,versionNumber:17,alignmentPatternCenters:[6,30,54,78],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:1,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22},{numBlocks:15,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:17,dataCodewordsPerBlock:15}]}]},{infoBits:76311,versionNumber:18,alignmentPatternCenters:[6,30,56,82],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:120},{numBlocks:1,dataCodewordsPerBlock:121}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:43},{numBlocks:4,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:1,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:19,dataCodewordsPerBlock:15}]}]},{infoBits:79154,versionNumber:19,alignmentPatternCenters:[6,30,58,86],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:113},{numBlocks:4,dataCodewordsPerBlock:114}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:44},{numBlocks:11,dataCodewordsPerBlock:45}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:21},{numBlocks:4,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:13},{numBlocks:16,dataCodewordsPerBlock:14}]}]},{infoBits:84390,versionNumber:20,alignmentPatternCenters:[6,34,62,90],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:41},{numBlocks:13,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:5,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:15},{numBlocks:10,dataCodewordsPerBlock:16}]}]},{infoBits:87683,versionNumber:21,alignmentPatternCenters:[6,28,50,72,94],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:116},{numBlocks:4,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:16},{numBlocks:6,dataCodewordsPerBlock:17}]}]},{infoBits:92361,versionNumber:22,alignmentPatternCenters:[6,26,50,74,98],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:111},{numBlocks:7,dataCodewordsPerBlock:112}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:13}]}]},{infoBits:96236,versionNumber:23,alignmentPatternCenters:[6,30,54,74,102],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:121},{numBlocks:5,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:47},{numBlocks:14,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:16,dataCodewordsPerBlock:15},{numBlocks:14,dataCodewordsPerBlock:16}]}]},{infoBits:102084,versionNumber:24,alignmentPatternCenters:[6,28,54,80,106],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:45},{numBlocks:14,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:30,dataCodewordsPerBlock:16},{numBlocks:2,dataCodewordsPerBlock:17}]}]},{infoBits:102881,versionNumber:25,alignmentPatternCenters:[6,32,58,84,110],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:106},{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:47},{numBlocks:13,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:110507,versionNumber:26,alignmentPatternCenters:[6,30,58,86,114],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:114},{numBlocks:2,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:46},{numBlocks:4,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:28,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:33,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]}]},{infoBits:110734,versionNumber:27,alignmentPatternCenters:[6,34,62,90,118],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:23},{numBlocks:26,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:117786,versionNumber:28,alignmentPatternCenters:[6,26,50,74,98,122],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:117},{numBlocks:10,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:45},{numBlocks:23,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:24},{numBlocks:31,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:31,dataCodewordsPerBlock:16}]}]},{infoBits:119615,versionNumber:29,alignmentPatternCenters:[6,30,54,78,102,126],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:116},{numBlocks:7,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:21,dataCodewordsPerBlock:45},{numBlocks:7,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:23},{numBlocks:37,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:26,dataCodewordsPerBlock:16}]}]},{infoBits:126325,versionNumber:30,alignmentPatternCenters:[6,26,52,78,104,130],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:115},{numBlocks:10,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:47},{numBlocks:10,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:25,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:25,dataCodewordsPerBlock:16}]}]},{infoBits:127568,versionNumber:31,alignmentPatternCenters:[6,30,56,82,108,134],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:3,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:46},{numBlocks:29,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:24},{numBlocks:1,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:133589,versionNumber:32,alignmentPatternCenters:[6,34,60,86,112,138],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:24},{numBlocks:35,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:35,dataCodewordsPerBlock:16}]}]},{infoBits:136944,versionNumber:33,alignmentPatternCenters:[6,30,58,86,114,142],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:21,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:24},{numBlocks:19,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:141498,versionNumber:34,alignmentPatternCenters:[6,34,62,90,118,146],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:6,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:44,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:59,dataCodewordsPerBlock:16},{numBlocks:1,dataCodewordsPerBlock:17}]}]},{infoBits:145311,versionNumber:35,alignmentPatternCenters:[6,30,54,78,102,126,150],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:121},{numBlocks:7,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:47},{numBlocks:26,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:39,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:41,dataCodewordsPerBlock:16}]}]},{infoBits:150283,versionNumber:36,alignmentPatternCenters:[6,24,50,76,102,128,154],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:121},{numBlocks:14,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:47},{numBlocks:34,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:46,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:64,dataCodewordsPerBlock:16}]}]},{infoBits:152622,versionNumber:37,alignmentPatternCenters:[6,28,54,80,106,132,158],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:46},{numBlocks:14,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:49,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:24,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:158308,versionNumber:38,alignmentPatternCenters:[6,32,58,84,110,136,162],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:122},{numBlocks:18,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:46},{numBlocks:32,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:48,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:15},{numBlocks:32,dataCodewordsPerBlock:16}]}]},{infoBits:161089,versionNumber:39,alignmentPatternCenters:[6,26,54,82,110,138,166],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:40,dataCodewordsPerBlock:47},{numBlocks:7,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:43,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:15},{numBlocks:67,dataCodewordsPerBlock:16}]}]},{infoBits:167017,versionNumber:40,alignmentPatternCenters:[6,30,58,86,114,142,170],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:118},{numBlocks:6,dataCodewordsPerBlock:119}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:18,dataCodewordsPerBlock:47},{numBlocks:31,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:24},{numBlocks:34,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:15},{numBlocks:61,dataCodewordsPerBlock:16}]}]}]}),(function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var x=o(0);function i(u,c,p,B){var A=u.x-c.x+p.x-B.x,k=u.y-c.y+p.y-B.y;if(A===0&&k===0)return{a11:c.x-u.x,a12:c.y-u.y,a13:0,a21:p.x-c.x,a22:p.y-c.y,a23:0,a31:u.x,a32:u.y,a33:1};var C=c.x-p.x,b=B.x-p.x,v=c.y-p.y,F=B.y-p.y,m=C*F-b*v,f=(A*F-b*k)/m,D=(C*k-A*v)/m;return{a11:c.x-u.x+f*c.x,a12:c.y-u.y+f*c.y,a13:f,a21:B.x-u.x+D*B.x,a22:B.y-u.y+D*B.y,a23:D,a31:u.x,a32:u.y,a33:1}}function a(u,c,p,B){var A=i(u,c,p,B);return{a11:A.a22*A.a33-A.a23*A.a32,a12:A.a13*A.a32-A.a12*A.a33,a13:A.a12*A.a23-A.a13*A.a22,a21:A.a23*A.a31-A.a21*A.a33,a22:A.a11*A.a33-A.a13*A.a31,a23:A.a13*A.a21-A.a11*A.a23,a31:A.a21*A.a32-A.a22*A.a31,a32:A.a12*A.a31-A.a11*A.a32,a33:A.a11*A.a22-A.a12*A.a21}}function l(u,c){return{a11:u.a11*c.a11+u.a21*c.a12+u.a31*c.a13,a12:u.a12*c.a11+u.a22*c.a12+u.a32*c.a13,a13:u.a13*c.a11+u.a23*c.a12+u.a33*c.a13,a21:u.a11*c.a21+u.a21*c.a22+u.a31*c.a23,a22:u.a12*c.a21+u.a22*c.a22+u.a32*c.a23,a23:u.a13*c.a21+u.a23*c.a22+u.a33*c.a23,a31:u.a11*c.a31+u.a21*c.a32+u.a31*c.a33,a32:u.a12*c.a31+u.a22*c.a32+u.a32*c.a33,a33:u.a13*c.a31+u.a23*c.a32+u.a33*c.a33}}function d(u,c){for(var p=a({x:3.5,y:3.5},{x:c.dimension-3.5,y:3.5},{x:c.dimension-6.5,y:c.dimension-6.5},{x:3.5,y:c.dimension-3.5}),B=i(c.topLeft,c.topRight,c.alignmentPattern,c.bottomLeft),A=l(B,p),k=x.BitMatrix.createEmpty(c.dimension,c.dimension),C=function(D,h){var E=A.a13*D+A.a23*h+A.a33;return{x:(A.a11*D+A.a21*h+A.a31)/E,y:(A.a12*D+A.a22*h+A.a32)/E}},b=0;b<c.dimension;b++)for(var v=0;v<c.dimension;v++){var F=v+.5,m=b+.5,f=C(F,m);k.set(v,b,u.get(Math.floor(f.x),Math.floor(f.y)))}return{matrix:k,mappingFunction:C}}r.extract=d}),(function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var x=4,i=.5,a=1.5,l=function(F,m){return Math.sqrt(Math.pow(m.x-F.x,2)+Math.pow(m.y-F.y,2))};function d(F){return F.reduce(function(m,f){return m+f})}function u(F,m,f){var D,h,E,w,P=l(F,m),I=l(m,f),j=l(F,f),y,_,L;return I>=P&&I>=j?(D=[m,F,f],y=D[0],_=D[1],L=D[2]):j>=I&&j>=P?(h=[F,m,f],y=h[0],_=h[1],L=h[2]):(E=[F,f,m],y=E[0],_=E[1],L=E[2]),(L.x-_.x)*(y.y-_.y)-(L.y-_.y)*(y.x-_.x)<0&&(w=[L,y],y=w[0],L=w[1]),{bottomLeft:y,topLeft:_,topRight:L}}function c(F,m,f,D){var h=(d(B(F,f,D,5))/7+d(B(F,m,D,5))/7+d(B(f,F,D,5))/7+d(B(m,F,D,5))/7)/4;if(h<1)throw new Error("Invalid module size");var E=Math.round(l(F,m)/h),w=Math.round(l(F,f)/h),P=Math.floor((E+w)/2)+7;switch(P%4){case 0:P++;break;case 2:P--;break}return{dimension:P,moduleSize:h}}function p(F,m,f,D){var h=[{x:Math.floor(F.x),y:Math.floor(F.y)}],E=Math.abs(m.y-F.y)>Math.abs(m.x-F.x),w,P,I,j;E?(w=Math.floor(F.y),P=Math.floor(F.x),I=Math.floor(m.y),j=Math.floor(m.x)):(w=Math.floor(F.x),P=Math.floor(F.y),I=Math.floor(m.x),j=Math.floor(m.y));for(var y=Math.abs(I-w),_=Math.abs(j-P),L=Math.floor(-y/2),K=w<I?1:-1,M=P<j?1:-1,z=!0,q=w,J=P;q!==I+K;q+=K){var R=E?J:q,se=E?q:J;if(f.get(R,se)!==z&&(z=!z,h.push({x:R,y:se}),h.length===D+1))break;if(L+=_,L>0){if(J===j)break;J+=M,L-=y}}for(var $=[],Y=0;Y<D;Y++)h[Y]&&h[Y+1]?$.push(l(h[Y],h[Y+1])):$.push(0);return $}function B(F,m,f,D){var h,E=m.y-F.y,w=m.x-F.x,P=p(F,m,f,Math.ceil(D/2)),I=p(F,{x:F.x-w,y:F.y-E},f,Math.ceil(D/2)),j=P.shift()+I.shift()-1;return(h=I.concat(j)).concat.apply(h,P)}function A(F,m){var f=d(F)/d(m),D=0;return m.forEach(function(h,E){D+=Math.pow(F[E]-h*f,2)}),{averageSize:f,error:D}}function k(F,m,f){try{var D=B(F,{x:-1,y:F.y},f,m.length),h=B(F,{x:F.x,y:-1},f,m.length),E={x:Math.max(0,F.x-F.y)-1,y:Math.max(0,F.y-F.x)-1},w=B(F,E,f,m.length),P={x:Math.min(f.width,F.x+F.y)+1,y:Math.min(f.height,F.y+F.x)+1},I=B(F,P,f,m.length),j=A(D,m),y=A(h,m),_=A(w,m),L=A(I,m),K=Math.sqrt(j.error*j.error+y.error*y.error+_.error*_.error+L.error*L.error),M=(j.averageSize+y.averageSize+_.averageSize+L.averageSize)/4,z=(Math.pow(j.averageSize-M,2)+Math.pow(y.averageSize-M,2)+Math.pow(_.averageSize-M,2)+Math.pow(L.averageSize-M,2))/M;return K+z}catch{return 1/0}}function C(F,m){for(var f=Math.round(m.x);F.get(f,Math.round(m.y));)f--;for(var D=Math.round(m.x);F.get(D,Math.round(m.y));)D++;for(var h=(f+D)/2,E=Math.round(m.y);F.get(Math.round(h),E);)E--;for(var w=Math.round(m.y);F.get(Math.round(h),w);)w++;var P=(E+w)/2;return{x:h,y:P}}function b(F){for(var m=[],f=[],D=[],h=[],E=function(R){for(var se=0,$=!1,Y=[0,0,0,0,0],Pe=function(Z){var Ee=F.get(Z,R);if(Ee===$)se++;else{Y=[Y[1],Y[2],Y[3],Y[4],se],se=1,$=Ee;var Fe=d(Y)/7,qe=Math.abs(Y[0]-Fe)<Fe&&Math.abs(Y[1]-Fe)<Fe&&Math.abs(Y[2]-3*Fe)<3*Fe&&Math.abs(Y[3]-Fe)<Fe&&Math.abs(Y[4]-Fe)<Fe&&!Ee,me=d(Y.slice(-3))/3,it=Math.abs(Y[2]-me)<me&&Math.abs(Y[3]-me)<me&&Math.abs(Y[4]-me)<me&&Ee;if(qe){var Ie=Z-Y[3]-Y[4],Ue=Ie-Y[2],Le={startX:Ue,endX:Ie,y:R},$e=f.filter(function(Ce){return Ue>=Ce.bottom.startX&&Ue<=Ce.bottom.endX||Ie>=Ce.bottom.startX&&Ue<=Ce.bottom.endX||Ue<=Ce.bottom.startX&&Ie>=Ce.bottom.endX&&Y[2]/(Ce.bottom.endX-Ce.bottom.startX)<a&&Y[2]/(Ce.bottom.endX-Ce.bottom.startX)>i});$e.length>0?$e[0].bottom=Le:f.push({top:Le,bottom:Le})}if(it){var at=Z-Y[4],re=at-Y[3],Le={startX:re,y:R,endX:at},$e=h.filter(function(je){return re>=je.bottom.startX&&re<=je.bottom.endX||at>=je.bottom.startX&&re<=je.bottom.endX||re<=je.bottom.startX&&at>=je.bottom.endX&&Y[2]/(je.bottom.endX-je.bottom.startX)<a&&Y[2]/(je.bottom.endX-je.bottom.startX)>i});$e.length>0?$e[0].bottom=Le:h.push({top:Le,bottom:Le})}}},pe=-1;pe<=F.width;pe++)Pe(pe);m.push.apply(m,f.filter(function(Z){return Z.bottom.y!==R&&Z.bottom.y-Z.top.y>=2})),f=f.filter(function(Z){return Z.bottom.y===R}),D.push.apply(D,h.filter(function(Z){return Z.bottom.y!==R})),h=h.filter(function(Z){return Z.bottom.y===R})},w=0;w<=F.height;w++)E(w);m.push.apply(m,f.filter(function(R){return R.bottom.y-R.top.y>=2})),D.push.apply(D,h);var P=m.filter(function(R){return R.bottom.y-R.top.y>=2}).map(function(R){var se=(R.top.startX+R.top.endX+R.bottom.startX+R.bottom.endX)/4,$=(R.top.y+R.bottom.y+1)/2;if(F.get(Math.round(se),Math.round($))){var Y=[R.top.endX-R.top.startX,R.bottom.endX-R.bottom.startX,R.bottom.y-R.top.y+1],Pe=d(Y)/Y.length,pe=k({x:Math.round(se),y:Math.round($)},[1,1,3,1,1],F);return{score:pe,x:se,y:$,size:Pe}}}).filter(function(R){return!!R}).sort(function(R,se){return R.score-se.score}).map(function(R,se,$){if(se>x)return null;var Y=$.filter(function(pe,Z){return se!==Z}).map(function(pe){return{x:pe.x,y:pe.y,score:pe.score+Math.pow(pe.size-R.size,2)/R.size,size:pe.size}}).sort(function(pe,Z){return pe.score-Z.score});if(Y.length<2)return null;var Pe=R.score+Y[0].score+Y[1].score;return{points:[R].concat(Y.slice(0,2)),score:Pe}}).filter(function(R){return!!R}).sort(function(R,se){return R.score-se.score});if(P.length===0)return null;var I=u(P[0].points[0],P[0].points[1],P[0].points[2]),j=I.topRight,y=I.topLeft,_=I.bottomLeft,L=v(F,D,j,y,_),K=[];L&&K.push({alignmentPattern:{x:L.alignmentPattern.x,y:L.alignmentPattern.y},bottomLeft:{x:_.x,y:_.y},dimension:L.dimension,topLeft:{x:y.x,y:y.y},topRight:{x:j.x,y:j.y}});var M=C(F,j),z=C(F,y),q=C(F,_),J=v(F,D,M,z,q);return J&&K.push({alignmentPattern:{x:J.alignmentPattern.x,y:J.alignmentPattern.y},bottomLeft:{x:q.x,y:q.y},topLeft:{x:z.x,y:z.y},topRight:{x:M.x,y:M.y},dimension:J.dimension}),K.length===0?null:K}r.locate=b;function v(F,m,f,D,h){var E,w,P;try{E=c(D,f,h,F),w=E.dimension,P=E.moduleSize}catch{return null}var I={x:f.x-D.x+h.x,y:f.y-D.y+h.y},j=(l(D,h)+l(D,f))/2/P,y=1-3/j,_={x:D.x+y*(I.x-D.x),y:D.y+y*(I.y-D.y)},L=m.map(function(M){var z=(M.top.startX+M.top.endX+M.bottom.startX+M.bottom.endX)/4,q=(M.top.y+M.bottom.y+1)/2;if(F.get(Math.floor(z),Math.floor(q))){var J=[M.top.endX-M.top.startX,M.bottom.endX-M.bottom.startX,M.bottom.y-M.top.y+1];d(J)/J.length;var R=k({x:Math.floor(z),y:Math.floor(q)},[1,1,1],F),se=R+l({x:z,y:q},_);return{x:z,y:q,score:se}}}).filter(function(M){return!!M}).sort(function(M,z){return M.score-z.score}),K=j>=15&&L.length?L[0]:_;return{alignmentPattern:K,dimension:w}}})]).default})})(Un)),Un.exports}var b8=w8();const j8=ao(b8);function rn(e){const t=e.trim().toLowerCase();if(!t)return 0;if(/front|facetime|true\s*depth|user/.test(t))return-500;let n=0;return/back|rear|environment/.test(t)&&(n+=120),/^(back|rear)( camera)?$/.test(t)&&(n+=300),/dual|triple/.test(t)&&(n+=30),/\bwide\b/.test(t)&&(n+=20),/ultra[ -]?wide|telephoto|\btele\b/.test(t)&&(n-=160),n}function _8(e){const t=e.filter(x=>x.kind==="videoinput"),n=t.filter(x=>/back|rear|environment/i.test(x.label)),r=t.filter(x=>rn(x.label)>-500);return(n.length>0?n:r.length>0?r:t).map((x,i)=>({device:x,index:i})).sort((x,i)=>rn(i.device.label)-rn(x.device.label)||x.index-i.index).map(({device:x})=>x)}function S8(e,t){return!e||!t||e.deviceId===t.deviceId?!1:rn(t.label)>=rn(e.label)+80}function P8(e){return{...e?{deviceId:{exact:e}}:{facingMode:{ideal:"environment"}},width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30,max:30}}}function Xs(e){const t=e.getCapabilities();return Array.isArray(t.focusMode)?t.focusMode:[]}function I8(e,t,n,r){if(e<=0||t<=0||n.width<=0||n.height<=0)return{sx:0,sy:0,sw:Math.max(e,1),sh:Math.max(t,1)};const o=Math.max(n.width/e,n.height/t),x=(e*o-n.width)/2,i=(t*o-n.height)/2,a=(r.left-n.left+x)/o,l=(r.top-n.top+i)/o,d=r.width/o,u=r.height/o,c=Math.max(0,Math.min(e-1,a)),p=Math.max(0,Math.min(t-1,l));return{sx:c,sy:p,sw:Math.max(1,Math.min(d,e-c)),sh:Math.max(1,Math.min(u,t-p))}}const Pt=720;function N8({onCode:e,onClose:t}){const n=g.useRef(null),r=g.useRef(null),o=g.useRef(e),x=g.useRef(()=>{}),i=g.useRef(()=>{}),[a,l]=g.useState(null),[d,u]=g.useState(!1),[c,p]=g.useState([]),[B,A]=g.useState(""),[k,C]=g.useState("Starting rear camera…");g.useEffect(()=>{o.current=e},[e]),g.useEffect(()=>{let F=!0,m=null,f=null,D=[],h="";const E=new Set,w=document.createElement("canvas"),P=w.getContext("2d",{willReadFrequently:!0});function I(){const M=n.current,z=r.current;if(!M||!z||!P||M.readyState<2)return;const q=I8(M.videoWidth,M.videoHeight,M.getBoundingClientRect(),z.getBoundingClientRect());w.width=Pt,w.height=Pt,P.imageSmoothingEnabled=!0,P.imageSmoothingQuality="high",P.drawImage(M,q.sx,q.sy,q.sw,q.sh,0,0,Pt,Pt);const J=P.getImageData(0,0,Pt,Pt),R=j8(J.data,J.width,J.height,{inversionAttempts:"attemptBoth"});R?.data&&o.current(R.data)&&j()}function j(){f!==null&&clearInterval(f),f=null;for(const z of m?.getTracks()??[])z.stop();m=null;const M=n.current;M&&(M.srcObject=null)}async function y(M,z){try{const q={focusMode:z};return await M.applyConstraints({advanced:[q]}),!0}catch{return!1}}async function _(M){let z=[];try{z=Xs(M)}catch{return!1}return z.includes("continuous")&&y(M,"continuous")}async function L(){try{const M=await navigator.mediaDevices.enumerateDevices();return _8(M).filter(z=>!E.has(z.deviceId))}catch{return[]}}async function K(M,z=!0){if(j(),!!F){u(!1),l(null),C("Starting rear camera…");try{const q=await navigator.mediaDevices.getUserMedia({audio:!1,video:P8(M)});if(!F){for(const se of q.getTracks())se.stop();return}m=q;const J=q.getVideoTracks()[0];if(!J)throw new Error("Camera returned no video track");h=J.getSettings().deviceId??M??"",A(h),await _(J);const R=n.current;if(R&&(R.srcObject=q,await R.play().catch(()=>{})),!F)return;if(u(!0),C("Fit the full white border inside the frame and hold steady."),f=setInterval(I,180),z){if(D=await L(),!F)return;p(D);const se=D.find(Y=>Y.deviceId===h),$=D[0];S8(se,$)&&await K($?.deviceId,!1)}}catch{if(M&&F){E.add(M),await K(void 0,!0);return}F&&(u(!1),l("Camera unavailable. Paste the pairing link below the scanner instead."))}}}return x.current=()=>{if(D.length<2)return;const M=D.findIndex(q=>q.deviceId===h),z=D[(M+1+D.length)%D.length];z&&K(z.deviceId,!1)},i.current=()=>{const M=m?.getVideoTracks()[0];M&&(async()=>{C("Refocusing…");let z=[];try{z=Xs(M)}catch{}let q=!1;if(z.includes("single-shot")&&(q=await y(M,"single-shot"),q&&await new Promise(J=>setTimeout(J,300))),z.includes("continuous")&&(q=await y(M,"continuous")||q),!q){await K(h||void 0,!1);return}F&&C("Focus refreshed. Keep the white border inside the frame.")})()},navigator.mediaDevices?.getUserMedia?K():l("This browser cannot open the camera. Paste the pairing link instead."),()=>{F=!1,x.current=()=>{},i.current=()=>{},j()}},[]);const b=c.find(F=>F.deviceId===B),v=a??k;return s.jsxs(ke.div,{className:"scanner",role:"dialog","aria-modal":"true","aria-label":"Scan the pairing QR",initial:{opacity:0},animate:{opacity:1,transition:ze},exit:{opacity:0,transition:We},children:[s.jsx("video",{ref:n,className:"scanvid",autoPlay:!0,playsInline:!0,muted:!0,"aria-hidden":"true"}),s.jsxs("div",{ref:r,className:"scanframe","aria-hidden":"true",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]}),s.jsxs("div",{className:"scancontrols",children:[s.jsxs("div",{className:"scanstatus","data-ready":d&&!a?"true":"false",children:[s.jsx("span",{"aria-hidden":"true"}),a?"Camera needs attention":d?b?.label||"Rear camera ready":"Opening camera"]}),s.jsx("p",{className:"scanhint",role:"status",children:v}),s.jsxs("div",{className:"scanactions",children:[d&&!a?s.jsxs(te,{className:"scanfocus",onClick:()=>i.current(),label:"Refocus camera",children:[s.jsx(dc,{size:18,strokeWidth:2.2,"aria-hidden":"true"}),"Refocus"]}):null,c.length>1&&!a?s.jsxs(te,{className:"scanswitch",onClick:()=>x.current(),label:"Switch rear camera lens",children:[s.jsx(Vc,{size:18,strokeWidth:2.2,"aria-hidden":"true"}),"Switch lens"]}):null,s.jsxs(te,{className:"scanclose",onClick:t,label:"Stop scanning",children:[s.jsx(pt,{size:18,strokeWidth:2.4,"aria-hidden":"true"}),"Cancel"]})]})]})]})}function Lx(e){const t=new URLSearchParams(e);return t.get("session")??(t.has("c")?null:t.get("s"))}function M8(e){return Lx(e)!==null}function T8(e,t){return e===t}const O8="longleash.delegation-return.v1.";function Tr(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function eo(){return globalThis.crypto?.randomUUID?.()??`return-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Or(e){return`${O8}${encodeURIComponent(e)}`}function L8(e,t=Tr()){try{if(t===null)return null;const n=t.getItem(Or(e));if(n===null)return null;const r=JSON.parse(n);return r.delegationId!==e||typeof r.idempotencyKey!="string"||r.idempotencyKey.trim()===""||typeof r.returnText!="string"||typeof r.updatedAt!="number"?null:r}catch{return null}}function R8(e,t=Tr()){try{return t===null?!1:(t.setItem(Or(e.delegationId),JSON.stringify(e)),!0)}catch{return!1}}function Rx(e,t=Tr()){try{t?.removeItem(Or(e))}catch{}}function to(){return globalThis.crypto?.randomUUID?.()??`return-${Date.now()}-${Math.random().toString(36).slice(2)}`}function U8({open:e,delegation:t,preview:n,error:r,connected:o,onPrepare:x,onReturn:i,onClose:a}){const l=zt(e),d=Wt(e),u=vt(),c=g.useRef(null);return g.useEffect(()=>{if(!e)return;const p=document.activeElement,B=()=>Array.from(c.current?.querySelectorAll('button:not(:disabled), textarea:not(:disabled), input:not(:disabled), [tabindex="0"]')??[]);B()[0]?.focus();const A=k=>{if(k.key==="Escape"){k.preventDefault(),a();return}if(k.key!=="Tab")return;const C=B(),b=C[0],v=C[C.length-1];!b||!v||(k.shiftKey&&document.activeElement===b?(k.preventDefault(),v.focus()):!k.shiftKey&&document.activeElement===v&&(k.preventDefault(),b.focus()))};return window.addEventListener("keydown",A),()=>{window.removeEventListener("keydown",A),p?.focus()}},[e,a]),s.jsx(xt,{children:e?s.jsxs(s.Fragment,{children:[s.jsx(ke.div,{className:"scrim",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,transition:We},onClick:a}),s.jsxs(ke.div,{ref:c,className:"sheet return-sheet",style:{...l>0?{bottom:l}:{},...d===null?{}:{maxHeight:`${Math.max(180,d-8)}px`}},role:"dialog","aria-modal":"true","aria-label":"Review delegated return",initial:u?!1:{y:"100%"},animate:{y:0},...u?{}:{exit:{y:"100%",transition:We}},transition:ze,children:[s.jsxs("div",{className:"sheetbar",children:[s.jsx("div",{className:"grab","aria-hidden":"true"}),s.jsx("button",{type:"button",className:"sheetclose",onClick:a,"aria-label":"Close reviewed return",children:s.jsx(pt,{size:19,strokeWidth:2.2,"aria-hidden":"true"})})]}),s.jsx("div",{className:"sheet-in",children:s.jsx($8,{delegation:t,preview:n,error:r,connected:o,onPrepare:x,onReturn:i},t.delegationId)})]})]}):null})}function $8({delegation:e,preview:t,error:n,connected:r,onPrepare:o,onReturn:x}){const i=L8(e.delegationId),a=t?.delegationId===e.delegationId?t:null,[l,d]=g.useState(i?.returnText??a?.returnText??""),[u,c]=g.useState(i?.idempotencyKey??eo()),[p,B]=g.useState(null),[A,k]=g.useState(null),[C,b]=g.useState(!1),[v,F]=g.useState("idle"),m=g.useId(),f=n!==null&&(n.requestId===p||n.requestId===A)?n.message:null,D=p!==null&&a?.requestId!==p&&f===null,h=A!==null&&f===null&&e.status!=="returned",E=a?.context.maxCharacters??24e3,w=l.length>E,P=r&&a!==null&&l.trim()!==""&&!w&&!h&&(a?.requiresTakeover!==!0||C);g.useEffect(()=>{a===null||a.requestId!==p||(d(_=>_===""?a.returnText:_),B(null))},[a,p]),g.useEffect(()=>{R8({delegationId:e.delegationId,idempotencyKey:u,returnText:l,updatedAt:Date.now()})},[e.delegationId,u,l]);const I=()=>{const _=to();B(_),o({requestId:_,delegationId:e.delegationId})},j=()=>{if(!P)return;const _=to();k(_),x({requestId:_,idempotencyKey:u,delegationId:e.delegationId,returnText:l,takeoverConfirmed:C})},y=()=>{navigator.clipboard&&navigator.clipboard.writeText(l).then(()=>{F("copied"),setTimeout(()=>F("idle"),2200)}).catch(()=>F("failed"))};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"delegate-title",children:[s.jsx("span",{className:"delegate-mark return-mark","aria-hidden":"true",children:s.jsx(M0,{size:18,strokeWidth:2.2})}),s.jsxs("div",{children:[s.jsx("h2",{children:"Review return"}),s.jsx("p",{className:"sub",children:"Read and edit the child’s completed result before it crosses back."})]})]}),s.jsxs("div",{className:"return-route","aria-label":"Return route",children:[s.jsxs("span",{children:[s.jsx("small",{children:"From child"}),s.jsx("strong",{children:a?.child.title??e.targetAgent})]}),s.jsx(M0,{size:17,strokeWidth:2.2,"aria-hidden":"true"}),s.jsxs("span",{children:[s.jsx("small",{children:"Into parent"}),s.jsx("strong",{children:a?.parent.title??"source session"})]})]}),a?s.jsxs("p",{className:"return-attribution",children:[s.jsx("span",{children:"Attached attribution"}),a.attribution]}):null,a===null&&l===""?s.jsxs(s.Fragment,{children:[s.jsx(te,{className:"primary wide return-prepare",disabled:!r||D,onClick:I,children:D?"Preparing completed result…":"Prepare return draft"}),s.jsx("p",{className:`delegate-status${f?" bad":""}`,role:"status","aria-live":"polite",children:f??"Only the child’s last completed prose response is selected. Tools and thinking stay out."})]}):s.jsxs(s.Fragment,{children:[a===null?s.jsx(te,{className:"secondary wide return-prepare",disabled:!r||D,onClick:I,children:D?"Verifying current route…":"Verify parent and child"}):null,s.jsxs("div",{className:"briefing-editor return-editor",children:[s.jsxs("div",{className:"briefing-head",children:[s.jsx("label",{htmlFor:m,children:"Reviewed return"}),s.jsxs("button",{type:"button",className:"tap quiet",onClick:y,"aria-label":"Copy reviewed return",children:[v==="copied"?s.jsx(Ke,{size:14,strokeWidth:2.4,"aria-hidden":"true"}):s.jsx(ho,{size:14,strokeWidth:2.2,"aria-hidden":"true"}),v==="copied"?"Copied":v==="failed"?"Select to copy":"Copy"]})]}),s.jsx("textarea",{id:m,className:"field briefing-field return-field",value:l,onChange:_=>d(_.target.value),disabled:h,rows:14,"aria-describedby":`${m}-meta`}),s.jsxs("div",{className:"briefing-meta",id:`${m}-meta`,children:[s.jsxs("span",{children:[l.length.toLocaleString()," / ",E.toLocaleString()," characters"]}),a?.context.truncated?s.jsx("span",{children:"Middle shortened — review carefully"}):null,s.jsx("button",{type:"button",className:"tap quiet",onClick:()=>{Rx(e.delegationId),d(a?.returnText??"")},children:"Reset edits"})]})]}),a?.requiresTakeover?s.jsxs("label",{className:"takeover-confirm",children:[s.jsx("input",{type:"checkbox",checked:C,onChange:_=>b(_.target.checked),disabled:h}),s.jsx("span",{className:"takeover-check","aria-hidden":"true",children:s.jsx(Ke,{size:15,strokeWidth:2.7})}),s.jsxs("span",{children:[s.jsxs("strong",{children:[s.jsx(Vn,{size:15,strokeWidth:2.2,"aria-hidden":"true"})," Take over the parent first"]}),s.jsx("small",{children:"Its Terminal or VS Code process will stop, then this reviewed return continues the same conversation from LongLeash."})]})]}):null,s.jsxs("div",{className:"delegate-confirm return-confirm",children:[s.jsx("strong",{children:"Return exactly this reviewed text"}),s.jsx("p",{children:"The child releases the checkout first. The parent becomes the sole writer and receives visible source attribution."}),s.jsxs(te,{className:"primary wide return-launch",disabled:!P,onClick:j,children:[s.jsx(M0,{size:17,strokeWidth:2.4,"aria-hidden":"true"}),h?"Returning to parent…":"Return to parent"]}),s.jsx("p",{className:`delegate-status${f||w?" bad":""}`,role:"status","aria-live":"polite",children:f||(w?`Return is ${(l.length-E).toLocaleString()} characters over the limit.`:r?a===null?"Verify the current parent, child, and takeover state before delivery.":a?.requiresTakeover&&!C?"Confirm the explicit takeover before delivery.":h?"Delivery accepted. Waiting for the parent conversation…":"Nothing is delivered until you press this button.":"Waiting for your laptop. This edited draft remains saved.")}),f!==null&&A!==null?s.jsx("button",{type:"button",className:"tap quiet return-new-attempt",onClick:()=>{c(eo()),k(null)},children:"I checked the parent — create a new delivery attempt"}):null]})]})]})}function z8(){return globalThis.crypto?.randomUUID?.()??`settings-${Date.now()}-${Math.random().toString(36).slice(2)}`}function W8({open:e,session:t,connected:n,catalog:r,update:o,onSave:x,onClose:i}){const a=zt(e),l=Wt(e),d=vt(),u=g.useRef(null),c=t.agent==="codex"?"codex":"claude",[p,B]=g.useState(()=>En(t.settings??{},r,c)),[A,k]=g.useState(!1),C=g.useMemo(()=>o0(p,c),[p,c]),b=t.live&&(t.status==="running"||t.status==="waiting"),v=b&&t.controller==="external",F=t.origin==="vscode"?"VS Code":"Terminal",m=o?.state==="saving";g.useEffect(()=>{if(!e)return;const D=document.activeElement;u.current?.querySelector("button, select, input")?.focus();const E=w=>{w.key==="Escape"&&!m&&i()};return window.addEventListener("keydown",E),()=>{window.removeEventListener("keydown",E),D?.focus()}},[e,i,m]);const f=()=>{!n||m||C.error!==void 0||v&&!A||x({requestId:z8(),sessionId:t.sessionId,settings:C.settings,externalTransferConfirmed:v&&A})};return s.jsx(xt,{children:e?s.jsxs(s.Fragment,{children:[s.jsx(ke.div,{className:"scrim",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,transition:We},onClick:m?void 0:i}),s.jsxs(ke.div,{ref:u,className:"sheet settings-sheet",style:{...a>0?{bottom:a}:{},...l===null?{}:{maxHeight:`${Math.max(180,l-8)}px`}},role:"dialog","aria-modal":"true","aria-label":"Session controls",initial:d?!1:{y:"100%"},animate:{y:0},...d?{}:{exit:{y:"100%",transition:We}},transition:ze,children:[s.jsxs("div",{className:"sheetbar",children:[s.jsx("div",{className:"grab","aria-hidden":"true"}),s.jsx("button",{type:"button",className:"sheetclose",disabled:m,onClick:i,"aria-label":"Close settings",children:s.jsx(pt,{size:19,strokeWidth:2.2,"aria-hidden":"true"})})]}),s.jsxs("div",{className:"sheet-in",children:[s.jsxs("div",{className:"settings-title",children:[s.jsx("span",{className:"delegate-mark","aria-hidden":"true",children:s.jsx(Ar,{size:18,strokeWidth:2.2})}),s.jsxs("div",{children:[s.jsx("h2",{children:"Session controls"}),s.jsxs("p",{className:"sub",children:["Tune ",tn[c]," without losing this conversation."]})]})]}),s.jsxs("div",{className:"settings-evidence",children:[s.jsx("span",{className:"k",children:"Session"}),s.jsx("strong",{children:t.title||"Untitled session"}),s.jsx("span",{className:"mono",children:Sr(t.cwd)})]}),s.jsx(Pr,{agent:c,value:p,onChange:B,disabled:m||o?.state==="saved",...r===void 0?{}:{catalog:r}}),s.jsx("p",{className:`settings-impact${C.error?" bad":""}`,role:"status",children:C.error?C.error:v?`This process is still controlled by ${F}. LongLeash must end that process first; the native conversation ID and transcript are preserved.`:b?"Applies to the next response. A response already in progress finishes unchanged.":"Saved now and applied when you next continue this conversation."}),v?s.jsxs("label",{className:"takeover-confirm settings-transfer",children:[s.jsx("input",{type:"checkbox",checked:A,disabled:m,onChange:D=>k(D.target.checked)}),s.jsx("span",{className:"takeover-check","aria-hidden":"true",children:s.jsx(Ke,{size:15,strokeWidth:2.7})}),s.jsxs("span",{children:[s.jsx("strong",{children:"Move control to LongLeash"}),s.jsxs("small",{children:["End the ",F," process, preserve conversation ",t.resumeId??"ID",", and use these settings on the next phone turn."]})]})]}):null,s.jsx(te,{className:"primary wide settings-save",disabled:!n||m||C.error!==void 0||v&&!A,onClick:o?.state==="saved"?i:f,children:o?.state==="saved"?"Done":m?"Applying safely…":n?"Apply to this conversation":"Waiting for your laptop…"}),s.jsx("p",{className:`delegate-status${o?.state==="failed"?" bad":""}`,"aria-live":"polite",children:o?.state==="failed"?o.error:o?.state==="saved"?o.outcome==="next-response"?`Saved. The next response will request these controls from ${tn[c]}.`:`Saved. The next continuation will request these controls from ${tn[c]}.`:"Mode changes apply on the next turn; workspace isolation is unchanged."})]})]})]}):null})}const Ux=g.createContext({hosted:!1});function $x({value:e,children:t}){return s.jsx(Ux.Provider,{value:e,children:t})}function V8(){return g.useContext(Ux)}async function no(e=fetch){try{const t=await e(`/build.json?check=${Date.now()}`,{cache:"no-store",headers:{"Cache-Control":"no-cache"}});if(!t.ok)return null;const n=await t.json();return typeof n.build=="string"&&n.build.trim()!==""?n.build:null}catch{return null}}function ro(e,t){return t!==null&&t!==e?t:null}function so(e){return e.lastActivityAt??e.startedAt??0}function Ln(e){return e.live&&(e.status==="running"||e.status==="waiting")}function V0(e){return e.toLocaleLowerCase().replace(/\s+/g," ").trim()}function q8(e,t){if(t.length===0)return;const n=[...e.blocks.slice().reverse().map(r=>r.text),e.output];for(const r of n){const o=r.replace(/\s+/g," ").trim(),x=o.toLocaleLowerCase(),i=t.find(u=>x.includes(u));if(i===void 0)continue;const a=x.indexOf(i),l=Math.max(0,a-42),d=Math.min(o.length,a+Math.max(i.length,72));return`${l>0?"…":""}${o.slice(l,d)}${d<o.length?"…":""}`}}function H8(e,t){const n=V0(t.query).split(" ").filter(Boolean);return[...new Map(e.map(x=>[x.sessionId,x])).values()].flatMap(x=>{const i=t.pendingBySession[x.sessionId]??0;if(t.scope==="active"&&!Ln(x))return[];if(t.scope==="needs"&&i===0)return[];if(t.scope==="history"&&Ln(x))return[];if(t.agent!=="all"&&x.agent!==t.agent)return[];if(t.surface!=="all"&&(x.surface??x.origin)!==t.surface)return[];if(n.length===0)return[{session:x}];const a=V0(`${x.title} ${x.cwd} ${x.agent} ${x.surface??x.origin}`),l=q8(x,n),d=V0(`${x.output} ${x.blocks.map(u=>u.text).join(" ")}`);return n.every(u=>a.includes(u)||d.includes(u))?[{session:x,...l===void 0?{}:{match:l}}]:[]}).sort((x,i)=>{const a=x.session,l=i.session;if(t.sort==="name")return(a.title||a.sessionId).localeCompare(l.title||l.sessionId)||l.sessionId.localeCompare(a.sessionId);if(t.sort==="project")return a.cwd.localeCompare(l.cwd)||(a.title||a.sessionId).localeCompare(l.title||l.sessionId);const d=so(l)-so(a);if(t.sort==="recent")return d||l.sessionId.localeCompare(a.sessionId);if(t.sort==="oldest")return-d||a.sessionId.localeCompare(l.sessionId);const u=(t.pendingBySession[l.sessionId]??0)-(t.pendingBySession[a.sessionId]??0);return u!==0?u:Number(Ln(l))-Number(Ln(a))||d||l.sessionId.localeCompare(a.sessionId)})}function K8({progress:e,control:t,onCancel:n}){const r=vt(),[o,x]=g.useState(Date.now());g.useEffect(()=>{const l=setInterval(()=>x(Date.now()),1e3);return()=>clearInterval(l)},[]);const i=e.expiresAt?Math.max(0,Math.ceil((e.expiresAt-o)/1e3)):null,a=i===0;return s.jsxs("main",{className:"gate pair-verify",children:[s.jsx("p",{className:"mono pair-eyebrow",children:"DEVICE VERIFICATION"}),s.jsx("h1",{children:a?"This code expired":e.state==="connecting"?"Finding your laptop":e.state==="waiting"?"Confirm on your laptop":"Compare with your laptop"}),s.jsx("p",{role:"status",children:a?"Generate a fresh QR with longleash pair and try again.":e.state==="connecting"?"Keep this page and the pairing terminal open. No device is connected yet.":e.state==="waiting"?"Your phone confirmation is recorded. Finish the comparison in the laptop terminal; this page will continue when both agree.":"Check every digit against the code in your laptop terminal. Confirm only if both codes match."}),e.code&&s.jsx(ke.div,{className:"pair-code",initial:r?!1:{opacity:0},animate:{opacity:1},transition:{duration:r?0:.18},children:s.jsx("span",{className:"mono","aria-label":`Verification code ${e.code.replaceAll(" ","").split("").join(" ")}`,children:e.code})}),i!==null&&s.jsx("p",{className:"mono pair-expiry",children:a?"Expired":`Expires in ${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`}),e.state==="compare"&&s.jsxs("div",{className:"pair-actions",children:[s.jsx("button",{className:"pair-action pair-match",disabled:a||!t,onClick:()=>t?.confirm(),children:"Codes match"}),s.jsx("button",{className:"pair-action",onClick:()=>t?.reject(),children:"They do not match"})]}),s.jsx("button",{className:"pair-action",onClick:n,children:"Cancel pairing"}),s.jsx("p",{className:"pair-private",children:"Keep the QR and pairing link private. Pairing never asks for an agent password or permission to weaken your security."})]})}function zx(){const e=g.useMemo(()=>sd(),[]),[,t]=g.useState(0),[n,r]=g.useState("connecting"),[o,x]=g.useState(!1),[i,a]=g.useState("lan"),[l,d]=g.useState(()=>y9()),[u,c]=g.useState(null),p=g.useRef(null),B=g.useRef(null),[A,k]=g.useState(null),[C,b]=g.useState(null),[v,F]=g.useState(null),[m,f]=g.useState([]),[D,h]=g.useState([]),[E,w]=g.useState(),[P,I]=g.useState(null),[j,y]=g.useState(null),_=g.useRef(null),L=g.useRef(""),[K,M]=g.useState(()=>Lx(window.location.search)),[z,q]=g.useState(!1),[J,R]=g.useState(null),se=g.useRef(null),[$,Y]=g.useState(null),[Pe,pe]=g.useState(null),[Z,Ee]=g.useState(null),[Fe,qe]=g.useState({}),[me,it]=g.useState(null),[Ie,Ue]=g.useState(null),Le=g.useRef(null),[$e,at]=g.useState({start:!1,targets:{claude:!1,codex:!1},return:!1,workspace:"legacy"}),re=g.useRef(null),[Ce,Ht]=g.useState(null),[je,lt]=g.useState(null),[Ur,$r]=g.useState(null),[B0,bn]=g.useState(!1),zr=g.useRef(0),Be=g.useRef(null);g.useEffect(()=>{let O=!0;const de=()=>{const ae=++zr.current;no().then(ue=>{!O||ae!==zr.current||($r(ro("618e867",ue)),ue==="618e867"&&bn(!1))})},fe=()=>{document.visibilityState==="visible"&&de()};de(),window.addEventListener("focus",de),document.addEventListener("visibilitychange",fe);const H=window.setInterval(de,5*6e4);return()=>{O=!1,window.removeEventListener("focus",de),document.removeEventListener("visibilitychange",fe),window.clearInterval(H)}},[]),g.useEffect(()=>{if(!("serviceWorker"in navigator))return;const O=de=>{const fe=de.data;fe?.type==="longleash:open-session"&&typeof fe.sessionId=="string"&&M(fe.sessionId)};return navigator.serviceWorker.addEventListener("message",O),()=>navigator.serviceWorker.removeEventListener("message",O)},[]),g.useEffect(()=>{M8(window.location.search)&&window.history.replaceState({},"",window.location.pathname)},[]),g.useEffect(()=>e.subscribe(()=>t(O=>O+1)),[e]);const g0=g.useCallback((O,de,fe)=>{if(B.current)return;const H=new AbortController;B.current=H,k(null),c({state:"connecting"}),history.replaceState(null,"",location.pathname);try{sessionStorage.removeItem("longleash.pending-pairing")}catch{}_9(O,de,{...fe!==void 0?{version:fe}:{},signal:H.signal,onProgress:(ae,ue)=>{H.signal.aborted||(c(ae),p.current=ue)}}).then(ae=>{H.signal.aborted||d(ae)}).catch(ae=>{H.signal.aborted||k(ae.message)}).finally(()=>{B.current===H&&(B.current=null,p.current=null,c(null))})},[]);g.useEffect(()=>{let O;const de=()=>{clearTimeout(O);const fe=ur(location.href);if(fe!==null){if(l){history.replaceState(null,"",location.pathname);try{sessionStorage.removeItem("longleash.pending-pairing")}catch{}return}O=setTimeout(()=>g0(fe.challengeId,fe.secret,fe.version),0)}};return de(),window.addEventListener("hashchange",de),()=>{clearTimeout(O),window.removeEventListener("hashchange",de)}},[l,g0]),g.useEffect(()=>()=>{B.current?.abort()},[]),g.useEffect(()=>{if(!l)return;const O=(H,ae)=>{const ue=re.current;if(A8(ue,H,ae)){if(H.status==="failed"||H.status==="cancelled"){re.current=null,Ee({requestId:ue.requestId,message:H.failure??"The delegated child could not be started."});return}H.targetSessionId!==void 0&&(Tx(ue.sourceSessionId,ue.sourceSeq),re.current=null,pe(null),Ee(null),Y(null),M(H.targetSessionId))}},de=(H,ae)=>{const ue=Le.current;ue===null||H.delegationId!==ue.delegationId||!(ae===ue.requestId||H.returnIdempotencyKey===ue.idempotencyKey)||H.status!=="returned"||(Rx(H.delegationId),Le.current=null,Ue(null),Ee(null),it(null),M(H.sourceSessionId))},fe=M9(l,e,{onState:r,onHydration:x,onHello:H=>{f(H.roots),w(H.capabilities.sessionSettings);const ae=H.delegations??[];qe(Object.fromEntries(ae.map(Qe=>[Qe.delegationId,Qe])));for(const Qe of ae)O(Qe);for(const Qe of ae)de(Qe);at({start:H.capabilities.delegation?.start===!0,targets:H.capabilities.delegation?.targets??{claude:!1,codex:!1},return:H.capabilities.delegation?.return===!0,workspace:H.capabilities.delegation?.workspace??"legacy"});const ue=H.push?.publicKey??null;Ht(ue);const mt=Ys();mt==="unsupported"?lt("unsupported"):ue===null?lt("stale-daemon"):mt==="denied"?lt("denied"):mt==="granted"?k8(ue).then(Qe=>{Qe?(Be.current?.pushSubscribe(Qe),lt("on")):lt("ready")}):lt("ready")},onError:F,onFolders:(H,ae)=>{T8(L.current,H)&&h(ae)},onSessionStarted:(H,ae)=>{H!==void 0&&se.current!==H||(se.current=null,R(null),q(!1),M(ae))},onSessionStartError:(H,ae)=>{H!==void 0&&se.current!==H||R(ue=>ue===null?{requestId:H??"legacy",state:"failed",error:ae}:{...ue,state:"failed",error:ae})},onSessionSettingsUpdated:(H,ae,ue)=>{_.current===H&&(_.current=null,y(mt=>mt?.requestId===H?{requestId:H,state:"saved",outcome:ue}:mt))},onSessionSettingsError:(H,ae)=>{_.current===H&&(_.current=null,y(ue=>ue?.requestId===H?{requestId:H,state:"failed",error:ae}:ue))},onDelegationPreview:H=>{Ee(null),pe(H)},onDelegationReturnPreview:H=>{Ee(null),Ue(H)},onDelegationUpdate:(H,ae)=>{qe(ue=>({...ue,[H.delegationId]:H})),O(H,ae),de(H,ae)},onDelegationError:(H,ae)=>Ee({requestId:H,message:ae}),onPath:a});return Be.current=fe,()=>fe.close()},[l,e]),g.useEffect(()=>{if(n!=="reconnecting"&&n!=="connecting"){b(null);return}const O=setTimeout(()=>{P9().then(de=>b(de.reachable?null:de.detail))},3e3);return()=>clearTimeout(O)},[n]),g.useEffect(()=>{if(!z&&$===null&&me===null)return;const O=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=O}},[z,$,me]);const Wr=g.useCallback((O,de,fe)=>{e.markDeciding(O.approvalId),Be.current?.decide(O.approvalId,de,fe)||e.rollbackDecision(O.approvalId)},[e]),Vr=g.useCallback((O,de,fe)=>{e.markDeciding(O.approvalId),Be.current?.decide(O.approvalId,"deny",fe,de)||e.rollbackDecision(O.approvalId)},[e]),qr=g.useCallback(O=>{e.markDeciding(O.approvalId),Be.current?.decide(O.approvalId,"deny")||e.rollbackDecision(O.approvalId)},[e]),qx=g.useCallback(O=>{L.current=O,Be.current?.findFolders(O)},[]),Hx=g.useCallback(()=>{Ce&&D8(Ce).then(O=>{O?(Be.current?.pushSubscribe(O),lt("on")):lt(Ys()==="denied"?"denied":"ready")})},[Ce]),Kx=g.useCallback(()=>Be.current?.pushTest()??!1,[]),Zx=g.useCallback(()=>{B0||(bn(!0),(async()=>{const O=await no();if(O===null){bn(!1);return}if(ro("618e867",O)===null){$r(null),bn(!1);return}try{for(const fe of await caches.keys())await caches.delete(fe);const de=await navigator.serviceWorker?.getRegistrations?.();for(const fe of de??[])await fe.update()}catch{}window.location.replace(`${window.location.pathname}?updated=${encodeURIComponent(O??"latest")}`)})())},[B0]);if(!l)return s.jsx(Y8,{error:A,progress:u,control:p.current,onCancel:()=>{B.current?.abort(),B.current=null,p.current=null,c(null),k("Pairing cancelled. Generate a fresh QR. If both devices were already confirmed, check longleash devices before retrying.")},onPair:g0});if(n==="revoked"||n==="unauthorized")return s.jsxs("main",{className:"gate",children:[s.jsx(Lr,{}),s.jsx("h1",{children:"Access ended"}),s.jsx("p",{children:n==="revoked"?"This device was revoked from your laptop.":"This device is no longer authorized."}),s.jsx(te,{onClick:()=>{wx(),d(null)},children:"Pair again"})]});const Ye=e.getState(),Hr=od(Object.values(Ye.sessions)),Gx=Hr.filter(O=>O.live&&(O.status==="running"||O.status==="waiting")),Jx=Hr.filter(O=>O.status==="ended"||O.status==="errored"||!O.live),_e=K?Ye.sessions[K]:void 0,Kr=$?Ye.sessions[$.sessionId]:void 0,bt=n==="connected",Yx=_e?Object.values(Fe).filter(O=>O.sourceSessionId===_e.sessionId||O.targetSessionId===_e.sessionId):[];return s.jsxs(s.Fragment,{children:[s.jsx(Z8,{connected:bt,via:i,...Ur===null?{}:{updateBuild:Ur,updating:B0,onUpdate:Zx},..._e?{onBack:()=>M(null)}:{}}),s.jsx("div",{className:"screens",children:s.jsx(xt,{initial:!1,children:_e?s.jsx(eh,{session:_e,approvals:Xo(Ye,_e.sessionId),connected:bt,diagnostic:C,error:v,onClearError:()=>F(null),onDecide:Wr,onAnswer:Vr,onLeave:qr,onStop:()=>Be.current?.stopSession(_e.sessionId),onResume:()=>Be.current?.resumeSession(_e.sessionId),onSend:O=>Be.current?.sendMessage(_e.sessionId,O)??!1,onTakeOver:O=>Be.current?.takeOver(_e.sessionId,O)??!1,onReclaim:()=>Be.current?.reclaimSession(_e.sessionId)??!1,onRename:O=>Be.current?.renameSession(_e.sessionId,O)??!1,onSetGate:O=>Be.current?.setGate(_e.sessionId,O),onTune:()=>{y(null),I(_e.sessionId)},delegations:Yx,sessions:Ye.sessions,onOpenSession:M,onReviewReturn:O=>{Ee(null),Ue(null),it(O)},onDelegate:O=>{pe(null),Ee(null),Y({sessionId:_e.sessionId,...O===void 0?{}:{sourceSeq:O}})}},_e.sessionId):s.jsx(X8,{approvals:Ye.approvals,active:Gx,past:Jx,snapshot:Ye,delegations:Object.values(Fe),diagnostic:C,error:v,onClearError:()=>F(null),onDecide:Wr,onAnswer:Vr,onLeave:qr,onOpen:M,onNew:()=>q(!0),alerts:je,onEnableAlerts:Hx,onTestAlert:Kx,settling:o},"console")})}),s.jsx(J9,{open:z,roots:m,folders:D,connected:bt,...E===void 0?{}:{settingsCatalog:E},starting:J?.state==="starting",...J?.state==="failed"&&J.error!==void 0?{startError:J.error}:{},onSearch:qx,onStart:(O,de,fe,H)=>{F(null);const ae=`start-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,ue=Be.current?.startSession(O,de,fe,{...H,requestId:ae})??!1;return ue&&(se.current=ae,R({requestId:ae,state:"starting"}),setTimeout(()=>{se.current===ae&&R({requestId:ae,state:"failed",error:"The laptop did not confirm the launch. Close this sheet and check the session list before retrying, so you do not start a duplicate."})},2e4)),ue},onClose:()=>{J?.state!=="starting"&&(se.current=null,R(null),q(!1))}}),$&&Kr?s.jsx(B8,{open:!0,session:Kr,...$.sourceSeq===void 0?{}:{sourceSeq:$.sourceSeq},connected:bt,preview:Pe,previewError:Z,onPreview:O=>(Ee(null),Be.current?.previewDelegation(O)??!1),launchEnabled:$e.start,workspaceMode:$e.workspace,availableTargets:$e.targets,...E===void 0?{}:{settingsCatalog:E},onStart:O=>(Ee(null),re.current={requestId:O.requestId,idempotencyKey:O.idempotencyKey,sourceSessionId:O.sourceSessionId,...O.sourceSeq===void 0?{}:{sourceSeq:O.sourceSeq}},Be.current?.startDelegation(O)??!1),onClose:()=>Y(null)}):null,P&&Ye.sessions[P]?s.jsx(W8,{open:!0,session:Ye.sessions[P],connected:bt,update:j,...E===void 0?{}:{catalog:E},onSave:O=>{_.current=O.requestId,y({requestId:O.requestId,state:"saving"});const de=Be.current?.updateSessionSettings(O)??!1;return de?setTimeout(()=>{_.current===O.requestId&&(_.current=null,y({requestId:O.requestId,state:"failed",error:"The laptop did not confirm the change. The current session state was left visible; reconnect and verify before retrying."}))},2e4):(_.current=null,y({requestId:O.requestId,state:"failed",error:"Not connected to your laptop — settings were not changed."})),de},onClose:()=>{j?.state!=="saving"&&(_.current=null,I(null),y(null))}}):null,me&&Fe[me]?s.jsx(U8,{open:!0,delegation:Fe[me],preview:Ie,error:Z,connected:bt&&$e.return,onPrepare:O=>(Ee(null),Be.current?.prepareReturn(O)??!1),onReturn:O=>(Ee(null),Le.current={requestId:O.requestId,idempotencyKey:O.idempotencyKey,delegationId:O.delegationId},Be.current?.returnDelegation(O)??!1),onClose:()=>it(null)}):null]})}function Z8({connected:e,via:t,onBack:n,updateBuild:r,updating:o=!1,onUpdate:x}){const i=V8(),[a,l]=g.useState(!1),[d,u]=g.useState(!1),c=g.useCallback(()=>l(!1),[]),p=g.useCallback(()=>u(!1),[]);return s.jsxs("div",{className:`rail${x?" has-update":""}`,children:[s.jsxs("div",{className:"rail-in",children:[n?s.jsxs("button",{type:"button",className:"tap",onClick:n,"aria-label":"Back to all sessions",children:[s.jsx(Yl,{size:18,strokeWidth:2.4,"aria-hidden":"true"}),s.jsx("span",{className:"back-label",children:"Sessions"})]}):s.jsxs("h1",{className:"wordmark",children:[s.jsx("img",{src:"/icon-192.png",alt:"",width:26,height:26}),s.jsx("span",{children:"LongLeash"})]}),s.jsx("span",{className:"spacer"}),x?s.jsxs(te,{className:"railupdate",onClick:x,disabled:o,label:`Update LongLeash to build ${r??"latest"}`,children:[s.jsx(Go,{size:14,strokeWidth:2.4,"aria-hidden":"true"}),s.jsx("span",{className:"railupdate-label",children:o?"Updating…":"Update"})]}):null,s.jsx("button",{type:"button",className:"rail-icon",onClick:()=>u(!0),title:"How to use LongLeash","aria-label":"How to use LongLeash","aria-expanded":d,children:s.jsx(ii,{size:18,strokeWidth:2.1,"aria-hidden":"true"})}),i.hosted&&i.signOut?s.jsxs("button",{type:"button",className:"account-pill",onClick:()=>l(!0),title:i.label?`Signed in as ${i.label}. Account settings`:"Account settings","aria-label":i.label?`Signed in as ${i.label}. Account settings`:"Account settings","aria-expanded":a,children:[s.jsx("span",{"aria-hidden":"true",children:i.label?.slice(0,1).toUpperCase()??"L"}),s.jsx(Jo,{size:13,strokeWidth:2.2,"aria-hidden":"true"})]}):null,s.jsxs("span",{className:`link-state${e?" on":""}`,children:[e?s.jsx(i0,{status:"running"}):s.jsx(Cc,{size:13,strokeWidth:2.3,"aria-hidden":"true"}),e?s.jsxs(s.Fragment,{children:["linked",s.jsx("span",{className:"route-detail",children:t==="relay"?" · relay":" · direct"})]}):"reconnecting"]}),s.jsx("span",{className:"sr",role:"status",children:e?t==="relay"?"Connected to your laptop through the relay, end-to-end encrypted":"Connected directly to your laptop on this network":"Reconnecting to your laptop"})]}),d?s.jsx(G8,{connected:e,...t===void 0?{}:{via:t},onClose:p}):null,a?s.jsx(J8,{account:i,onClose:c}):null]})}function G8({connected:e,via:t,onClose:n}){const r=g.useRef(null),o=Wt(!0);return g.useEffect(()=>{const x=document.activeElement,i=document.body.style.overflow,a=document.documentElement.style.overflow;document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden";const l=()=>Array.from(r.current?.querySelectorAll('button:not(:disabled), summary, a[href], [tabindex]:not([tabindex="-1"])')??[]),d=window.requestAnimationFrame(()=>l()[0]?.focus()),u=c=>{if(c.key==="Escape"){c.preventDefault(),n();return}if(c.key!=="Tab")return;const p=l(),B=p[0],A=p[p.length-1];!B||!A||(c.shiftKey&&document.activeElement===B?(c.preventDefault(),A.focus()):!c.shiftKey&&document.activeElement===A&&(c.preventDefault(),B.focus()))};return window.addEventListener("keydown",u),()=>{window.cancelAnimationFrame(d),window.removeEventListener("keydown",u),document.body.style.overflow=i,document.documentElement.style.overflow=a,x?.focus()}},[n]),Bn.createPortal(s.jsx("div",{className:"account-sheet-scrim",role:"presentation",onPointerDown:x=>{x.target===x.currentTarget&&n()},children:s.jsxs("section",{ref:r,className:"help-sheet",role:"dialog","aria-modal":"true","aria-labelledby":"help-sheet-title",style:o===null?void 0:{height:`${Math.max(360,o-76)}px`},children:[s.jsx("span",{className:"help-sheet-handle","aria-hidden":"true"}),s.jsxs("header",{className:"help-sheet-header",children:[s.jsxs("div",{children:[s.jsx("p",{className:"account-kicker",children:"Pocket field guide"}),s.jsx("h2",{id:"help-sheet-title",children:"Operate LongLeash"})]}),s.jsx("button",{className:"help-sheet-close",type:"button",onClick:n,"aria-label":"Close help",children:s.jsx(pt,{size:20,"aria-hidden":"true"})})]}),s.jsxs("div",{className:`help-connection${e?" connected":""}`,children:[s.jsx(i0,{status:e?"running":"ended"}),s.jsx("span",{children:e?`Laptop linked ${t==="relay"?"through relay":"directly"}`:"Laptop reconnecting"})]}),s.jsxs("div",{className:"help-sheet-scroll",children:[s.jsxs("section",{className:"help-quick","aria-labelledby":"help-quick-title",children:[s.jsx("h3",{id:"help-quick-title",children:"Start a session"}),s.jsxs("ol",{children:[s.jsxs("li",{children:[s.jsx("span",{children:"1"}),s.jsx("p",{children:"Keep the laptop on and awake."})]}),s.jsxs("li",{children:[s.jsx("span",{children:"2"}),s.jsxs("p",{children:["Tap ",s.jsx("strong",{children:"New session"})," and choose the agent and project."]})]}),s.jsxs("li",{children:[s.jsx("span",{children:"3"}),s.jsx("p",{children:"Choose Manual, Auto, or Plan, then send one concrete task."})]}),s.jsxs("li",{children:[s.jsx("span",{children:"4"}),s.jsx("p",{children:"Review approvals, reply, tune, hand off, or stop here."})]})]})]}),s.jsxs("details",{className:"help-topic",children:[s.jsx("summary",{children:"Modes and safety"}),s.jsxs("dl",{children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Manual"}),s.jsx("dd",{children:"Commands and edits ask first."})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Auto"}),s.jsx("dd",{children:"Uses each provider's guarded automation. Unrestricted access stays off."})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Plan"}),s.jsx("dd",{children:"Inspects and designs with workspace writes disabled."})]})]}),s.jsx("p",{children:"Changes apply to the next turn, never work already in progress."})]}),s.jsxs("details",{className:"help-topic",children:[s.jsx("summary",{children:"Read the session marks"}),s.jsx(Z9,{}),s.jsx("p",{children:"The provider mark identifies Claude or Codex. The surface mark shows Phone, Terminal, or VS Code."})]}),s.jsxs("details",{className:"help-topic",children:[s.jsx("summary",{children:"Move between phone and laptop"}),s.jsx("p",{children:"A native session stays with Terminal or VS Code until you explicitly move control. LongLeash preserves the conversation ID and continues the same transcript."})]}),s.jsxs("details",{className:"help-topic",children:[s.jsx("summary",{children:"Fix a laptop that will not link"}),s.jsxs("div",{className:"help-commands",children:[s.jsx("code",{children:"longleash service status"}),s.jsx("code",{children:"longleash doctor"}),s.jsx("code",{children:"longleash service restart"}),s.jsx("code",{children:"longleash pair"})]}),s.jsx("p",{children:"Run them in order. Pairing links are single-use, so print a fresh one after a failed attempt."})]})]}),s.jsx("a",{className:"help-docs",href:"https://longleash.dev/docs/getting-started",target:"_blank",rel:"noreferrer",children:"Open the full guide"}),s.jsx("a",{className:"help-feedback",href:"https://longleash.dev/feedback",target:"_blank",rel:"noreferrer",children:"Report a bug or request a feature"})]})}),document.body)}function J8({account:e,onClose:t}){const[n,r]=g.useState(!1),[o,x]=g.useState(""),[i,a]=g.useState(!1),[l,d]=g.useState(null),[u,c]=g.useState(null),p=g.useRef(null),B=zt(!0),A=Wt(!0);g.useEffect(()=>{const C=document.activeElement,b=document.body,v=document.documentElement,F=b.style.overflow,m=v.style.overflow;b.style.overflow="hidden",v.style.overflow="hidden";const f=()=>Array.from(p.current?.querySelectorAll('button:not(:disabled), input:not(:disabled), [href], [tabindex]:not([tabindex="-1"])')??[]).filter(E=>E.getAttribute("aria-hidden")!=="true"),D=window.requestAnimationFrame(()=>f()[0]?.focus()),h=E=>{if(E.key==="Escape"){E.preventDefault(),t();return}if(E.key!=="Tab")return;const w=f(),P=w[0],I=w[w.length-1];!P||!I||(E.shiftKey&&document.activeElement===P?(E.preventDefault(),I.focus()):!E.shiftKey&&document.activeElement===I&&(E.preventDefault(),P.focus()))};return window.addEventListener("keydown",h),()=>{window.cancelAnimationFrame(D),window.removeEventListener("keydown",h),b.style.overflow=F,v.style.overflow=m,C?.focus()}},[t]);const k=async()=>{if(!(o!=="DELETE"||!e.deleteAccount||i)){a(!0),d(null);try{await e.deleteAccount()}catch{d("The account could not be deleted. Nothing was removed; retry or contact privacy@longleash.dev."),a(!1)}}};return Bn.createPortal(s.jsx("div",{className:"account-sheet-scrim",role:"presentation",style:B>0?{bottom:B}:void 0,onPointerDown:C=>{C.target===C.currentTarget&&t()},children:s.jsxs("section",{ref:p,className:"account-sheet",role:"dialog","aria-modal":"true","aria-labelledby":"account-sheet-title","aria-describedby":"account-sheet-boundary",style:A===null?void 0:{maxHeight:`${Math.max(240,A-24)}px`},children:[s.jsx("button",{className:"sheetclose",type:"button",onClick:t,"aria-label":"Close account settings",children:s.jsx(pt,{size:20,"aria-hidden":"true"})}),s.jsx("p",{className:"account-kicker",children:"Hosted identity"}),s.jsx("h2",{id:"account-sheet-title",children:"Your LongLeash account"}),s.jsx("p",{className:"account-sheet-label mono",children:e.label??"Signed in"}),s.jsxs("div",{className:"account-sheet-actions",children:[s.jsxs(te,{className:"wide",...e.signOut?{onClick:e.signOut}:{},disabled:!e.signOut,children:[s.jsx(Jo,{size:16,"aria-hidden":"true"})," Sign out"]}),s.jsxs(te,{className:"wide",...e.exportAccount?{onClick:e.exportAccount}:{},disabled:!e.exportAccount,children:[s.jsx(Go,{size:16,"aria-hidden":"true"})," Download account data"]}),s.jsxs(te,{className:"wide",...e.openSecurity?{onClick:e.openSecurity}:{},disabled:!e.openSecurity,children:[s.jsx(a0,{size:16,"aria-hidden":"true"})," Security and multi-factor settings"]})]}),s.jsxs("section",{className:"measurement-choice","aria-labelledby":"measurement-title",children:[s.jsxs("div",{children:[s.jsx("strong",{id:"measurement-title",children:"Optional product measurement"}),s.jsx("p",{children:"Share only successful or failed action categories and dates. No prompts, code, paths, transcripts, session IDs, room IDs, or device identifiers."})]}),s.jsxs("button",{type:"button",className:`measurement-toggle${e.measurementEnabled?" on":""}`,role:"switch","aria-checked":e.measurementEnabled===!0,disabled:e.measurementBusy||!e.setMeasurement,onClick:()=>{c(null),e.setMeasurement?.(!e.measurementEnabled).catch(()=>c(e.measurementEnabled?"Deletion was not confirmed. Retry before closing this panel.":"Opt-in was not saved, so nothing will be collected."))},children:[s.jsx("span",{"aria-hidden":"true"}),e.measurementBusy?"Checking…":e.measurementEnabled?"On":"Off"]}),s.jsx("p",{className:"measurement-fineprint",children:"Off by default. Turning it off deletes your raw events and daily product-use aggregates immediately. It never affects pairing or control."}),u?s.jsx("p",{className:"err",role:"alert",children:u}):null]}),s.jsx("div",{className:"account-data-boundary",id:"account-sheet-boundary",children:"This account identifies you to the hosted app. Laptop code, transcripts, provider credentials, and pairing secrets are outside the account database."}),n?s.jsxs("div",{className:"account-delete-confirm",children:[s.jsx("strong",{children:"Delete hosted identity?"}),s.jsxs("p",{children:["This permanently deletes the account and this browser’s paired credentials. It does not delete local laptop transcripts. Type ",s.jsx("code",{children:"DELETE"})," to continue."]}),s.jsx("input",{className:"field",value:o,onChange:C=>x(C.target.value),placeholder:"DELETE","aria-label":"Type DELETE to confirm account deletion",autoCapitalize:"characters",autoComplete:"off"}),s.jsxs("div",{className:"account-delete-actions",children:[s.jsx(te,{onClick:()=>{r(!1),x(""),d(null)},children:"Keep account"}),s.jsxs(te,{className:"danger",onClick:()=>{k()},disabled:o!=="DELETE"||i,children:[s.jsx(As,{size:15,"aria-hidden":"true"})," ",i?"Deleting…":"Delete permanently"]})]}),l?s.jsx("p",{className:"err",role:"alert",children:l}):null]}):s.jsxs("button",{className:"account-delete-link",type:"button",onClick:()=>r(!0),children:[s.jsx(As,{size:14,"aria-hidden":"true"})," Delete account"]})]})}),document.body)}function Y8({error:e,onPair:t,progress:n,control:r,onCancel:o}){const[x,i]=g.useState(""),[a,l]=g.useState(!1),d=ur(x),u=g.useCallback(c=>{const p=ur(c);return p===null?!1:(l(!1),i(""),t(p.challengeId,p.secret,p.version),!0)},[t]);return n?s.jsx(K8,{progress:n,control:r,onCancel:o}):s.jsxs("main",{className:"gate",children:[s.jsx(Lr,{}),s.jsx("h1",{children:"LongLeash"}),s.jsx("p",{children:"Point this at the QR your laptop printed — scanning from inside the app pairs the right browser. Pasting the link works too."}),s.jsxs("div",{className:"pairbox",children:[s.jsxs(te,{className:"primary wide",onClick:()=>l(!0),children:[s.jsx(Oc,{size:18,strokeWidth:2.2,"aria-hidden":"true"}),"Scan the QR"]}),s.jsx("input",{className:"field",value:x,onChange:c=>i(c.target.value),placeholder:"…or paste the link: https://…/#c=…&s=…","aria-label":"Pairing link from your laptop",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),d!==null?s.jsx(te,{className:"wide",onClick:()=>{i(""),t(d.challengeId,d.secret,d.version)},children:"Pair this device"}):null]}),e?s.jsxs("p",{className:"err",children:["Pairing failed: ",e]}):null,s.jsx("p",{children:"Keep pairing links private. Do not share screenshots of the QR or save the link in browser bookmarks."}),s.jsxs("p",{className:"buildtag mono",children:["build ","618e867"]}),s.jsx(xt,{children:a?s.jsx(N8,{onCode:u,onClose:()=>l(!1)}):null})]})}function ur(e){const t=e.trim();if(t.length===0)return null;const n=[],r=t.indexOf("#");r>=0&&n.push(t.slice(r+1));const o=t.indexOf("?");if(o>=0){const x=r>o?r:t.length;n.push(t.slice(o+1,x))}r<0&&o<0&&n.push(t.replace(/^[?#]/,""));for(const x of n){const i=new URLSearchParams(x),a=i.get("c"),l=i.get("s");if(a&&l)return{challengeId:a,secret:l,...i.has("v")?{version:Number(i.get("v"))}:{}}}return null}function Q8({query:e,onQuery:t,scope:n,onScope:r,agent:o,onAgent:x,surface:i,onSurface:a,sort:l,onSort:d,filtersOpen:u,onToggleFilters:c,filterCount:p,resultCount:B}){const A=(k,C,b,v)=>s.jsxs("button",{type:"button",className:"sessionfilter-chip","aria-pressed":C===k,onClick:()=>b(k),children:[C===k?s.jsx(Ke,{size:13,strokeWidth:2.5,"aria-hidden":"true"}):null,v]},k);return s.jsxs("section",{className:"sessionbrowser","aria-label":"Find and organize sessions",children:[s.jsxs("div",{className:"sessionsearch",children:[s.jsx(fn,{size:18,strokeWidth:2.1,"aria-hidden":"true"}),s.jsx("label",{className:"sr",htmlFor:"session-search",children:"Search sessions and messages"}),s.jsx("input",{id:"session-search",type:"search",value:e,onChange:k=>t(k.target.value),placeholder:"Search sessions or messages",autoComplete:"off",spellCheck:!1}),e?s.jsx("button",{type:"button",onClick:()=>t(""),"aria-label":"Clear session search",children:s.jsx(pt,{size:16,strokeWidth:2.2,"aria-hidden":"true"})}):null]}),s.jsxs("div",{className:"sessionbrowser-bar",children:[s.jsxs("button",{type:"button",className:"sessionfilter-toggle",onClick:c,"aria-expanded":u,"aria-controls":"session-filter-panel",children:[s.jsx(Ar,{size:16,strokeWidth:2.1,"aria-hidden":"true"}),"Filters",p>0?s.jsx("span",{children:p}):null]}),s.jsxs("label",{className:"sessionsort",children:[s.jsx("span",{className:"sr",children:"Sort sessions"}),s.jsx(Ul,{size:15,strokeWidth:2.1,"aria-hidden":"true"}),s.jsxs("select",{value:l,onChange:k=>d(k.target.value),children:[s.jsx("option",{value:"recommended",children:"Priority"}),s.jsx("option",{value:"recent",children:"Recent activity"}),s.jsx("option",{value:"oldest",children:"Oldest activity"}),s.jsx("option",{value:"name",children:"Name"}),s.jsx("option",{value:"project",children:"Project"})]})]}),s.jsxs("span",{className:"sessionresult-count","aria-live":"polite",children:[B," shown"]})]}),u?s.jsxs("div",{className:"sessionfilter-panel",id:"session-filter-panel",children:[s.jsxs("fieldset",{children:[s.jsx("legend",{children:"State"}),s.jsxs("div",{children:[A("all",n,r,"All"),A("active",n,r,"Active"),A("needs",n,r,"Needs you"),A("history",n,r,"History")]})]}),s.jsxs("fieldset",{children:[s.jsx("legend",{children:"Agent"}),s.jsxs("div",{children:[A("all",o,x,"All"),A("claude",o,x,"Claude"),A("codex",o,x,"Codex")]})]}),s.jsxs("fieldset",{children:[s.jsx("legend",{children:"Started in"}),s.jsxs("div",{children:[A("all",i,a,"Everywhere"),A("phone",i,a,"Phone"),A("terminal",i,a,"Terminal"),A("vscode",i,a,"VS Code")]})]})]}):null]})}function X8({approvals:e,active:t,past:n,snapshot:r,delegations:o=[],diagnostic:x,error:i,onClearError:a,onDecide:l,onAnswer:d,onLeave:u,onOpen:c,onNew:p,alerts:B,onEnableAlerts:A,onTestAlert:k,settling:C=!1}){const b=vt(),v=e.length===0&&t.length===0&&n.length===0,[F,m]=g.useState(""),f=g.useDeferredValue(F),[D,h]=g.useState("all"),[E,w]=g.useState("all"),[P,I]=g.useState("all"),[j,y]=g.useState("recommended"),[_,L]=g.useState(!1),K=g.useMemo(()=>e.reduce(($,Y)=>($[Y.sessionId]=($[Y.sessionId]??0)+1,$),{}),[e]),M=g.useMemo(()=>H8([...t,...n],{query:f,scope:D,agent:E,surface:P,sort:j,pendingBySession:K}),[t,n,f,D,E,P,j,K]),z=M.filter(({session:$})=>$.live&&($.status==="running"||$.status==="waiting")),q=M.filter(({session:$})=>!$.live||$.status==="ended"||$.status==="errored"),J=F.trim()!==""||D!=="all"||E!=="all"||P!=="all",R=+(D!=="all")+ +(E!=="all")+ +(P!=="all"),se=()=>{m(""),h("all"),w("all"),I("all"),y("recommended")};return s.jsxs(Wx,{depth:-1,still:b,children:[s.jsxs("main",{className:"shell hasdock","aria-busy":C,children:[s.jsx(Vx,{diagnostic:x,error:i,onClearError:a}),e.length>0?s.jsxs("section",{"aria-live":"polite",children:[s.jsx(Nt,{count:e.length,urgent:!0,children:"Needs you"}),s.jsx("div",{className:"stack",children:s.jsx(xt,{initial:!1,children:e.map($=>$.questions?s.jsx(Sx,{approval:$,questions:$.questions,context:r.sessions[$.sessionId]?.title||"Untitled session",onAnswer:d,onLeave:u},$.approvalId):s.jsx(_x,{approval:$,context:r.sessions[$.sessionId]?.title||"Untitled session",onDecide:l,onOpen:()=>c($.sessionId)},$.approvalId))})})]}):null,v?s.jsx(xh,{}):s.jsx(Q8,{query:F,onQuery:m,scope:D,onScope:h,agent:E,onAgent:w,surface:P,onSurface:I,sort:j,onSort:y,filtersOpen:_,onToggleFilters:()=>L($=>!$),filterCount:R,resultCount:M.length}),!v&&z.length>0?s.jsxs("section",{children:[s.jsx(Nt,{count:z.length,children:"Active"}),s.jsx("div",{className:"stack",children:z.map(({session:$,match:Y})=>s.jsx(Ks,{session:$,pending:Xo(r,$.sessionId).length,children:oo(o,$.sessionId),onOpen:()=>c($.sessionId),settling:C,...Y===void 0?{}:{searchMatch:Y}},$.sessionId))})]}):null,!v&&q.length>0?s.jsxs("section",{children:[s.jsx(Nt,{count:q.length,children:"History"}),s.jsx("div",{className:"stack",children:q.slice(0,50).map(({session:$,match:Y})=>s.jsx(Ks,{session:$,pending:0,children:oo(o,$.sessionId),onOpen:()=>c($.sessionId),settling:C,...Y===void 0?{}:{searchMatch:Y}},$.sessionId))})]}):null,!v&&M.length===0?s.jsxs("section",{className:"sessionbrowser-empty","aria-live":"polite",children:[s.jsx(fn,{size:19,strokeWidth:2,"aria-hidden":"true"}),s.jsx("strong",{children:J?"No sessions match":"Nothing running yet"}),s.jsx("p",{children:J?"Try fewer words or clear the filters.":"Start a session from the button below."}),J?s.jsx("button",{type:"button",onClick:se,children:"Clear search and filters"}):null]}):null,B?s.jsxs("section",{children:[s.jsx(Nt,{children:"Alerts"}),s.jsx(oh,{state:B,...A?{onEnable:A}:{},...k?{onTest:k}:{}})]}):null,s.jsxs("p",{className:"foot",children:["Sessions started here, in a terminal, and in VS Code all appear after the agent's first lifecycle event or tool call (the laptop hooks must be installed). Conversations started here survive daemon restarts: reply to any of them and the same agent picks up where it left off.",s.jsxs("span",{className:"buildtag mono",children:["build ","618e867"]})]})]}),s.jsx("div",{className:"dock",children:s.jsx("div",{className:"dock-in",children:s.jsxs(te,{className:"primary wide",onClick:p,children:[s.jsx(Yo,{size:19,strokeWidth:2.6,"aria-hidden":"true"}),"New session"]})})})]})}function oo(e,t){const n=e.filter(r=>r.sourceSessionId===t);return{total:n.length,active:n.filter(r=>r.status==="starting"||r.status==="running").length,ready:n.filter(r=>r.status==="ready").length}}function eh({session:e,approvals:t,connected:n,diagnostic:r,error:o,onClearError:x,onDecide:i,onAnswer:a,onLeave:l,onStop:d,onResume:u,onSend:c,onTakeOver:p,onReclaim:B,onRename:A,onSetGate:k,onTune:C,onDelegate:b,delegations:v,sessions:F,onOpenSession:m,onReviewReturn:f}){const[D,h]=g.useState(""),[E,w]=g.useState(!1),[P,I]=g.useState(!1),[j,y]=g.useState(!1),[_,L]=g.useState(e.title),K=vt(),M=zt(!0),z=e.controller==="external"||e.controller===void 0&&(e.origin==="terminal"||e.origin==="vscode"),q=e.live&&(e.status==="running"||e.status==="waiting"),J=e.control==="observe",R=e.surface??e.origin,se=!J&&(q||e.resumable)&&e.workspaceConflict===void 0,$=g.useRef(null),Y=g.useRef(!0),Pe=Mx(e.lastActivityAt??e.startedAt);g.useEffect(()=>{j||L(e.title)},[j,e.title]),g.useEffect(()=>{z&&q||I(!1)},[z,q]),g.useEffect(()=>{const Z=$.current;Z&&Y.current&&(Z.scrollTop=Z.scrollHeight)},[e.blocks]);const pe=()=>{const Z=D.trim();if(Z!==""){if(z&&q){w(!0);return}(z?p:c)(Z)&&h("")}};return s.jsxs(Wx,{depth:1,still:K,children:[s.jsxs("main",{className:"shell hasdock",children:[s.jsx(Vx,{diagnostic:r,error:o,onClearError:x}),s.jsxs("div",{className:"detailhead",children:[s.jsxs("div",{className:"toprow",children:[s.jsx(ke.h2,{...K?{}:{layoutId:`title-${e.sessionId}`},transition:ze,children:e.title||e.sessionId}),s.jsxs("div",{className:"detailactions",children:[C&&!J&&(e.agent==="claude"||e.agent==="codex")?s.jsxs(te,{className:"sm tunekey",onClick:C,label:"Change model and reasoning for this conversation",children:[s.jsx(Ar,{size:14,strokeWidth:2.3,"aria-hidden":"true"}),"Tune"]}):null,b&&!J?s.jsxs(te,{className:"sm delegatekey",onClick:()=>b(),label:"Delegate from this session",children:[s.jsx(sn,{size:14,strokeWidth:2.3,"aria-hidden":"true"}),"Delegate"]}):null,A?s.jsxs(te,{className:"sm",onClick:()=>y(Z=>!Z),label:"Rename this conversation",children:[s.jsx(Pc,{size:13,strokeWidth:2.2,"aria-hidden":"true"}),"Rename"]}):null,B&&z&&q&&!J?s.jsxs(te,{className:"sm reclaimkey",onClick:()=>I(!0),label:"End the native process and return control to this phone",children:[s.jsx(ai,{size:14,strokeWidth:2.2,"aria-hidden":"true"}),"Take back"]}):null,q&&!J?s.jsxs(te,{className:"sm stopkey",onClick:d,label:"Stop this agent",children:[s.jsx(Qo,{size:13,strokeWidth:2.6,fill:"currentColor","aria-hidden":"true"}),"Stop"]}):e.resumable?s.jsxs(te,{className:"sm",onClick:u,label:"Reopen this conversation",children:[s.jsx(Mc,{size:14,strokeWidth:2.4,"aria-hidden":"true"}),"Reopen"]}):null]})]}),s.jsxs("p",{className:"meta",children:[s.jsxs("span",{className:"sessionidentity detailidentity",children:[s.jsx(i0,{status:e.status}),s.jsx("span",{className:`state ${e.status}`,children:J?"observed in VS Code":!e.live&&e.status==="waiting"?"ready to reopen":bx[e.status]??e.status}),s.jsx("span",{className:"identitydivider","aria-hidden":"true"}),s.jsx($t,{agent:e.agent}),s.jsx(nn,{origin:R})]}),e.settings?.mode?s.jsx("span",{className:"sessiontag modetag",children:e.settings.mode}):null,e.permissionMode?s.jsx("span",{title:"The permission mode this session is running in",children:U9[e.permissionMode]??e.permissionMode}):null,e.settings?.model?s.jsx("span",{className:"sessiontag settingtag",children:e.settings.model}):null,e.settings?.effort?s.jsxs("span",{children:[e.settings.effort," effort"]}):null,e.settings?.thinking?s.jsx("span",{children:e.settings.thinking.mode==="fixed"?`${e.settings.thinking.budgetTokens?.toLocaleString()} thinking tokens`:e.settings.thinking.mode==="disabled"?"thinking off":"adaptive thinking"}):null,e.workspace?.mode==="isolated"?s.jsx("span",{className:"sessiontag isolatedtag",title:e.workspace.branch,children:"isolated branch"}):null,s.jsx(Ir,{text:e.cwd,kind:"folder",max:30,expandable:!0}),Pe?s.jsxs("time",{className:"sessiontime",dateTime:Pe.dateTime,title:Pe.title,children:["updated ",Pe.label]}):null]}),j&&A?s.jsxs("form",{className:"rename-session",onSubmit:Z=>{Z.preventDefault();const Ee=_.replace(/\s+/g," ").trim();Ee!==""&&A(Ee)&&y(!1)},children:[s.jsx("label",{htmlFor:`rename-${e.sessionId}`,children:"Session name"}),s.jsxs("div",{children:[s.jsx("input",{id:`rename-${e.sessionId}`,value:_,maxLength:80,autoFocus:!0,onChange:Z=>L(Z.target.value)}),s.jsx(te,{className:"sm primary",type:"submit",disabled:_.trim()==="",children:"Save"}),s.jsx(te,{className:"sm",type:"button",onClick:()=>y(!1),children:"Cancel"})]})]}):null,z&&q&&!J?s.jsx(rh,{gate:e.gate??"ask",...e.permissionMode?{permissionMode:e.permissionMode}:{},onSet:k}):null,!J&&(e.agent==="claude"||e.agent==="codex")?s.jsx(sh,{cwd:e.cwd,resumeId:e.resumeId,agent:e.agent,live:q,expandedByDefault:R==="phone"||e.resumeId!==void 0,onRelease:d}):null]}),J?s.jsxs("div",{className:"observed-session",role:"status",children:[s.jsx(nc,{size:18,strokeWidth:2.1,"aria-hidden":"true"}),s.jsxs("div",{children:[s.jsx("strong",{children:"Live activity from Codex in VS Code"}),s.jsx("p",{children:"LongLeash can read this provider transcript, but VS Code has not supplied a verified process handle. This view does not claim the workspace or create another writer. Continue or stop it in VS Code until the next lifecycle hook grants control."})]})]}):null,e.workspaceConflict&&!J?s.jsxs("div",{className:"workspace-conflict",role:"alert",children:[s.jsx(Vn,{size:18,strokeWidth:2.2,"aria-hidden":"true"}),s.jsxs("div",{children:[s.jsx("strong",{children:e.workspaceConflict.processPaused?"Checkout process paused to prevent two writers":"Conflict detected — process pause not verified"}),s.jsxs("p",{children:[F?.[e.workspaceConflict.ownerSessionId]?.title?s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:F[e.workspaceConflict.ownerSessionId]?.title})," owns"]}):"Another active session owns",s.jsxs("span",{className:"mono",children:[" ",Sr(e.workspaceConflict.cwd)]}),".",e.workspaceConflict.processPaused?" Open or stop it, or start a new Safe parallel session to work in an isolated branch.":" Permission requests are denied, but auto-approved activity cannot be guaranteed. Stop this session immediately before continuing."]}),m&&F?.[e.workspaceConflict.ownerSessionId]?s.jsx("button",{type:"button",className:"tap quiet conflict-open",onClick:()=>m(e.workspaceConflict?.ownerSessionId??""),children:"Open controlling session"}):null]})]}):null,m&&F?s.jsx(th,{session:e,delegations:v??[],sessions:F,onOpen:m,...f?{onReviewReturn:f}:{}}):null,t.length>0?s.jsxs("section",{"aria-live":"polite",children:[s.jsx(Nt,{count:t.length,urgent:!0,children:"Needs you"}),s.jsx("div",{className:"stack",children:s.jsx(xt,{initial:!1,children:t.map(Z=>Z.questions?s.jsx(Sx,{approval:Z,questions:Z.questions,onAnswer:a,onLeave:l},Z.approvalId):s.jsx(_x,{approval:Z,onDecide:i},Z.approvalId))})})]}):null,s.jsxs("section",{children:[s.jsx(Nt,{children:"Conversation"}),s.jsx("div",{className:"readout",ref:$,onScroll:Z=>{const Ee=Z.currentTarget;Y.current=Ee.scrollHeight-Ee.scrollTop-Ee.clientHeight<90},children:e.blocks.length===0?s.jsx("p",{className:"empty",children:"Nothing yet."}):s.jsx(o8,{blocks:e.blocks,...b?{onDelegate:Z=>b(Z.firstSeq)}:{}})}),e.error?s.jsx("div",{style:{marginTop:12},children:s.jsx(K0,{tone:"bad",children:e.error})}):null,e.activity.length>0?s.jsxs("p",{className:"small dim",style:{margin:"12px 2px 0"},children:["Ran without asking:"," ",s.jsx("span",{className:"mono",children:e.activity.slice(-5).map(Z=>Z.toolName).join(", ")})]}):null]})]}),s.jsx("div",{className:"dock",...M>0?{style:{bottom:M}}:{},children:E?s.jsxs("div",{className:"transfer-confirm",role:"alertdialog","aria-label":"Transfer session to phone",children:[s.jsxs("div",{children:[s.jsx("strong",{children:"Move this conversation to your phone?"}),s.jsxs("p",{children:["The current ",R==="vscode"?"VS Code":"terminal"," run will close first. LongLeash waits for it to release the transcript before sending your message."]})]}),s.jsxs("div",{className:"transfer-actions",children:[s.jsx(te,{className:"sm",onClick:()=>w(!1),children:"Keep it there"}),s.jsx(te,{className:"sm primary",onClick:()=>{const Z=D.trim();Z!==""&&p(Z)&&(h(""),w(!1))},disabled:!n,children:"End there & continue here"})]})]}):P?s.jsxs("div",{className:"transfer-confirm",role:"alertdialog","aria-label":"Return control to phone",children:[s.jsxs("div",{children:[s.jsxs("strong",{children:["End the ",R==="vscode"?"VS Code":"terminal"," run?"]}),s.jsx("p",{children:"LongLeash will stop that exact verified provider process, wait for it to exit, and park this same conversation on your phone. No prompt is sent until you type one."})]}),s.jsxs("div",{className:"transfer-actions",children:[s.jsx(te,{className:"sm",onClick:()=>I(!1),children:"Keep it there"}),s.jsx(te,{className:"sm primary",onClick:()=>{B?.()&&I(!1)},disabled:!n,children:"End there & return here"})]})]}):se?s.jsxs("div",{className:"dock-in",children:[s.jsx("textarea",{className:"field",rows:1,value:D,onChange:Z=>h(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&(Z.metaKey||Z.ctrlKey)&&(Z.preventDefault(),pe())},placeholder:z?"Take over and reply…":q?"Reply…":"Carry this on…","aria-label":"Reply to this session"}),s.jsx(te,{className:"primary icon",onClick:pe,disabled:!D.trim()||!n,label:"Send reply",children:s.jsx(zl,{size:20,strokeWidth:2.6,"aria-hidden":"true"})})]}):s.jsx("p",{className:"note",children:J?"This conversation is still controlled in VS Code. LongLeash is observing its provider transcript, but cannot stop or write to that process until a lifecycle hook grants control.":e.workspaceConflict?"This checkout is paused while another session owns it. No message or tool is sent from here.":"This conversation cannot be continued — it has no resume point. Start a new session in the same folder to pick the work back up."})})]})}function th({session:e,delegations:t,sessions:n,onOpen:r,onReviewReturn:o}){const x=t.find(l=>l.targetSessionId===e.sessionId),i=x?.sourceSessionId??e.relationship?.parentSessionId,a=t.filter(l=>l.sourceSessionId===e.sessionId);return i===void 0&&a.length===0?null:s.jsxs("section",{className:"lineage","aria-label":"Delegated work",children:[i?s.jsxs("div",{className:"lineage-source-row",children:[s.jsxs("button",{type:"button",className:"lineage-parent",onClick:()=>r(i),disabled:n[i]===void 0,children:[s.jsx(sn,{size:16,strokeWidth:2.3,"aria-hidden":"true"}),s.jsxs("span",{children:[s.jsx("small",{children:"Delegated from"}),s.jsx("strong",{children:n[i]?.title||"Source session"})]}),s.jsx("span",{className:"lineage-open",children:"Open source"})]}),x?.status==="ready"&&o?s.jsx("button",{type:"button",className:"lineage-return",onClick:()=>o(x.delegationId),children:"Review return"}):null]}):null,a.length>0?s.jsxs("div",{className:"lineage-children",children:[s.jsxs("div",{className:"lineage-label",children:[s.jsx("span",{children:"Delegated work"}),s.jsx("span",{className:"mono",children:a.length})]}),a.map(l=>{const d=l.targetSessionId?n[l.targetSessionId]:void 0,u=l.targetSessionId!==void 0&&d!==void 0;return s.jsxs("div",{className:"lineage-row",children:[s.jsxs("button",{type:"button",className:"lineage-child",onClick:()=>l.targetSessionId&&r(l.targetSessionId),disabled:!u,children:[s.jsx("span",{className:"lineage-agent","data-agent":l.targetAgent,children:tn[l.targetAgent]??l.targetAgent}),s.jsx("span",{className:"lineage-role",children:l.role}),s.jsx("span",{className:`lineage-status ${l.status}`,children:nh(l,d)}),l.failure?s.jsx("small",{children:l.targetSessionId===void 0?`No child was created. ${l.failure}`:l.failure}):null]}),l.status==="ready"&&o?s.jsx("button",{type:"button",className:"lineage-return",onClick:()=>o(l.delegationId),children:"Review return"}):null]},l.delegationId)})]}):null]})}function nh(e,t){return e.status==="ready"?"ready to review":e.status==="starting"?"starting…":e.status==="failed"&&e.targetSessionId===void 0?"not started":e.status!=="running"?e.status:t?.status==="waiting"?t.live?"waiting for you":"ready to reopen":t?.status==="errored"?"failed":t?.status==="ended"?"ready to review":"working"}function rh({gate:e,permissionMode:t,onSet:n}){const r=e==="auto";return s.jsxs("div",{className:"gateswitch",children:[s.jsxs("button",{type:"button",className:"tap quiet","aria-pressed":r,onClick:()=>n(r?"ask":"auto"),children:[r?s.jsx(ql,{size:14,strokeWidth:2.2,"aria-hidden":"true"}):s.jsx(Kl,{size:14,strokeWidth:2.2,"aria-hidden":"true"}),r?"Not asking you — tap to ask again":"Asking you first — tap to stop asking"]}),r?s.jsx("p",{className:"gatenote",children:"Tools run without reaching your phone. The transcript still shows everything."}):t==="bypassPermissions"?s.jsx("p",{className:"gatenote",children:"This session auto-approves everything on the laptop, so your answer cannot stop it. Stop asking, or Stop the session."}):null]})}function sh({cwd:e,resumeId:t,agent:n,live:r,expandedByDefault:o=!1,onRelease:x}){const[i,a]=g.useState(o),[l,d]=g.useState(!1),[u,c]=g.useState(!1),[p,B]=g.useState(!1),[A,k]=g.useState("terminal"),C=t===void 0?"":JSON.stringify(t),b=n==="codex"?`codex resume ${C}`:`claude --resume ${C}`,v=n==="codex"?`codex resume ${C}`:`claude --ide --resume ${C}`,F=A==="terminal"?`cd ${JSON.stringify(e)} && ${b}`:`code -r ${JSON.stringify(e)} && cd ${JSON.stringify(e)} && ${v}`,m=()=>{if(t===void 0)return;c(!1);const f=navigator.clipboard;if(!f){c(!0);return}f.writeText(F).then(()=>{d(!0),setTimeout(()=>d(!1),2500)}).catch(()=>{c(!0)})};return s.jsxs("div",{className:"resumeterm",children:[s.jsxs("button",{type:"button",className:"tap quiet","aria-expanded":i,onClick:()=>a(f=>!f),children:[s.jsx(H0,{size:14,strokeWidth:2.2,"aria-hidden":"true"}),i?"Hide terminal handoff":r?"Move to a terminal":"Continue in a terminal"]}),i?s.jsx(ke.div,{className:"resumebody",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},transition:Eo,children:t===void 0?s.jsx("p",{className:"handoffpending",role:"status",children:"Preparing the exact terminal command…"}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"handoff-target",role:"group","aria-label":"Handoff destination",children:[s.jsx("button",{type:"button","aria-pressed":A==="terminal",onClick:()=>k("terminal"),children:"Terminal"}),s.jsx("button",{type:"button","aria-pressed":A==="vscode",onClick:()=>k("vscode"),children:"VS Code workspace"})]}),s.jsx("code",{className:"resumecmd",children:F}),s.jsxs("div",{className:"handoff-actions",children:[s.jsx(te,{className:"wide",onClick:m,children:l?s.jsxs(s.Fragment,{children:[s.jsx(Ke,{size:15,strokeWidth:2.6,"aria-hidden":"true"}),"Copied"]}):s.jsxs(s.Fragment,{children:[s.jsx(li,{size:15,strokeWidth:2.2,"aria-hidden":"true"}),"Copy command"]})}),r?s.jsxs(te,{className:"wide",onClick:()=>{B(!0),x?.(),setTimeout(()=>B(!1),8e3)},disabled:p,children:[s.jsx(Qo,{size:14,strokeWidth:2.5,fill:"currentColor","aria-hidden":"true"}),p?"Releasing…":"Release current run"]}):null]}),s.jsx("p",{className:"resumenote",children:A==="vscode"?n==="claude"?"This opens the project and resumes Claude with its VS Code IDE connection. It does not inject the conversation into Claude’s chat panel.":"This opens the project in VS Code, then resumes Codex in the terminal where you run this command. It cannot inject the conversation into Codex’s chat panel.":r?"Copy now if you want, but release this running session before executing it. That prevents active-writer conflicts.":"Paste this in any terminal to continue this exact conversation at your keyboard."}),u?s.jsx("p",{className:"handofferror",role:"alert",children:"Clipboard access was blocked. Long-press the command to copy it."}):null]})}):null]})}function oh({state:e,onEnable:t,onTest:n}){const[r,o]=g.useState(!1);return e==="unsupported"?s.jsx("div",{className:"pushoffer",children:s.jsxs("p",{children:["This browser cannot show lock-screen alerts. On iPhone, open LongLeash from its"," ",s.jsx("strong",{children:"home-screen icon"})," — Safari tabs are not allowed to send notifications."]})}):e==="stale-daemon"?s.jsx("div",{className:"pushoffer",children:s.jsxs("p",{children:["Your laptop is running an older daemon that cannot send alerts yet. In its terminal press ",s.jsx("span",{className:"mono",children:"q"}),", then start it again with"," ",s.jsx("span",{className:"mono",children:"pnpm start ~"}),"."]})}):e==="denied"?s.jsx("div",{className:"pushoffer",children:s.jsxs("p",{children:["Notifications are switched off for LongLeash. Turn them on in iPhone"," ",s.jsx("strong",{children:"Settings → Notifications → LongLeash → Allow"}),", then reopen this app."]})}):e==="on"?s.jsxs("div",{className:"pushoffer",children:[s.jsxs("p",{children:["Lock-screen alerts are ",s.jsx("strong",{children:"on"}),". When an agent needs you, your phone gets a content-free tap — the words stay in here."]}),s.jsx(te,{onClick:()=>{n?.()&&o(!0)},children:r?"Sent — lock your phone now":"Send a test alert"}),r?s.jsx("p",{className:"aftertest",children:"The test arrives a few seconds after you lock the screen."}):null]}):s.jsxs("div",{className:"pushoffer",children:[s.jsx("p",{children:"Get tapped on the shoulder the moment an agent needs you — even with this app closed. The notification carries no content, ever; it only says to look here."}),s.jsx(te,{...t?{onClick:t}:{},children:"Enable lock-screen alerts"})]})}function Wx({children:e}){return s.jsx(ke.div,{initial:!1,animate:{opacity:1,transition:Eo},exit:{opacity:0,transition:We},children:e})}function Vx({diagnostic:e,error:t,onClearError:n}){return s.jsxs(xt,{initial:!1,children:[e?s.jsx(K0,{children:e},"diag"):null,t?s.jsx(K0,{tone:"bad",onDismiss:n,children:t},"err"):null]})}function xh(){return s.jsxs("section",{className:"firstrun",children:[s.jsx(Lr,{}),s.jsx("h2",{children:"Your laptop is linked"}),s.jsxs("p",{children:["Tap ",s.jsx("strong",{children:"New session"}),", choose Claude or Codex, name a folder, and tell the agent what to do. It asks you before it changes anything."]})]})}function Lr(){return s.jsx("span",{className:"mark","aria-hidden":"true",children:s.jsx("img",{src:"/icon-192.png",alt:"",width:76,height:76})})}function ih({getToken:e}){const[t,n]=g.useState([]),[r,o]=g.useState(0),[x,i]=g.useState(!1),[a,l]=g.useState(!1),[d,u]=g.useState(""),[c,p]=g.useState(!1),[B,A]=g.useState(null),[k,C]=g.useState(""),[b,v]=g.useState("received"),[F,m]=g.useState("");async function f(E,w={}){const P=await e();if(!P)throw new Error("Please sign in again.");const I=await fetch(E,{...w,cache:"no-store",signal:AbortSignal.timeout(15e3),headers:{Authorization:`Bearer ${P}`,"Content-Type":"application/json"}});if(I.status===403)throw new Error("Owner access requires the configured owner account and a first- and second-factor verification within the last 10 minutes. Sign in again with your authenticator, then refresh. A normal Google sign-in alone does not meet this requirement.");const j=await I.json();if(!I.ok)throw new Error(typeof j.error=="string"?j.error:"Request failed. Please retry.");return j}async function D(E){l(!0),u(""),p(!1),n([]),A(null);try{const w=await f(`/api/owner/feedback?page=${E}`);n(w.tickets),i(w.hasMore),o(E),p(!0)}catch(w){u(w instanceof Error?w.message:"Unable to open the inbox.")}finally{l(!1)}}g.useEffect(()=>{D(0)},[]);async function h(){if(B){l(!0),u(""),m("");try{const E=await f(`/api/owner/feedback/${B.id}`,{method:"PATCH",body:JSON.stringify({messageId:crypto.randomUUID(),reply:k,status:b,revision:B.revision})});A(E.ticket),C(""),v(E.ticket.status),m("Reply saved to the private report.")}catch(E){u(E instanceof Error?E.message:"Reply was not saved.")}finally{l(!1)}}}return s.jsxs("section",{className:"owner-feedback-view","aria-labelledby":"owner-feedback-title",children:[s.jsxs("header",{className:"owner-section-heading",children:[s.jsx("h2",{id:"owner-feedback-title",children:"Customer inbox"}),s.jsx("p",{children:"Private reports and direct replies. Every request is re-authorized on the server."})]}),s.jsxs("button",{className:"key",onClick:()=>{D(r)},disabled:a,children:[s.jsx(fo,{size:16,"aria-hidden":"true"})," Refresh inbox"]}),d&&s.jsx("p",{className:"feedback-error",role:"alert",children:d}),F&&s.jsx("p",{role:"status",children:F}),a&&s.jsx("p",{role:"status",children:"Loading…"}),c&&t.length===0&&s.jsxs("section",{className:"feedback-panel",children:[s.jsx(po,{size:24,"aria-hidden":"true"}),s.jsx("h2",{children:"No reports on this page."}),s.jsx("p",{children:"New feedback will appear here. This is not a measure of registered users."})]}),s.jsxs("div",{className:"feedback-layout",style:{marginTop:24},children:[s.jsxs("section",{"aria-label":"Reports",children:[t.map(E=>s.jsxs("button",{className:"feedback-ticket key",disabled:a,onClick:()=>{(async()=>{l(!0),u(""),m("");try{const w=await f(`/api/owner/feedback/${E.id}`);A(w.ticket),C(""),v(w.ticket.status)}catch(w){u(w instanceof Error?w.message:"Unable to open the report.")}finally{l(!1)}})()},children:[s.jsx("strong",{children:E.subject}),s.jsxs("small",{children:[E.category," · ",E.status.replaceAll("_"," ")," · ",new Date(E.created_at).toLocaleDateString()]})]},E.id)),c&&s.jsxs("div",{className:"feedback-actions",children:[s.jsx("button",{className:"key sm",disabled:a||r===0,onClick:()=>{D(r-1)},children:"Previous"}),s.jsxs("span",{children:["Page ",r+1]}),s.jsx("button",{className:"key sm",disabled:a||!x,onClick:()=>{D(r+1)},children:"Next"})]})]}),B&&s.jsxs("form",{className:"feedback-panel",onSubmit:E=>{E.preventDefault(),h()},children:[s.jsx("h2",{children:B.subject}),s.jsx("div",{className:"feedback-thread","aria-label":"Private conversation",children:(B.messages??[]).map(E=>s.jsxs("article",{className:`feedback-message-card ${E.author}`,children:[s.jsxs("header",{children:[s.jsx("strong",{children:E.author==="owner"?"You":"Customer"}),s.jsx("time",{dateTime:new Date(E.created_at).toISOString(),children:new Date(E.created_at).toLocaleString()})]}),s.jsx("p",{children:E.body}),s.jsx("small",{children:E.status_snapshot.replaceAll("_"," ")})]},E.id))}),s.jsx("label",{htmlFor:"owner-status",children:"Status"}),s.jsx("select",{id:"owner-status",value:b,onChange:E=>v(E.target.value),disabled:a,children:["received","needs_information","planned","resolved","not_planned"].map(E=>s.jsx("option",{value:E,children:E.replaceAll("_"," ")},E))}),s.jsx("label",{htmlFor:"owner-reply",children:"Add a reply"}),s.jsx("textarea",{id:"owner-reply",maxLength:4e3,required:!0,value:k,rows:6,disabled:a,onChange:E=>C(E.target.value)}),s.jsx("p",{className:"feedback-meta",children:"The customer reads this at their private link. The notification email never includes their report text."}),s.jsx("button",{className:"key",type:"submit",disabled:a||!k.trim(),children:"Save reply"})]})]})]})}async function hr(e,t,n={}){const r=await e();if(!r)throw new Error("Please sign in again.");const o=await fetch(t,{...n,cache:"no-store",signal:AbortSignal.timeout(15e3),headers:{Authorization:`Bearer ${r}`,...n.body?{"Content-Type":"application/json"}:{}}}),x=await o.json().catch(()=>({}));if(o.status===403)throw new Error("Owner tools require the configured owner account and a recent authenticator verification. Open account security, verify both factors, then retry within 10 minutes.");if(!o.ok)throw new Error(x.error??"The owner service is unavailable. No cached value was substituted.");return x}function De({label:e,value:t,detail:n}){return s.jsxs("article",{className:"owner-metric",children:[s.jsx("span",{children:e}),s.jsx("strong",{children:t}),n?s.jsx("small",{children:n}):null]})}function xo({label:e,value:t}){return s.jsx(De,{label:e,value:t?`${Math.round(t.retained/t.eligible*100)}%`:"No eligible cohort",detail:t?`${t.retained} of ${t.eligible} eligible accounts returned on that exact UTC day`:"Young cohorts are excluded, not counted as failures"})}function ah({getToken:e}){const[t,n]=g.useState(null),[r,o]=g.useState(!1),[x,i]=g.useState(""),[a,l]=g.useState(""),d=async()=>{o(!0),i("");try{n(await hr(e,"/api/owner/summary"))}catch(B){i(B instanceof Error?B.message:"Unable to load the owner summary.")}finally{o(!1)}};g.useEffect(()=>{d()},[]);const u=async()=>{o(!0),i(""),l("");try{const B=await hr(e,"/api/owner/email-test",{method:"POST"});l(B.detail??"Email test queued.")}catch(B){i(B instanceof Error?B.message:"Email test was not queued.")}finally{o(!1)}},c=t?.email.filter(B=>B.deliveryState==="delivered").reduce((B,A)=>B+A.count,0)??0,p=t?.email.filter(B=>B.state==="accepted"&&B.deliveryState==="unconfirmed").reduce((B,A)=>B+A.count,0)??0;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"owner-toolbar",children:[s.jsxs("button",{className:"key sm",disabled:r,onClick:()=>{d()},children:[s.jsx(fo,{size:16,"aria-hidden":"true"})," Refresh evidence"]}),s.jsxs("button",{className:"key sm",disabled:r,onClick:()=>{u()},children:[s.jsx(yc,{size:16,"aria-hidden":"true"})," Send controlled email test"]})]}),x?s.jsx("p",{className:"feedback-error",role:"alert",children:x}):null,a?s.jsx("p",{role:"status",children:a}):null,r&&!t?s.jsx("p",{role:"status",children:"Loading current sources…"}):null,t?s.jsxs("div",{className:"owner-sections",children:[s.jsxs("section",{className:"feedback-panel",children:[s.jsx("h2",{children:"Accounts"}),s.jsx("p",{children:"Read live from Clerk Production. Owner and test accounts are excluded from external adoption."}),s.jsxs("div",{className:"owner-metrics",children:[s.jsx(De,{label:"Registered",value:t.accounts.registered}),s.jsx(De,{label:"External",value:t.accounts.external}),s.jsx(De,{label:"New external, 7 days",value:t.accounts.newExternal,detail:`${t.accounts.newAccounts} including owner/test`}),s.jsx(De,{label:"Active external, 7 days",value:t.accounts.activeExternal,detail:`${t.accounts.activeAccounts} including owner/test`})]})]}),s.jsxs("section",{className:"feedback-panel",children:[s.jsx("h2",{children:"Observed product use"}),s.jsx("p",{children:"Only accounts that explicitly opted in. Browser acknowledgements are operational evidence, not billing records."}),s.jsx("div",{className:"owner-metrics",children:t.measurement.state==="not_measured"?s.jsx(De,{label:"Coverage",value:"Not measured",detail:"No consenting account has produced an eligible sample"}):s.jsxs(s.Fragment,{children:[s.jsx(De,{label:"Consenting",value:t.measurement.consentedAccounts}),s.jsx(De,{label:"Paired",value:t.measurement.pairedAccounts??0}),s.jsx(De,{label:"Activated",value:t.measurement.activatedAccounts??0}),s.jsx(De,{label:"Weekly active",value:t.measurement.weeklyActiveAccounts??0}),s.jsx(De,{label:"Repeat",value:t.measurement.repeatAccounts??0}),s.jsx(xo,{label:"D7 retention",value:t.measurement.retention.d7}),s.jsx(xo,{label:"D30 retention",value:t.measurement.retention.d30})]})}),t.measurement.actions&&Object.keys(t.measurement.actions).length>0?s.jsxs("div",{className:"owner-action-grid",role:"table","aria-label":"Observed action reliability",children:[s.jsxs("div",{className:"heading",role:"row",children:[s.jsx("span",{role:"columnheader",children:"Action"}),s.jsx("span",{role:"columnheader",children:"Success"}),s.jsx("span",{role:"columnheader",children:"Failed"}),s.jsx("span",{role:"columnheader",children:"Unknown"})]}),Object.entries(t.measurement.actions).sort(([B],[A])=>B.localeCompare(A)).map(([B,A])=>s.jsxs("div",{role:"row",children:[s.jsx("strong",{role:"cell",children:B}),s.jsx("span",{role:"cell",children:A.success}),s.jsx("span",{role:"cell",children:A.failure}),s.jsx("span",{role:"cell",children:A.unknown})]},B))]}):null,s.jsxs("p",{className:"feedback-meta",children:["Window: ",t.measurement.window.start," to ",t.measurement.window.endExclusive," UTC, end exclusive."]})]}),s.jsxs("section",{className:"feedback-panel",children:[s.jsx("h2",{children:"Customer inbox and delivery"}),s.jsxs("div",{className:"owner-metrics",children:[s.jsx(De,{label:"Open reports",value:t.feedback.open}),s.jsx(De,{label:"Awaiting first reply",value:t.feedback.unanswered}),s.jsx(De,{label:"Email delivered",value:c,detail:"Verified Resend delivery webhook"}),s.jsx(De,{label:"Accepted, unconfirmed",value:p,detail:"Provider accepted it; inbox delivery is not yet proven"})]})]}),s.jsxs("p",{className:"feedback-meta",children:["Generated ",new Date(t.generatedAt).toLocaleString(),". Missing sources fail visibly; the dashboard never substitutes stale values."]})]}):null]})}function lh({getToken:e}){const[t,n]=g.useState(null),[r,o]=g.useState(0),[x,i]=g.useState(""),[a,l]=g.useState(""),[d,u]=g.useState(!1),[c,p]=g.useState(""),B=async(k=r,C=a)=>{u(!0),p("");try{n(await hr(e,`/api/owner/accounts?offset=${k}&query=${encodeURIComponent(C)}`)),o(k),l(C)}catch(b){p(b instanceof Error?b.message:"Unable to load accounts.")}finally{u(!1)}};g.useEffect(()=>{B(0,"")},[]);const A=k=>{k.preventDefault(),B(0,x.trim())};return s.jsxs("section",{className:"feedback-panel owner-account-panel",children:[s.jsxs("div",{className:"owner-account-heading",children:[s.jsxs("div",{children:[s.jsx("h2",{children:"Registered accounts"}),s.jsx("p",{children:"Live, paginated Clerk data. This view has no path to laptop sessions or transcripts."})]}),s.jsxs("form",{className:"owner-search",onSubmit:A,children:[s.jsx("label",{className:"sr",htmlFor:"owner-account-search",children:"Search accounts"}),s.jsx(fn,{size:16,"aria-hidden":"true"}),s.jsx("input",{id:"owner-account-search",maxLength:80,value:x,onChange:k=>i(k.target.value),placeholder:"Name or email"}),s.jsx("button",{className:"key sm",disabled:d,children:"Search"})]})]}),c?s.jsx("p",{className:"feedback-error",role:"alert",children:c}):null,t?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"owner-metrics",children:[s.jsx(De,{label:"Registered",value:t.totals.registered}),s.jsx(De,{label:"External",value:t.totals.external}),s.jsx(De,{label:"Owner",value:t.totals.owners}),s.jsx(De,{label:"Test",value:t.totals.tests})]}),s.jsxs("div",{className:"owner-account-list",role:"table","aria-label":"Clerk production accounts",children:[s.jsxs("div",{className:"owner-account-row heading",role:"row",children:[s.jsx("span",{role:"columnheader",children:"Account"}),s.jsx("span",{role:"columnheader",children:"Classification"}),s.jsx("span",{role:"columnheader",children:"Joined"}),s.jsx("span",{role:"columnheader",children:"Last active"})]}),t.users.map(k=>s.jsxs("div",{className:"owner-account-row",role:"row",children:[s.jsxs("span",{role:"cell",children:[s.jsx("strong",{children:k.name??"Unnamed account"}),s.jsxs("small",{children:[k.primaryEmail??"No primary email"," · ",k.emailVerified?"verified":"unverified"]})]}),s.jsx("span",{role:"cell",children:s.jsx("mark",{className:`owner-class ${k.classification}`,children:k.classification})}),s.jsx("span",{role:"cell",children:new Date(k.createdAt).toLocaleDateString()}),s.jsx("span",{role:"cell",children:k.lastActiveAt?new Date(k.lastActiveAt).toLocaleString():"Never recorded"})]},k.id))]}),s.jsxs("div",{className:"feedback-actions",children:[s.jsx("button",{className:"key sm",disabled:d||r===0,onClick:()=>{B(Math.max(0,r-25))},children:"Previous"}),s.jsx("span",{children:t.pagination.total===0?"No accounts":`${r+1}–${Math.min(r+t.users.length,t.pagination.total)} of ${t.pagination.total}`}),s.jsx("button",{className:"key sm",disabled:d||!t.pagination.hasMore,onClick:()=>{B(r+25)},children:"Next"})]})]}):d?s.jsx("p",{role:"status",children:"Loading current accounts…"}):null]})}function ch({getToken:e}){const t=window.location.pathname,n=t.endsWith("/feedback")?"feedback":t.endsWith("/accounts")?"accounts":"overview";return s.jsxs("main",{className:"feedback-page owner-console",children:[s.jsxs("a",{className:"feedback-back",href:"/",children:[s.jsx(ci,{size:16,"aria-hidden":"true"})," Back to sessions"]}),s.jsxs("header",{className:"feedback-heading",children:[s.jsx("p",{className:"eyebrow",children:"Owner workspace"}),s.jsx("h1",{children:"Customer operations."}),s.jsx("p",{children:"Current evidence from distinct sources, protected by server-side owner allowlisting and recent multi-factor verification."})]}),s.jsxs("nav",{className:"owner-nav","aria-label":"Owner tools",children:[s.jsxs("a",{className:n==="overview"?"active":"",href:"/owner",children:[s.jsx(Gl,{size:17,"aria-hidden":"true"})," Overview"]}),s.jsxs("a",{className:n==="accounts"?"active":"",href:"/owner/accounts",children:[s.jsx(Jc,{size:17,"aria-hidden":"true"})," Accounts"]}),s.jsxs("a",{className:n==="feedback"?"active":"",href:"/owner/feedback",children:[s.jsx(po,{size:17,"aria-hidden":"true"})," Feedback"]})]}),n==="overview"?s.jsx(ah,{getToken:e}):n==="accounts"?s.jsx(lh,{getToken:e}):s.jsx(ih,{getToken:e})]})}const Er="longleash.pending-pairing",dh="app.longleash.dev";function x0(e){const t=new URLSearchParams(e.hash.replace(/^#/,""));return t.has("c")&&t.has("s")||e.searchParams.has("c")&&e.searchParams.has("s")}function $n(e){const t=new URL(e.href);t.hash="";for(const n of["c","s","v"])t.searchParams.delete(n);return t.toString()}function uh(e,t){const n=new URL(t.href);x0(n)&&e.setItem(Er,`${n.pathname}${n.search}${n.hash}`)}function hh(e,t,n){const r=e.getItem(Er);if(r!==null&&(e.removeItem(Er),!x0(new URL(t.href))))try{const o=new URL(r,t.origin);o.origin===t.origin&&x0(o)&&n.replaceState(null,"",`${o.pathname}${o.search}${o.hash}`)}catch{}}async function Eh(e=fetch,t=window.location.hostname){try{const n=await e("/api/auth/config",{cache:"no-store",credentials:"same-origin"});if(!n.ok||!n.headers.get("Content-Type")?.includes("application/json"))throw new Error("not an auth endpoint");const r=await n.json();if(typeof r.required!="boolean"||typeof r.ready!="boolean")throw new Error("bad auth config");if(r.required&&r.ready&&!/^pk_(?:test|live)_/.test(r.publishableKey??""))throw new Error("bad publishable key");return{required:r.required,ready:r.ready,...typeof r.publishableKey=="string"?{publishableKey:r.publishableKey}:{}}}catch{return t.toLowerCase()===dh?{required:!0,ready:!1}:{required:!1,ready:!0}}}function fh(){const[e,t]=g.useState(null);return g.useEffect(()=>{let n=!0;try{uh(sessionStorage,window.location)}catch{}return Eh().then(r=>{n&&(r.required&&x0(new URL(window.location.href))&&window.history.replaceState(null,"",$n(window.location)),t(r))}),()=>{n=!1}},[]),e===null?s.jsx(fr,{}):e.required?!e.ready||e.publishableKey===void 0?s.jsx(io,{}):s.jsxs(Ko,{publishableKey:e.publishableKey,afterSignOutUrl:"/",signInFallbackRedirectUrl:$n(window.location),signUpFallbackRedirectUrl:$n(window.location),children:[s.jsx(kl,{children:s.jsx(fr,{})}),s.jsx(yl,{children:s.jsx(io,{})}),s.jsx(Dl,{children:s.jsx(ph,{})})]}):(Jt(null),Yt(null),s.jsx($x,{value:{hosted:!1},children:s.jsx(zx,{})}))}function ph(){const{isLoaded:e,isSignedIn:t,userId:n,getToken:r}=Ha(),{user:o}=Yi(),x=Ji(),[i,a]=g.useState(!1),[l,d]=g.useState(!0);if(g.useEffect(()=>{if(!e||!t){ut(null),a(!1),d(!1);return}let k=!0;return ut(()=>r(),!1),d(!0),g9().then(C=>{k&&(a(C),ut(()=>r(),C))}).catch(()=>{k&&a(!1)}).finally(()=>{k&&d(!1)}),()=>{k=!1,ut(null)}},[e,t,n]),!e)return s.jsx(fr,{});if(!t||n===void 0||n===null)return Jt(null),Yt(null),ut(null),s.jsx(mh,{});Jt(n),Yt(()=>r()),hh(sessionStorage,window.location,window.history);const u=o?.primaryEmailAddress?.emailAddress??o?.fullName??"LongLeash account",c=()=>{Yt(null),Jt(null),ut(null),x.signOut({redirectUrl:"/"})},p=()=>{if(!o)return;const k={exportedAt:new Date().toISOString(),account:{id:o.id,name:o.fullName,primaryEmail:o.primaryEmailAddress?.emailAddress??null,createdAt:o.createdAt?.toISOString()??null,lastSignInAt:o.lastSignInAt?.toISOString()??null},productMeasurement:{enabled:i,note:i?"Raw outcome events are retained for 30 days and per-account daily aggregates for 90 days.":"No opted-in product measurement is associated with this account."},excludedByDesign:["provider credentials","repositories","transcripts","prompts","approval content","pairing secrets"],note:"Development data stays on the paired laptop and is not part of the hosted account."},C=URL.createObjectURL(new Blob([`${JSON.stringify(k,null,2)}
|
|
27
|
+
`],{type:"application/json"})),b=document.createElement("a");b.href=C,b.download="longleash-account-export.json",b.hidden=!0,document.body.append(b),b.click(),b.remove(),window.setTimeout(()=>URL.revokeObjectURL(C),1e3)},B=async()=>{if(!o)throw new Error("The account is not loaded.");await Vs(!1),await o.delete(),S9(o.id),Yt(null),Jt(null),ut(null);try{await x.signOut({redirectUrl:"/"})}catch{window.location.assign("/")}},A=async k=>{d(!0);try{const C=await Vs(k);a(C),ut(()=>r(),C)}finally{d(!1)}};return s.jsx($x,{value:{hosted:!0,label:u,signOut:c,exportAccount:p,deleteAccount:B,measurementEnabled:i,measurementBusy:l,setMeasurement:A,openSecurity:()=>x.openUserProfile()},children:window.location.pathname==="/owner"||window.location.pathname.startsWith("/owner/")?s.jsx(ch,{getToken:()=>r()},n):s.jsx(zx,{},n)})}function Rr({children:e}){return s.jsxs("main",{className:"account-gate",children:[s.jsx("section",{className:"account-panel",children:e}),s.jsxs("p",{className:"buildtag mono",children:["build ","618e867"]})]})}function fr(){return s.jsxs(Rr,{children:[s.jsx("div",{className:"account-mark",children:s.jsx("img",{src:"/icon-192.png",alt:"",width:52,height:52})}),s.jsx("p",{className:"account-kicker",children:"LongLeash account"}),s.jsx("h1",{children:"Opening your control plane…"}),s.jsx("p",{className:"account-copy",children:"Checking the identity boundary before any paired device is shown."}),s.jsx("div",{className:"account-loader","aria-label":"Loading"})]})}function io(){return s.jsxs(Rr,{children:[s.jsx("div",{className:"account-mark danger",children:s.jsx(Fc,{size:25,"aria-hidden":"true"})}),s.jsx("p",{className:"account-kicker",children:"Securely unavailable"}),s.jsx("h1",{children:"Sign-in is not ready."}),s.jsx("p",{className:"account-copy",children:"LongLeash refused to open the hosted control plane without a verified account boundary. Nothing on your laptop was exposed. Try again after the launch configuration is complete."}),s.jsxs("button",{className:"key account-action",type:"button",onClick:()=>window.location.reload(),children:["Retry securely ",s.jsx(pr,{size:17,"aria-hidden":"true"})]})]})}function mh(){return s.jsxs(Rr,{children:[s.jsxs("div",{className:"account-heading",children:[s.jsx("div",{className:"account-mark",children:s.jsx("img",{src:"/icon-192.png",alt:"",width:52,height:52})}),s.jsxs("div",{children:[s.jsx("p",{className:"account-kicker",children:"LongLeash account"}),s.jsx("h1",{children:"Know who. Prove which laptop."})]})]}),s.jsx("p",{className:"account-copy",children:"Your verified account confirms who you are. A fresh QR still decides which laptop you control. They are separate locks, and neither gives LongLeash your provider credentials."}),s.jsxs("div",{className:"account-boundaries","aria-label":"LongLeash security boundaries",children:[s.jsx(q0,{icon:s.jsx(Fs,{}),title:"Account",detail:"Google or email"}),s.jsx(q0,{icon:s.jsx(pc,{}),title:"Pairing QR",detail:"Device authority"}),s.jsx(q0,{icon:s.jsx(di,{}),title:"Your laptop",detail:"Code stays here"})]}),s.jsx(Ol,{mode:"redirect",oauthFlow:"redirect",fallbackRedirectUrl:$n(window.location),withSignUp:!0,children:s.jsxs("button",{className:"key account-action",type:"button",children:[s.jsx(Fs,{size:19,"aria-hidden":"true"})," Continue to sign in ",s.jsx(pr,{size:17,"aria-hidden":"true"})]})}),s.jsxs("p",{className:"account-footnote",children:[s.jsx(a0,{size:15,"aria-hidden":"true"})," Choose Google, email code, or email and password. Clerk handles credentials; repositories, transcripts, prompts, and pairing secrets stay outside your account."]})]})}function q0({icon:e,title:t,detail:n}){return s.jsxs("div",{className:"account-boundary",children:[s.jsx("span",{children:e}),s.jsx("strong",{children:t}),s.jsx("small",{children:n})]})}ui.createRoot(document.getElementById("root")).render(s.jsx(g.StrictMode,{children:s.jsx(fh,{})}));if("serviceWorker"in navigator){const e="ll.reloaded";sessionStorage.getItem(e)&&sessionStorage.removeItem(e),navigator.serviceWorker.register("/sw.js",{updateViaCache:"none"});const t=navigator.serviceWorker.controller!==null;navigator.serviceWorker.addEventListener("controllerchange",()=>{t&&!sessionStorage.getItem(e)&&(sessionStorage.setItem(e,"1"),location.reload())})}
|