@appsolutely-io/waypoint 0.0.0-stage → 0.1.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +297 -2
- package/dist/block-reply-r8u-DNmZ.d.cts +181 -0
- package/dist/block-reply-z8El20nD.d.ts +181 -0
- package/dist/blocks-2ABWECKG.js +1 -0
- package/dist/blocks-7453YTYJ.cjs +1 -0
- package/dist/chunk-3KV7TDDR.cjs +3 -0
- package/dist/chunk-4BWV3SEL.cjs +1 -0
- package/dist/chunk-5Q3INHKA.js +1 -0
- package/dist/chunk-5TBO732O.js +1 -0
- package/dist/chunk-6OZSKCPT.cjs +1 -0
- package/dist/chunk-A3YOSFLE.cjs +1 -0
- package/dist/chunk-BRUQ75G3.cjs +1 -0
- package/dist/chunk-C3VS33WJ.js +1 -0
- package/dist/chunk-D2EGPBCX.cjs +1 -0
- package/dist/chunk-D4Q46KWA.js +1 -0
- package/dist/chunk-FBADWFRR.cjs +1 -0
- package/dist/chunk-FQSWQLRW.js +1 -0
- package/dist/chunk-GT6PI4CT.cjs +1 -0
- package/dist/chunk-II26UWZM.cjs +1 -0
- package/dist/chunk-IPI4O4LP.js +1 -0
- package/dist/chunk-JFMVVGGB.js +1 -0
- package/dist/chunk-K73VV7KA.js +1 -0
- package/dist/chunk-L4PFFRDE.js +3 -0
- package/dist/chunk-LLPGVQUT.cjs +1 -0
- package/dist/chunk-M63QOANE.js +1 -0
- package/dist/chunk-MEKDQDSV.js +1 -0
- package/dist/chunk-OEPKPDLD.js +1 -0
- package/dist/chunk-OWT55N6J.js +3 -0
- package/dist/chunk-PFR2J5BV.js +1 -0
- package/dist/chunk-Q7BULGQG.cjs +1 -0
- package/dist/chunk-QFBAOEPD.js +1 -0
- package/dist/chunk-QS3MKZOY.cjs +3 -0
- package/dist/chunk-RZ3AGK3U.cjs +1 -0
- package/dist/chunk-RZZDQWC2.js +1 -0
- package/dist/chunk-S73WZWDP.js +1 -0
- package/dist/chunk-T5XF2R74.js +1 -0
- package/dist/chunk-TCFCSGQ3.js +1 -0
- package/dist/chunk-TODYQ3SG.cjs +1 -0
- package/dist/chunk-TVSQHTK2.cjs +1 -0
- package/dist/chunk-VGGJGRNK.cjs +1 -0
- package/dist/chunk-XSHOLIC7.cjs +1 -0
- package/dist/chunk-XTKUDSDK.cjs +1 -0
- package/dist/chunk-XWDB2LS3.cjs +1 -0
- package/dist/cli.js +3 -0
- package/dist/confirmation-view-5BZ2PP7J.cjs +1 -0
- package/dist/confirmation-view-Z5JHY2F5.js +1 -0
- package/dist/conformance.cjs +1 -0
- package/dist/conformance.d.cts +10 -0
- package/dist/conformance.d.ts +10 -0
- package/dist/conformance.js +1 -0
- package/dist/flow-parser.cjs +1 -0
- package/dist/flow-parser.d.cts +3 -0
- package/dist/flow-parser.d.ts +3 -0
- package/dist/flow-parser.js +1 -0
- package/dist/flows-panel-2SCPYZ3X.js +1 -0
- package/dist/flows-panel-HQYJMOP4.cjs +1 -0
- package/dist/form-extras-RNMBCYV7.cjs +1 -0
- package/dist/form-extras-X3B3JCMH.js +1 -0
- package/dist/form-fill-C32AHxSr.d.cts +653 -0
- package/dist/form-fill-Dp3ut1_Y.d.ts +653 -0
- package/dist/form-session.cjs +1 -0
- package/dist/form-session.d.cts +7 -0
- package/dist/form-session.d.ts +7 -0
- package/dist/form-session.js +1 -0
- package/dist/frame-decoder.cjs +3 -0
- package/dist/frame-decoder.d.cts +5 -0
- package/dist/frame-decoder.d.ts +5 -0
- package/dist/frame-decoder.js +3 -0
- package/dist/generated-C9tbjwK0.d.cts +797 -0
- package/dist/generated-C9tbjwK0.d.ts +797 -0
- package/dist/hooks/index.cjs +1 -0
- package/dist/hooks/index.d.cts +48 -0
- package/dist/hooks/index.d.ts +48 -0
- package/dist/hooks/index.js +1 -0
- package/dist/i18n-WC9f-h_q.d.cts +151 -0
- package/dist/i18n-WC9f-h_q.d.ts +151 -0
- package/dist/index-B5idIFTx.d.cts +34 -0
- package/dist/index-DPzoKXCK.d.ts +34 -0
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +38 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +3 -0
- package/dist/intent-BQPPows1.d.cts +154 -0
- package/dist/intent-BuvqEU3Q.d.ts +154 -0
- package/dist/intent.cjs +1 -0
- package/dist/intent.d.cts +2 -0
- package/dist/intent.d.ts +2 -0
- package/dist/intent.js +1 -0
- package/dist/markdown-5NUOCOGY.js +23 -0
- package/dist/markdown-CG7NXI7X.cjs +23 -0
- package/dist/message-actions-ORBVYGNE.cjs +1 -0
- package/dist/message-actions-XNBBFHGW.js +1 -0
- package/dist/messages/en/index.cjs +1 -0
- package/dist/messages/en/index.d.cts +3 -0
- package/dist/messages/en/index.d.ts +3 -0
- package/dist/messages/en/index.js +1 -0
- package/dist/messages/index.cjs +1 -0
- package/dist/messages/index.d.cts +14 -0
- package/dist/messages/index.d.ts +14 -0
- package/dist/messages/index.js +1 -0
- package/dist/messages/zh-Hans/index.cjs +1 -0
- package/dist/messages/zh-Hans/index.d.cts +3 -0
- package/dist/messages/zh-Hans/index.d.ts +3 -0
- package/dist/messages/zh-Hans/index.js +1 -0
- package/dist/on-demand.cjs +1 -0
- package/dist/on-demand.d.cts +56 -0
- package/dist/on-demand.d.ts +56 -0
- package/dist/on-demand.js +1 -0
- package/dist/problem-messages-THONMXFZ.cjs +1 -0
- package/dist/problem-messages-Z5QGO6RE.js +1 -0
- package/dist/react/index.cjs +1 -0
- package/dist/react/index.d.cts +421 -0
- package/dist/react/index.d.ts +421 -0
- package/dist/react/index.js +1 -0
- package/dist/reads-Bk84x_rt.d.ts +38 -0
- package/dist/reads-DlpCt8dE.d.cts +38 -0
- package/dist/recovery-panel-6EBUMANX.js +3 -0
- package/dist/recovery-panel-EQIIV7TT.cjs +3 -0
- package/dist/reply-controls-HUYHUO3W.js +1 -0
- package/dist/reply-controls-LGY2RKRJ.cjs +1 -0
- package/dist/run-XBABOEXK.js +1 -0
- package/dist/schema.json +2900 -0
- package/dist/skin-antd/index.cjs +1 -0
- package/dist/skin-antd/index.d.cts +30 -0
- package/dist/skin-antd/index.d.ts +30 -0
- package/dist/skin-antd/index.js +1 -0
- package/dist/skin-default/index.cjs +1 -0
- package/dist/skin-default/index.d.cts +42 -0
- package/dist/skin-default/index.d.ts +42 -0
- package/dist/skin-default/index.js +1 -0
- package/dist/step-name-BlgVvshf.d.ts +19 -0
- package/dist/step-name-CB3d3kkP.d.cts +19 -0
- package/dist/storage-commit.cjs +1 -0
- package/dist/storage-commit.d.cts +17 -0
- package/dist/storage-commit.d.ts +17 -0
- package/dist/storage-commit.js +1 -0
- package/dist/stream-reads.cjs +1 -0
- package/dist/stream-reads.d.cts +22 -0
- package/dist/stream-reads.d.ts +22 -0
- package/dist/stream-reads.js +1 -0
- package/dist/styles.css +811 -0
- package/dist/testing/index.cjs +1 -0
- package/dist/testing/index.d.cts +57 -0
- package/dist/testing/index.d.ts +57 -0
- package/dist/testing/index.js +1 -0
- package/docs/examples/message-versions.tsx +74 -0
- package/docs/form-fill-protocol.md +83 -0
- package/docs/message-versions.md +64 -0
- package/docs/plan-protocol.md +83 -0
- package/docs/reply-protocol.md +75 -0
- package/etc/hooks.api.md +2394 -0
- package/etc/index.api.md +2159 -0
- package/etc/messages-en.api.md +13 -0
- package/etc/messages-zh-Hans.api.md +13 -0
- package/etc/messages.api.md +186 -0
- package/etc/react.api.md +2977 -0
- package/etc/skin-antd.api.md +2998 -0
- package/etc/skin-default.api.md +61 -0
- package/etc/testing.api.md +3043 -0
- package/package.json +169 -4
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as sn,b as Mn,c as bt,f as N,g as ke,h as an,j as yt}from"./chunk-T5XF2R74.js";import{a as wt}from"./chunk-K73VV7KA.js";var oe={code:"retryable",id:"stream-reads-load"},Ie,Rt,he=()=>Rt??=import("./stream-reads.js").then(i=>Ie=i,()=>{throw Rt=void 0,{...oe}});async function Pt(){await he()}async function or(i,u,l){return(Ie??await he()).handleToolRead(i,u,l)}async function sr(i,u,l){return(Ie??await he()).handlePlanningRead(i,u,l)}var St=(i,u)=>{let l=i.recovery,w=l.versions;return JSON.stringify([u,l.executionId?[1,l.executionId]:[2,l.generation],l.round,l.slots[u],u==="leave"&&[l.decisionKey,w.evidence,w.winner,w.decisionResolution,l.evidenceDigest,l.unknownCount]])};var xe=Object.freeze(["favourites","most-used","recent","presets"]);function dn(i){return typeof i=="string"?i:i.id}var ae=class extends Error{constructor(l,w,o){super("Conversation read failed");this.conversationId=l;this.status=w;this.name="ConversationReadError";let y=o;y&&typeof y.id=="string"&&y.id!==""&&Ct.includes(y.code)&&(this.problem=un(y,y.id))}problem};function br(i=!1){let u=new Map;return{get:l=>i?Promise.resolve(u.get(l)??null):u.get(l)??null,set:(l,w)=>(u.set(l,w),i?Promise.resolve():void 0),remove:l=>(u.delete(l),i?Promise.resolve():void 0),compareAndSet:(l,w,o)=>{let y=(u.get(l)??null)===w;return y&&u.set(l,o),i?Promise.resolve(y):y}}}var Ht=128,Yt=16,ln=1e4,$t=["proposal","initial-review","forward-active","readback","completed","cancelled","left-known","left-unconfirmed","left-reopened"],kt=[250,500,1e3,2e3,4e3],zt=1e4,Gt=4e3,Xt=1e3,It=1e3,Zt=3e4,se=Symbol("budget-exceeded");function cn(i){let u=typeof i=="object"&&i!==null?i.code:void 0;return u==="sign-in"?"sign-in":u==="update-required"?"update-required":"unavailable"}function ht(i){if(typeof i!="object"||i===null)return!1;let u=i;return typeof u.protocol=="string"&&u.protocol.trim()!==""&&Array.isArray(u.capabilities)&&u.capabilities.every(l=>typeof l=="string")&&(u.agreementId===void 0||typeof u.agreementId=="string"&&/^[A-Za-z0-9._~-]{1,128}$/.test(u.agreementId))}function xt(i,u){return bt(Mn.filter(l=>i.capabilities.includes(l)&&u.includes(l)&&(l!=="form-fill"||i.protocol==="1.1")))}function yr(i){let u=new Set;for(let e of i.tabs??xe){let n=dn(e);if(u.has(n)||typeof e!="string"&&xe.includes(n))throw new Error("Invalid flow tab id");u.add(n)}let l=new Set,w=new Set,o={protocol:null,replyState:"none",conversationId:i.conversationId,conversation:null,conversationUnavailable:!1,draft:"",pending:[],problem:null,announcement:0,observerFailures:0,capabilities:[],status:"unsubscribed",plan:null,flows:{},flowTab:dn((i.tabs??xe)[0]??xe[0]),flowTabs:i.tabs??xe,hints:[],sending:!1,withdrawing:[],restored:[],toolSteps:[],streamUnavailable:!1,intentOverlays:{},intentNotice:null,intentAlert:null},y,L,Ce,Me,W=N("client"),m=()=>W.signal.aborted,T=!1,b=N("conversation",W.signal),On=()=>{b.abort(),b=N("conversation",W.signal)},Te=0,de=new Map,Fn=new WeakMap,Ae=(e,n=b.signal)=>{if(e)for(let[r,a]of de)a&&(r.abort(),de.delete(r));let t=N("plan-read",n);return de.set(t,e),t},V=e=>{let n=!e.signal.aborted;return de.delete(e),e.end(),n},En,Un,le=()=>{},ce=-1,We=Promise.resolve(),Nn=!1,G=e=>!!e?.recovery&&!!i.plans?.intent&&o.capabilities.includes("plan-recovery")&&e.recovery.profile==="plan-recovery-v1"&&$t.includes(e.recovery.phase),pn=new Set,ue=new Map,_n=Object.freeze({disabled:"capabilityMissing"}),A=e=>!!e?.recovery&&(!G(e)||pn.has(e.id)),g=e=>{if(m())return;o={...o,...e},L!==void 0&&(i.platform.clock.clearTimeout(L),L=void 0);let n=i.platform.clock.now(),t=o.conversation?.messages.at(-1),r=t?.role==="assistant"&&t.status==="writing";r?(Ce?.id!==t.id||Ce.content!==t.content)&&(Ce={id:t.id,content:t.content,at:n}):Ce=void 0;let a=r?Ce?.at:void 0;if(o={...o,planReadOnly:A(o.plan),replyState:tr({messages:o.conversation?.messages??[],pending:o.pending,now:i.platform.clock.now(),overdueAt:o.conversation?.replyOverdueAt??void 0,unavailable:o.conversation?.replyStatus==="unavailable",failed:o.conversation?.replyStatus==="failed",streamLost:o.streamUnavailable,activityAt:a,heldUntil:Me})},o.replyState==="none"&&(Me=void 0),o.replyState==="writing"&&a!==void 0){let s=Math.max(a+An,Me??0)-n;s>0&&(L=i.platform.clock.setTimeout(()=>{L=void 0,g({})},s))}let d=o.conversation?.messages.at(-1);if(o.replyState==="writing"&&d?.role==="user"){let s=Math.max(d.createdAt+15e3,o.conversation?.replyOverdueAt??0,Me??0)-i.platform.clock.now();s>0&&(L=i.platform.clock.setTimeout(()=>{L=void 0,g({})},s))}for(let s of l)s()},j=e=>{for(let n of w)try{n(Object.freeze({...e}))}catch{g({observerFailures:o.observerFailures+1})}},f=e=>{g({problem:e,announcement:o.announcement+1}),j({type:"problem",problemId:e.id})},Ve=e=>JSON.stringify(["waypoint",i.accountId,e]),fn={revision:0,draft:"",draftRevision:0,draftWriter:"",pending:[],restored:[]},Mt=Math.random().toString(36).slice(2),qn=e=>`${e.draftRevision}:${e.draftWriter}`,Dn=e=>e!==null&&e.code!=="in-doubt",Tt=e=>e.open.length===0&&Dn(e.failure),At=(e,n)=>({...e,draft:n,draftRevision:e.draftRevision+1,draftWriter:Mt}),Je=(e,n)=>{if(n.kind==="draft")return!m()||qn(e)===n.seen?At(e,n.value):e;if(n.kind==="add")return e.pending.some(d=>d.id===n.row.id)?e:{...e,pending:[...e.pending,n.row]};if(n.kind==="discard")return{...e,restored:e.restored.filter(d=>d.id!==n.id)};let t=e.pending.find(d=>d.id===n.id);if(!t)return e;let r=e.pending.filter(d=>d!==t);if(n.kind==="withdraw")return Tt(t)?{...e,pending:r,restored:[...e.restored,{id:n.restoredId,content:t.content}]}:e;if(n.kind==="remove")return{...e,pending:r};let a=n.kind==="claim"?{...t,open:[...t.open,n.attempt],failure:null}:{...t,open:Dn(n.failure)?t.open.filter(d=>d!==n.attempt):t.open,failure:n.failure};return{...e,pending:e.pending.map(d=>d===t?a:d)}},Kn=e=>({revision:wt(e),draft:typeof e?.draft=="string"?e.draft:"",draftRevision:typeof e?.draftRevision=="number"?e.draftRevision:0,draftWriter:typeof e?.draftWriter=="string"?e.draftWriter:"",pending:(Array.isArray(e?.pending)?e.pending:[]).filter(Qt).map(n=>{let t=n.open;return{...n,open:Array.isArray(t)?t.filter(r=>typeof r=="string"):[]}}),restored:(Array.isArray(e?.restored)?e.restored:[]).filter(n=>typeof n?.id=="string"&&typeof n.content=="string")}),S=fn,je=Ve(i.conversationId),I=[],Oe=[],Bn=new WeakSet,pe=new Set,H=fn,fe=()=>{H=I.reduce(Je,S);let e=H.pending.filter(n=>o.conversation?.messages.some(t=>t.clientMessageId===n.id));if(e.length){for(let n of e)I.push({kind:"remove",id:n.id});H=I.reduce(Je,S),F()}g({draft:H.draft,restored:H.restored,pending:H.pending.map(n=>({id:n.id,content:n.content,failure:n.open.some(t=>pe.has(t))?null:n.open.length===0&&n.failure?n.failure:{code:"in-doubt",id:n.id},...n.extensions?{extensions:n.extensions}:{}}))})},_=e=>{I.push(e),fe()},ge=e=>H.pending.find(n=>n.id===e),gn=()=>({seen:qn(H)}),F=()=>{if(m())return We;let e=i.storage,n=je;return We=We.then(async()=>{let t=[...I,...Oe];Oe=[];let r=S,a;try{e?a=await(await import("./storage-commit.js")).commitRecord(e,n,d=>{let s=Kn(d);return s.revision<S.revision&&(s=S),r=t.reduce(Je,s),r===s&&s!==S?null:{...r}}):(r=t.reduce(Je,S),r!==S&&(r={...r,revision:S.revision+1}))}catch{f({code:"unavailable",id:"storage-write"});return}if(n===je){S={...r,revision:a??r.revision};for(let d of t)Bn.add(d);I=I.filter(d=>!t.includes(d)),m()||fe()}}),We},Ln=async(e,n)=>{try{let t=await i.storage?.get(Ve(e));if(!t||n.aborted||Ve(e)!==je)return;let r=Kn(JSON.parse(t));if(r.revision<S.revision)return;S=r,fe()}catch{f({code:"unavailable",id:"storage-read"})}},me,q=[],Y=new Set,Fe=!1,Wn,Ot=new Promise(e=>{Wn=e}),D=()=>me==="form-fill",ve=()=>me!=="ordinary",Vn=e=>["tool.call","planning-read","plan.draft","plan.final","plan.step"].includes(e.type),Jn=async(e,n)=>{try{await we(e,n)}catch{!m()&&!n.aborted&&f({code:"unavailable",id:"frame-dispatch"})}},Ft=()=>{let e=q;q=[],Y.clear();for(let{frame:n,origin:t}of e)t.aborted||(ce=Math.max(ce,n.sequence),D()?we(n,t):Jn(n,t))},h,be=new Map,mn=(e,n)=>o.conversation&&g({conversation:{...o.conversation,messages:o.conversation.messages.map(t=>t.id===e?{...t,...n(t)}:t)}}),vn=(e,n)=>mn(e,()=>({status:n})),bn=(e,n,t)=>be.set(e,{binding:P,status:n,at:Te,read:t}),jn=e=>{for(let n of be.values())n.binding===e&&n.status==="writing"&&(n.reopen=Te)},Hn=e=>{for(let[n,t]of be)t.binding===e&&(be.delete(n),vn(n,t.read))},X=new Map,Z=new Map,He=e=>Z.has(e.id)?Z.get(e.id):e.versionIndex??1,Yn=e=>{let n=X.get(e),t=o.conversation?.messages.find(a=>a.id===e),r=t&&He(t);return n&&(n.version===void 0||r===void 0||r<=n.version)?n:void 0},Et=e=>{let n=Z.get(e.id);Z.has(e.id)&&(n===void 0?e.status==="writing":(e.versionIndex??1)>=n)&&Z.delete(e.id);let t=X.get(e.id);return t&&e.status==="writing"&&(t.version===void 0||(e.versionIndex??1)<=t.version)?{...e,status:"stopped",content:t.content}:e},Ut=(e,n)=>({...e,messages:Nt(e,n).map(Et)}),Nt=(e,n)=>{let t=o.conversation?.messages??[];return e.messages.map(r=>{let a=be.get(r.id);return!a||a.binding!==P||(a.reopen!==void 0&&n>a.reopen&&(a.reopen=void 0,r.status||(a.status=void 0)),!a.status)?r:n<=a.at?t.find(d=>d.id===r.id)??r:(a.read=r.status,r.status&&r.status!=="writing"&&(a.status=r.status,a.at=n),{...r,status:a.status})})},ye=[],Ee=new WeakMap,_t=0,$n=(e=!1)=>{let n=ye;ye=[];for(let t of n)we(t.frame,t.scope,e)},zn=async(e,n)=>{if(Fe)return{kind:"unavailable",conversationId:o.conversationId};let t=++Te,r=b.signal,a=o.conversationId,d=k;try{let s=await i.transport.read(a,Ke());if(r.aborted||e?.aborted||m())return{kind:"superseded",conversationId:a};if(t!==Te&&(me!==void 0||h?.scope===r&&h.token>t&&h.result.kind==="missing"))return{kind:"superseded",conversationId:a};for(let p of s.messages)p.clientMessageId&&ge(p.clientMessageId)&&I.push({kind:"remove",id:p.clientMessageId});let c={kind:"loaded",conversationId:a,conversation:s};h={scope:r,token:t,result:c},en(d),me=s.mode==="form-fill"?"form-fill":"ordinary";try{g({conversation:Ut(s,t),conversationUnavailable:!1,...["conversation-read","conversation-unavailable"].includes(o.problem?.id??"")?{problem:null}:{}}),fe()}finally{Ft()}if(s.mode==="form-fill")for(let p of s.messages)for(let v of p.blocks)v.type==="form.fill"&&i.formSession?.receive(v.body);return await F(),c}catch(s){if(m()||r.aborted)return{kind:"superseded",conversationId:a};if(t!==Te)return{kind:"superseded",conversationId:a};if(n?.(s instanceof ae&&s.status===401?"sign-in":s instanceof ae?cn(s.problem):cn(s)),Be(s)){let c=d!==void 0&&d===k;return Le(d),c||f(Tn(s,"conversation-read")),{kind:"unavailable",conversationId:a}}if(s instanceof ae&&s.conversationId===a&&(s.status===404||s.status===410)){let c={kind:"missing",conversationId:a,status:s.status};return h={scope:r,token:t,result:c},g({conversation:null,conversationUnavailable:!0}),f({code:"unavailable",id:"conversation-read"}),c}return f(Tn(s,"conversation-read")),{kind:"unavailable",conversationId:a}}},Ue,Ne,E=async e=>{$n();let n=b.signal,t=o.conversationId,r=h,a,d={scope:n,id:t,result:new Promise(p=>{a=p})};Ne=d;let s=zn(e);Ue={scope:n,done:s},s.then(a).finally(()=>{Ue?.done===s&&(Ue=void 0)});let c=d;for(;;){let p=await c.result;if(m()||n.aborted||t!==o.conversationId)return{kind:"superseded",conversationId:t};if(Ne===c)return p.kind==="unavailable"&&h!==r&&h?.scope===n&&h.result.conversationId===t?h.result:p;if(Ne?.scope!==n||Ne.id!==t)return{kind:"superseded",conversationId:t};c=Ne}},_e=!1,yn=!1,wn=[],we=(e,n,t=!1)=>{if(m()||n.aborted)return;let r=wn.length;if(!t&&(r||!_e&&i.reads&&!D()&&(e.type==="tool.call"||e.type==="planning-read"))){if(wn.push({frame:e,scope:n}),r)return;let a=d=>{_e=d!==!1,_e||(yn=!0),_e&&o.problem?.id===oe.id&&g({problem:null});for(let s of wn.splice(0))we(s.frame,s.scope,!_e)};Pt().then(a,()=>a(!1));return}qt(e,n,t)},qt=(e,n,t)=>{if(m()||n.aborted)return;if(D()&&Vn(e)){f({code:"refused",id:"form-tools"});return}if(e.type==="block"&&e.block.type==="form.fill"&&D()&&i.formSession?.receive(e.block.body),e.type==="tool.call"||e.type==="planning-read"){Ee.has(e)||$n(t);let d=o.conversationId,s=e.type==="tool.call"?e.call:void 0,c=v=>{if(!s||!p())return;let R={id:s.id,...s.label&&{label:s.label},status:v},B=o.toolSteps.findIndex(Cn=>Cn.id===s.id);g({toolSteps:B<0?[...o.toolSteps,R]:o.toolSteps.map((Cn,jt)=>jt===B?R:Cn)})},p=()=>!m()&&!n.aborted&&d===o.conversationId;return c("running"),(async()=>{if(t)throw{...oe};let v=i.reads;if(!v)return f({code:"invalid-read",id:"read-unavailable"});let R=await(Ie??await he()).answerRead(e,v,d,p,f,B=>kn(n,B));c(R===!1?"failed":"done")})().catch(v=>{if(c("failed"),!!p()){if(v?.id!==oe.id)return f({code:"invalid-read",id:"read-failed"});if(Ee.has(e)||Ee.set(e,_t++),ye.push({frame:e,scope:P?.scope.signal??n}),ye.sort((R,B)=>Ee.get(R.frame)-Ee.get(B.frame)),ye.length>Yt&&ye.shift(),t){if(!yn)return;yn=!1}f({...oe})}})}if((e.type==="plan.draft"||e.type==="plan.final")&&i.plans)return gt(e.plan.id,n);if(e.type==="problem"){f(e.problem);return}let r="messageId"in e?be.get(e.messageId):void 0,a="messageId"in e&&o.conversation?.messages.find(d=>d.id===e.messageId);if(e.type==="message.start"&&e.role==="assistant"&&o.conversation&&(o.conversation.replyStatus==="failed"||o.conversation.replyStatus==="unavailable")&&g({conversation:{...o.conversation,replyStatus:void 0}}),!(e.type==="text.delta"&&Yn(e.messageId))){if(e.type==="text.delta"){let d=r&&r.binding===P&&!r.status;d&&bn(e.messageId,"writing",r.read),mn(e.messageId,s=>({content:s.content+e.text,...d&&{status:"writing"}}))}if(e.type==="message.start"&&e.role==="assistant"&&(!a||a.role==="assistant")){let d=a?a.status==="writing"?He(a):i.versions?Math.max(a.versionCount??1,Z.get(e.messageId)??0)+1:void 0:1;Z.set(e.messageId,d);let s=X.get(e.messageId);s&&(s.version===void 0||d===void 0||d>s.version)&&X.delete(e.messageId),bn(e.messageId,"writing",r?.read),mn(e.messageId,()=>({status:"writing",content:"",blocks:[]}))}e.type==="message.end"&&a&&["completed","failed","unavailable","stopped"].includes(e.status)&&!(Yn(e.messageId)&&e.status!=="stopped")&&(r?r.binding===P:!a.status||a.status==="writing")&&(bn(e.messageId,e.status,r?.read??a.status),vn(e.messageId,e.status)),e.type==="message.start"&&o.conversation&&!a&&g({conversation:{...o.conversation,messages:[...o.conversation.messages,{id:e.messageId,role:e.role,content:"",blocks:[],createdAt:i.platform.clock.now(),...e.role==="assistant"&&{status:"writing"}}]}}),(e.type==="stale"||e.type==="message.end")&&E(n)}},qe=e=>{le(),q=q.filter(s=>!s.origin.aborted),Y.clear();for(let s of q)Y.add(s.frame.sequence);ce=-1;let n=e??Dt();e&&jn(e);let t=N("connection",n.scope.signal),r=()=>{};ke(t.signal,()=>r()),le=()=>t.abort();let a=k,d=!1;r=i.transport.subscribe(o.conversationId,s=>{if(t.signal.aborted)return;if(s.type==="invalidate")return Zn();if(s.type==="status"){let p=s.status==="reconnecting"||s.status==="unavailable";if(p&&jn(n),a!==void 0&&p)return t.abort(),g({status:"reconnecting"}),j({type:"transport.status",conversationId:o.conversationId}),Xn(n);if((s.status==="open"||s.status==="reconnecting")&&(ce=-1,E(t.signal)),a!==void 0&&s.status==="open"&&!d){d=!0,o.problem?.id==="stream"&&g({problem:null});let v=i.platform.clock.setTimeout(()=>{t.signal.aborted||(n.failures=0)},zt);ke(t.signal,()=>i.platform.clock.clearTimeout(v))}g({status:s.status}),j({type:"transport.status",conversationId:o.conversationId});return}let c=s.frame;if(!(c.sequence<=ce)){if(ce=c.sequence,c.protocol!==o.protocol){f({code:"update-required",id:"stream-version"});return}Vn(c)?me===void 0?Y.has(c.sequence)||(Y.add(c.sequence),q.push({frame:c,origin:t.signal}),q.length>=Ht&&(Fe=!0,g({conversationUnavailable:!0}),Wn(),On(),le(),q=[],Y.clear(),f({code:"unavailable",id:"conversation-unavailable"}))):D()?we(c,t.signal):Jn(c,t.signal):we(c,t.signal)}},Ke()),t.signal.aborted&&r()},P,Dt=()=>(P?.scope.abort(),Hn(P),P={scope:N("stream",b.signal),failures:0,gaveUp:!1,createdBy:K},o.streamUnavailable&&g({streamUnavailable:!1}),P),Gn=(e,n,t)=>new Promise(r=>{let a=i.platform.clock.setTimeout(r,e);t?.(r),ke(n,()=>{i.platform.clock.clearTimeout(a),r()})}),Xn=e=>{if(e!==P||e.scope.signal.aborted||e.gaveUp||e.episode&&!e.episode.signal.aborted)return;let n=N("recovery",e.scope.signal);e.episode=n;let t=n.signal,r=(a,d)=>{e.gaveUp=d,d&&Hn(e),g({status:"unavailable",streamUnavailable:d}),f({code:a,id:"stream"})};(async()=>{for(;;){if(e.failures>=kt.length)return r("unavailable",!0);await Gn(kt[e.failures],t);let a=!1;for(;!t.aborted&&!i.platform.online();)a=!0,await Gn(Gt,t,p=>{e.online=p});if(e.online=void 0,a&&(e.failures=0),t.aborted)return;e.failures++;let d=k,s="unavailable",c=await zn(t,p=>{s=p});if(await e.settling,t.aborted||e!==P||d!==k||K!==void 0&&K!==e.createdBy||re)return;if(c.kind==="loaded")return e.episode=void 0,qe(e);if(c.kind==="missing")return;if(s!=="unavailable")return r(s,!1)}})().finally(()=>{e.episode===n&&(e.episode=void 0),n.end()})},Kt=()=>{let e=P;!e||e.scope.signal.aborted||(e.failures=0,e.online?.(),e.gaveUp&&(e.gaveUp=!1,g({streamUnavailable:!1}),Xn(e)))},Ye,Zn=()=>{let e=b.signal,n=Ue?.scope===e?Ue.done:void 0;if(!n)return void E();Ye!==e&&(Ye=e,n.finally(()=>{Ye===e&&(Ye=void 0,e.aborted||Zn())}))},Qn=async e=>{let n=b.signal,t=o.conversationId,r=k;if(!ge(e))return;g({sending:!0});let d=Math.random().toString(36).slice(2);pe.add(d);let s={kind:"claim",id:e,attempt:d};_(s),await F();let c=I.includes(s)?void 0:S.pending.find(v=>v.id===e),p=v=>(_({kind:"finish",id:e,attempt:d,failure:v}),F());I.includes(s)&&(I=I.filter(v=>v!==s),_({kind:"finish",id:e,attempt:d,failure:{code:"unavailable",id:e}}));try{if(m()||n.aborted||!c?.open.includes(d))return;if(o.conversationUnavailable){await p({code:"unavailable",id:e});return}if(await i.transport.send({kind:"message",protocol:o.protocol,clientReplyId:e,clientMessageId:e,content:c.content,...c.extensions?{extensions:c.extensions}:{}},t,Ke(r)),n.aborted)return;en(r),pe.delete(d),g({problem:null}),_({kind:"remove",id:e}),await F(),await E()}catch(v){if(n.aborted)return;let R=un(v,e);pe.delete(d),f(R),await p(R),R.code==="agreement-expired"&&Le(r)}finally{pe.delete(d)&&fe(),n.aborted||g({sending:!1})}},U=new Map,O=e=>JSON.stringify([o.conversationId,e]),et=e=>{let n=U.get(O(e.id)),t=e.recovery;return t?typeof t.generation!="string"||!Number.isSafeInteger(t.revision)||t.revision<0||t.conversationId!==o.conversationId||n&&n.generation!==t.generation?"error":!n||t.revision>n.revision?"adopt":t.revision<n.revision||JSON.stringify(e)===n.bytes?"ignore":"error":n?"error":"adopt"},Bt=e=>{G(e)&&Rn(),e.recovery&&U.set(O(e.id),{generation:e.recovery.generation,revision:e.recovery.revision,bytes:JSON.stringify(e),record:JSON.parse(JSON.stringify(e))})},Re=e=>U.get(O(e))?.record,x,Pe=new Map,nt=e=>"lkcs".indexOf(e[0]),tt=e=>(x?.pending(e)||Pe.has(e))&&(Q(),!0),Q=()=>f({code:"refused",id:"intentPending"}),rt=!1,it,Rn=()=>it??=import("./intent.js").then(e=>{x??=e.createIntentMachine({config:i,publish:g,client:M,scope:()=>b.signal,report:f,read(n){let t=Ae(!0);return[t,Qe(n,t.signal),()=>V(t)]}})},()=>{it=void 0}).finally(()=>{rt=!x,g({})}),$e=(e,n,t="user",r=!1)=>{if(A(Re(e.id)))return Q();let a=b.signal,d=e.id,s=St(e,n),c=!x&&Pe.get(d);if(c){if(c.key===s)return c.settled;if(nt(n)<=nt(c.kind))return Q()}let p=B=>x.submit(e,n,t,r,B);if(x)return p();let v=i.platform.clock.now(),R={kind:n,key:s,settled:Se(Rn(),1e4,a).then(()=>{if(Pe.get(d)===R&&Pe.delete(d),!a.aborted&&!m())return x?p(v):f({code:"retryable",id:"intent-load"})})};return Pe.set(d,R),R.settled},ze=(e=o.plan?.id)=>e&&(A(Re(e))?Promise.resolve(Q()):Pe.get(e)?.settled??x?.status(e))||Promise.resolve(),ot=()=>{let e=b.signal;return i.plans?yt({...i.plans,signal:e,read:n=>{let t=Ae(!1);return Qe(n,e).then(r=>{V(t);let a=et(r);if(a==="error")throw f({code:"invalid-plan",id:r.id}),new an;let d=a==="ignore"?U.get(O(r.id))?.record??r:r;if(A(d))throw new an;let s=JSON.parse(JSON.stringify(d));return Fn.set(s,t.signal),s},r=>{throw V(t),r})},clock:i.platform.clock,interrupted:async(n,t)=>{let r=U.get(O(n))?.record;r&&G(r)&&await $e(r,"stop",t,!0)},onRecord:n=>{e.aborted||Fn.get(n)?.aborted||dt(n)&&i.plans?.onRecord?.(n)}}):void 0},ee=ot(),Ge=new Set,De=new Map,ne=Promise.resolve(),te=new Map,Pn=e=>JSON.stringify([o.conversationId,e]),Sn=e=>{let n=st(e);return Ge.add(e),ee?.stop(e),n},st=e=>{let n=!1;for(let[t,r]of te)r.planId===e&&(n||=!!r.active,te.delete(t));return De.delete(Pn(e)),n},at,C=e=>(at??=import("./on-demand.js").then(n=>n.createOnDemand({ready:z,config:i,client:M,state:()=>o,live:()=>T&&!m(),disposed:m,restricted:ve,formMode:D,report:f,emit:j,refresh:E,stopped:t=>Ge.has(t),versionAsking:t=>{let r=o.conversation?.messages.find(d=>d.id===t),a=r&&He(r);return()=>{let d=X.get(t);d&&(d.version===void 0||a===void 0||d.version<=a)&&X.delete(t)}},refusedPending:tt,readOnly:t=>A(Re(t)),confirmedDigest:t=>De.get(Pn(t)),finishPlanRead:V,showPlan:gt,switchTo:ft,update:g,tabSelected:()=>Nn,sendReply:kn,confirmed:(t,r)=>De.set(Pn(t),r),run:(t,r,a,d)=>d?ee?.run(r,a,d).catch(s=>{!t.aborted&&!(s instanceof an)&&f({code:"unavailable",id:r})}):M.runPlan(r,a)}),n=>{throw at=void 0,n})).then(e,()=>f({code:"retryable",id:"on-demand-load"})),dt=e=>{if(ve())return!1;let n=et(e);if(n==="error")return f({code:"invalid-plan",id:e.id}),!1;let t=(n==="adopt"||e.recovery?.revision===U.get(O(e.id))?.revision)&&pn.delete(e.id);if(n==="ignore")return t&&g({}),!1;if(Bt(e),A(e)){let r=O(e.id);ue.set(r,(ue.get(r)??0)+1)}["completed","undone","cancelled","submitted"].includes(e.state)&&st(e.id);for(let r of de.keys())r.abort();return de.clear(),g({plan:JSON.parse(JSON.stringify(e))}),j({type:"plan.state",planId:e.id}),!0},M={get ready(){return z},getSnapshot:()=>o,subscribe:e=>(l.add(e),()=>{l.delete(e)}),on:e=>(w.add(e),()=>{w.delete(e)}),editMessage:(e,n)=>{let t=b.signal;return C(r=>r.version(t,"edit",e,n))},regenerate:e=>{let n=b.signal;return C(t=>t.version(n,"regenerate",e))},selectVersion:(e,n)=>{let t=b.signal;return C(r=>r.version(t,"select",e,void 0,n))},canChangeVersions:()=>!!i.versions,canSendFeedback:()=>!!i.feedback,sendFeedback:(e,n)=>{let t=b.signal;return C(r=>r.feedback(t,e,n)).then(r=>r===!0)},async setDraft(e){_({kind:"draft",value:e,...gn()}),await z,await F()},async send(){if(await z,!T||m()||o.conversationUnavailable||o.sending||!o.draft.trim())return;let e=b.signal,n=o.draft;if(D()){if(!i.formSession){f({code:"refused",id:"form-session"});return}g({sending:!0});try{let t={text:n,field:o.conversation?.field},r=JSON.stringify([o.conversationId,t,i.formSession.getSnapshot().fields]);y?.key!==r&&(y={key:r,request:i.formSession.begin(t)});let a=y.request;await M.reply({kind:"form-fill",clientReplyId:a.requestId,request:a})&&(e.aborted||(y=void 0,o.draft===n&&g({draft:""})))}finally{e.aborted||g({sending:!1})}return}g({sending:!0,toolSteps:[]});try{let t={},r=[],a=!1;for(let p of i.contributions??[]){let v=await p.evaluate({draft:n,conversationId:o.conversationId});v.hold&&(a=!0),v.hint&&r.push(v.hint),v.payload!==void 0&&(t[p.id]=v.payload)}if(g({hints:r}),a||e.aborted||o.conversationUnavailable)return;let d=i.platform.ids(),s={kind:"message",protocol:o.protocol,clientReplyId:d,clientMessageId:d,content:n},c=await i.beforeSend?.(s);if(c===!1||e.aborted||o.conversationUnavailable)return;if(c&&(s=c),s.kind!=="message"||s.clientReplyId!==d||s.clientMessageId!==d)throw new Error("Invalid middleware reply");_({kind:"add",row:{id:d,content:s.content,failure:null,extensions:t,open:[]}}),_({kind:"draft",value:o.draft===n?"":o.draft,...gn()}),j({type:"send",conversationId:o.conversationId,replyId:d}),await Qn(d)}catch{f({code:"refused",id:"before-send"})}finally{e.aborted||g({sending:!1})}},async retry(e){await z,!D()&&(!T||m()||o.conversationUnavailable||o.sending||ge(e)&&(j({type:"send",conversationId:o.conversationId,replyId:e}),await Qn(e)))},async withdraw(e){if(!ge(e)||o.withdrawing.includes(e))return;let n={kind:"withdraw",id:e,restoredId:i.platform.ids()};Oe.push(n),g({withdrawing:[...o.withdrawing,e]}),await F(),Oe=Oe.filter(t=>t!==n),g({withdrawing:o.withdrawing.filter(t=>t!==e)}),Bn.has(n)&&ge(e)&&f({code:"refused",id:"sending"})},async editRestored(e){let n=o.restored.find(t=>t.id===e);n&&(_({kind:"draft",value:[o.draft,n.content].filter(Boolean).join(`
|
|
2
|
+
|
|
3
|
+
`),...gn()}),await F())},async discardRestored(e){_({kind:"discard",id:e}),await F()},async dismiss(e){o.sending||(ge(e)&&_({kind:"remove",id:e}),await F())},reply:e=>kn(void 0,e),replyOutcome:e=>ut(void 0,e),refresh:()=>(P?.gaveUp&&T&&!m()&&qe(),T&&re&&!m()?Vt():!T&&!m()?on().then(e=>e??{kind:"unavailable",conversationId:o.conversationId}):o.conversationUnavailable&&Fe?M.switchConversation(o.conversationId):E()),switchConversation:e=>ft(e),report:f,confirmPlan(){let e=b.signal,n=o.plan;if(D()||m()||!n)return ne;if(A(n))return f({code:"refused",id:n.id}),ne;if(Ge.has(n.id))return f({code:"stopped",id:n.id}),ne;let t=er(n,o.conversationId)?.token;if(tt(n.id)||!t)return ne;let r=n.plan.digest,a=`${n.id}:${t}`,d=te.get(a);if(d?.active)return d.active;if(n.state!=="awaiting-confirmation")return ne;let s=d??{id:i.platform.ids(),planId:n.id};te.set(a,s);let c=O(n.id),p=ue.get(c),v=()=>A(Re(n.id))||p!==ue.get(c);return s.active=C(R=>R.confirm({scope:e,planId:n.id,token:t,digest:r,replyId:s.id,current:()=>te.get(a)===s,stale:v,refused:B=>G(n)&&!B||v()})).finally(()=>{delete s.active}),s.active},async runPlan(e,n){if(ve()||(await z,ve())||m())return;if(Ge.has(e)){f({code:"stopped",id:e});return}if(!T)return;if(U.has(O(e))||o.plan?.id===e&&o.plan.recovery){f({code:"refused",id:e});return}let t=b.signal;if(e)try{await ee?.run(e,n)}catch(r){!t.aborted&&!Be(r)&&f({code:"invalid-plan",id:e})}},stopPlan(e=o.plan?.id){if(e&&A(Re(e)))f({code:"refused",id:e});else if(e){let n=Sn(e),t=U.get(O(e))?.record;G(t)&&$e(t,"stop","user",n)}},async declinePlan(){let e=o.plan;if(e){if(A(e))return Q();if(!G(e)){f({code:"unavailable",id:"plan-decline"});return}Sn(e.id),await $e(e,"cancel-initial")}},checkIntentStatus:ze,checkSavedChoice:ze,checkKeepStatus:ze,retryIntent:ze,keepChangesReview(e=o.plan?.id){return e&&A(Re(e))?_n:x?x.keepReview(e?U.get(O(e))?.record:void 0):(Rn(),{disabled:rt?"intentUnavailable":"loading"})},canKeepChanges(e){return!("disabled"in M.keepChangesReview(e))},keepChanges:e=>e===_n?Promise.resolve(Q()):x?.keepChanges(e)??Promise.resolve(f({code:"unavailable",id:"plan-keep"})),async leavePlan(e=o.plan?.id){let n=e?U.get(O(e))?.record:void 0;if(A(n))return Q();let t=n?.recovery?.phase;if(!G(n)||!o.capabilities.includes("plan-leave")||!["readback","left-reopened","forward-active"].includes(t)){f({code:"unavailable",id:"plan-leave"});return}t==="forward-active"&&Sn(n.id),await $e(n,"leave")},resumePlan(){let e=b.signal;return C(n=>n.resumePlan(e))},retryUndo(){let e=b.signal,n=o.plan?.id,t=Ae(!1);return C(r=>r.retryUndo(e,t,n)).finally(()=>V(t))},readPlan(e=o.plan?.id){let n=b.signal;return C(t=>t.readPlan(n,e))},setPlan(e){dt(e)},loadFlows(){if(!i.flowSource)return ne;En?.abort();let e=En=N("flow-load",W.signal);return C(n=>n.loadFlows(e))},selectFlowTab(e){let n=dn(e);(i.tabs??xe).some(t=>dn(t)===n)&&(Nn=!0,g({flowTab:n}))},setFavourite:(e,n)=>C(t=>t.setFavourite(e,n)),canPrepareFlow:()=>!!i.flowSource?.load,keepWaiting(){Me=i.platform.clock.now()+An,g({})},retryReply(){let e=o.conversation?.messages.at(-1),n=lt();if(n||o.replyState==="failed"&&e?.role==="assistant"){if(i.versions)return M.regenerate((n??e).id);if(n)return Promise.resolve()}return M.keepWaiting(),M.refresh().then(()=>{})},canRetryReply:()=>!lt()||!!i.versions,canStopReply:()=>!!ct()&&o.capabilities.includes("reply-stop"),stopReply(){let e=ct();if(!e||!M.canStopReply())return Promise.resolve();let n=i.platform.ids(),t=He(e);return X.set(e.id,{replyId:n,content:e.content,version:t}),vn(e.id,"stopped"),C(r=>r.stopReply(e.id,n,t))},prepareFlow(e){let n=b.signal;return C(t=>t.prepareFlow(n,e))},runFlow(e,n){if(ve())return ne;Un?.abort();let t=Un=N("flow-run",W.signal),r=b.signal;return C(a=>a.runFlow(t,r,e,n))},dispose(){q=[],Y.clear(),Fe=!1,y=void 0,i.formSession?.dispose(),te.clear(),De.clear(),ee?.dispose(),L!==void 0&&i.platform.clock.clearTimeout(L),W.abort(),le(),l.clear(),w.clear()}},lt=()=>{let e=o.conversation?.messages.at(-1);return e?.role==="assistant"&&(e.status==="failed"||e.status==="unavailable")&&o.replyState===e.status?e:void 0},ct=()=>{let e=o.conversation?.messages.at(-1);return e?.role==="assistant"&&e.status==="writing"?e:void 0},kn=async(e,n,t)=>(await ut(e,n,t)).accepted,ut=async(e,n,t)=>{let r={accepted:!1},a=o.conversationId,d=b.signal,s=()=>!m()&&!d.aborted&&!e?.aborted&&a===o.conversationId;if(await z,!T||o.conversationUnavailable||!s()||ve()&&n.kind!=="form-fill"||n.kind==="form-fill"&&(!D()||o.protocol!=="1.1"||!o.capabilities.includes("form-fill")))return r;j({type:"reply",conversationId:a,replyId:n.clientReplyId});let c=k;try{let p=await i.transport.send({...n,protocol:o.protocol},a,Ke(c));return s()&&t?.(p),s()&&en(c),s()&&await pt(E(e)),{accepted:!0}}catch(p){let v=un(p,n.clientReplyId);return s()&&f(v),s()&&Be(p)?Le(c):s()&&await pt(E(e)),{accepted:!1,problem:v}}},pt=async e=>{await Se(e,ln)===se&&(m()||f({code:"unavailable",id:"conversation-read"}))},ft=async(e,n=[])=>{if(await z,await F(),n.some(a=>a.aborted)||m())return{kind:"superseded",conversationId:e};let t=e===o.conversationId;le(),On(),me=void 0,q=[],Y.clear(),Fe=!1,y=void 0,i.formSession?.cancel(),te.clear(),De.clear(),ee?.dispose(),ee=ot(),pe.clear(),t||(je=Ve(e),S=fn,I=[]),g({conversationId:e,conversation:null,status:"unsubscribed",...t?{}:{conversationUnavailable:!1},plan:null,problem:null,sending:!1,streamUnavailable:!1,toolSteps:[]}),fe();let r=b.signal;return t||await Ln(e,r),m()||r.aborted?{kind:"superseded",conversationId:e}:T?(qe(),E()):{kind:"unavailable",conversationId:e}},Xe={capabilities:Mn.filter(e=>e!=="plan-recovery"&&e!=="plan-leave"&&e!=="plan-keep"||!!i.plans?.intent)},k,K,Ze=!1,re=!1,Ke=(e=k)=>e===void 0?void 0:{agreementId:e},gt=(e,n)=>{let t=Ae(!0,n);return Qe(e,n).then(r=>{V(t)&&M.setPlan(r)},r=>{V(t)&&!Be(r)&&f(Tn(r,"plan-read"))})},Qe=async(e,n)=>{let t=k;try{let r=await i.plans.read(e,Ke(t));return n.aborted||en(t),r}catch(r){throw!n.aborted&&Be(r)&&Le(t),r}},Be=e=>(e instanceof ae?e.problem?.code:typeof e=="object"&&e!==null?e.code:void 0)==="agreement-expired",en=e=>{x?.authenticated(),!(re||e===void 0||e!==k)&&(Ze=!1,o.problem?.id==="agreement"&&g({problem:null}))},nn=e=>{re=!0,f({code:e,id:"agreement"})},Lt=async()=>{let e=N("binding",W.signal);try{return await Wt(e.signal)}finally{e.end()}},Wt=async e=>{le();let n;try{let c=await Se(i.transport.negotiate(sn,Xe),ln);if(c===se)throw new Error("negotiation budget");n=c}catch(c){e.aborted||nn(cn(c));return}if(e.aborted)return;if(!ht(n)||n.agreementId===void 0){nn("unavailable");return}if(n.protocol!==o.protocol){nn("update-required");return}k=n.agreementId,Ze=!0;let t=o.capabilities.includes("plan-recovery"),r=xt(n,Xe.capabilities);if(t!==r.includes("plan-recovery"))for(let[c,{record:p}]of U)p.recovery&&(ue.set(c,(ue.get(c)??0)+1),t||pn.add(p.id));if(g({capabilities:r}),x?.authenticated(),e.aborted||(qe(),e.aborted))return;let a=E();P&&(P.settling=a);let d=await a,s=o.plan?.id;if(!e.aborted&&!re&&s&&i.plans){let c=Ae(!0);Qe(s,b.signal).then(p=>{V(c)&&o.plan?.id===p.id&&M.setPlan(p)}).catch(()=>V(c))}return d},Le=e=>{if(m()||e===void 0||e!==k)return;if(ee?.interrupt?.(),Ze){nn("unavailable");return}if(K)return K;let n=Lt().finally(()=>{K===n&&(K=void 0),xn()});return K=n,n},Vt=async()=>(re=!1,Ze=!1,await(K??Le(k))??{kind:"unavailable",conversationId:o.conversationId}),Se=(e,n,t=W.signal)=>new Promise((r,a)=>{if(e.catch(()=>{}),m()){r(se);return}let d=()=>{},s=i.platform.clock.setTimeout(()=>{d(),r(se)},n),c=()=>{i.platform.clock.clearTimeout(s),d()};d=ke(t,()=>{i.platform.clock.clearTimeout(s),r(se)}),e.then(p=>{c(),r(p)},p=>{c(),a(p)})}),$=null,In=!1,ie,J,tn=It,hn=[],mt=Se(Ln(o.conversationId,b.signal),Xt).catch(()=>{}),rn=()=>!m()&&!re&&!K&&(!T||!In&&h?.scope!==b.signal),xn=()=>{if(m()||J!==void 0||ie||!rn()||$==="update-required"||$==="sign-in")return;let e=tn;tn=Math.min(tn*2,Zt),J=i.platform.clock.setTimeout(()=>{J=void 0,rn()&&(i.platform.online()&&i.platform.visibility()?on():xn())},e)},Jt=async()=>{if(!T){let r;try{let a=await Se(i.transport.negotiate(sn,Xe),ln);if(a===se)throw new Error("negotiation budget");r=a}catch(a){if(m())return;$=cn(a),f({code:$,id:"negotiation"});return}if(m())return;if(!ht(r)){$="unavailable",f({code:"unavailable",id:"negotiation"});return}if(!sn.includes(r.protocol)){$="update-required",f({code:"update-required",id:"negotiation"});return}if(T=!0,$=null,k=r.agreementId,g({protocol:r.protocol,capabilities:xt(r,Xe.capabilities),...o.problem?.id==="negotiation"?{problem:null}:{}}),await mt,m()||(qe(),m()))return}let e=b.signal,n=o.conversationId,t=await Promise.race([Se(E(),ln),Ot.then(()=>{})]);if(!m())return e.aborted?(In=!0,{kind:"superseded",conversationId:n}):t===se?h?.scope===e?h.result:(f({code:"unavailable",id:"conversation-read"}),{kind:"unavailable",conversationId:o.conversationId}):(t||(In=!0),t)},on=()=>{if(ie)return ie;J!==void 0&&(i.platform.clock.clearTimeout(J),J=void 0);let e=Jt().catch(()=>{}).finally(()=>{ie===e&&(ie=void 0),rn()||(tn=It),xn()});return ie=e,e},vt=e=>{!e||!rn()||ie||$!=="update-required"&&(!i.platform.online()||!i.platform.visibility()||on())};for(let[e,n]of[[i.platform.subscribeOnline,t=>{vt(t),t&&Kt()}],[i.platform.subscribeVisibility,vt]])if(e)try{hn.push(e.call(i.platform,n))}catch{}ke(W.signal,()=>{J!==void 0&&i.platform.clock.clearTimeout(J),J=void 0;for(let e of hn)e();hn=[]});let z=Promise.allSettled([on(),mt]).then(()=>{});return M}function Qt(i){return typeof i=="object"&&i!==null&&typeof i.id=="string"&&typeof i.content=="string"}function un(i,u){let l=i,w=l?.code,o=l?.confirmation?.reason,y=l?.retryAfter;return Ct.includes(w)?{code:w,id:u,...w==="refused"&&nr.includes(o)&&{confirmation:{reason:o}},...Number.isInteger(y)&&y>=0&&{retryAfter:y}}:{code:"in-doubt",id:u}}function Tn(i,u){let l=un(i instanceof ae?i.problem:i,u).retryAfter;return l===void 0?{code:"unavailable",id:u}:{code:"rate-limited",id:u,retryAfter:l}}function er(i,u){let l=i?.confirmation;return l&&l.planId===i.id&&l.conversationId===u&&Number.isInteger(l.revision)&&l.revision===(i.recovery??l).revision?l:void 0}var nr=["expired","used","stale","mismatch","missing"],Ct=["update-required","in-doubt","replaced","retryable","refused","closed","full","declined","unavailable","sign-in","rate-limited","step-up-cancelled","mismatch","invalid-read","invalid-plan","needs-attention","stopped","plan-changed","agreement-expired"],An=15e3;function tr(i){let u=i.messages.at(-1);return u?.role==="assistant"&&u.status==="writing"&&!i.pending.some(l=>!l.failure)?i.unavailable||i.streamLost?"unavailable":i.failed?"failed":i.activityAt!==void 0&&i.now>=Math.max(i.activityAt+An,i.heldUntil??0)?"overdue":"writing":u?.role==="assistant"&&(u.status==="failed"||u.status==="unavailable")&&!i.pending.some(l=>!l.failure)?u.status:u?.role!=="user"&&!i.pending.some(l=>!l.failure)?"none":i.pending.some(l=>!l.failure)?"writing":i.unavailable?"unavailable":i.failed?"failed":i.now>=Math.max((u?.createdAt??i.now)+15e3,(i.askedAt??0)+15e3,i.overdueAt??0,i.heldUntil??0)?"overdue":"writing"}function wr(i){let u=i.versionIndex??1,l=i.versionCount??1;return!Number.isInteger(u)||!Number.isInteger(l)||l<2||u<1||u>l?null:{index:u,count:l,previous:u>1?u-1:null,next:u<l?u+1:null}}export{oe as a,Pt as b,or as c,sr as d,xe as e,dn as f,ae as g,br as h,yr as i,un as j,Tn as k,er as l,tr as m,wr as n};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var b=u=>JSON.parse(JSON.stringify(u===void 0?null:u));function F(u){let f=!1,s={pending:!1,fields:Object.create(null)},v=new Set,l,g=Object.create(null);for(let e of u.fields){if(Object.hasOwn(g,e.name))throw new Error("Duplicate field");e.tier==="low"&&(g[e.name]={label:e.label,value:b(e.value),revision:0,edited:!1})}s={fields:g,pending:!1};let a=[],O=e=>Object.keys(e.fields).filter(i=>_optionalChain([s, 'access', _ => _.fields, 'access', _2 => _2[i], 'optionalAccess', _3 => _3.revision])===e.fields[i].revision),c=e=>{s={fields:e,pending:l!==void 0},s={...s,fills:a.map(i=>({id:i.id,fields:O(i)})).filter(i=>i.fields.length)};for(let i of v)i()},m=(e,i)=>c({...s.fields,[e]:i});return{getSnapshot:()=>s,subscribe(e){return v.add(e),()=>{v.delete(e)}},begin(e){if(f)throw new Error("Disposed form");let i=e.field?[e.field]:Object.keys(s.fields);if(!i.length||i.some(t=>!Object.hasOwn(s.fields,t)))throw new Error("Unknown field");let n=u.ids();return l={id:n,revisions:Object.fromEntries(i.map(t=>[t,s.fields[t].revision]))},c({...s.fields}),b({requestId:n,text:e.text,references:_nullishCoalesce(e.references, () => ([])),attachments:_nullishCoalesce(e.attachments, () => ([])),...e.field?{field:e.field}:{},fields:i.map(t=>({name:t,label:s.fields[t].label,tier:"low",value:s.fields[t].value}))})},receive(e){if(!e||typeof e!="object")return!1;let i=e;if(f||!l||i.requestId!==l.id||!i.values||typeof i.values!="object"||Array.isArray(i.values))return!1;let n=Object.keys(l.revisions);if(Object.keys(i.values).length!==n.length||n.some(o=>!Object.hasOwn(i.values,o)))return!1;for(let o of n){let r=i.values[o];if(!r||!Object.hasOwn(r,"value")||r.label!==void 0&&typeof r.label!="string"||!r.validation||!["valid","invalid"].includes(r.validation.status)||!Array.isArray(r.validation.messages)||r.validation.messages.some(p=>typeof p!="string")||r.validation.guidance!==void 0&&typeof r.validation.guidance!="string")return!1}let t={...s.fields},d={id:l.id,fields:{}};for(let o of n){let r=t[o],p=b(i.values[o]);r.edited||r.revision!==l.revisions[o]?t[o]={...r,replacement:{...p,revision:r.revision,fill:l.id}}:(t[o]={...r,...p,revision:r.revision+1,edited:!1,replacement:void 0},d.fields[o]={draft:r,revision:r.revision+1})}return Object.keys(d.fields).length&&(a=[...a,d].slice(-20)),l=void 0,c(t),!0},edit(e,i){if(!Object.hasOwn(s.fields,e))return;let n=s.fields[e];f||!n||m(e,{...n,value:b(i),revision:n.revision+1,edited:!0,validation:void 0,replacement:void 0,localInvalid:void 0,localText:void 0})},markEdited(e,i){if(!Object.hasOwn(s.fields,e))return;let n=s.fields[e];f||!n||m(e,{...n,revision:n.revision+1,edited:!0,validation:void 0,replacement:void 0,localInvalid:!0,localText:i})},revert(e){let i=a.find(t=>t.id===e);if(f||l||!i)return!1;let n={...s.fields};for(let t of O(i)){let{draft:d}=i.fields[t];n[t]={...n[t],value:d.value,validation:d.validation,label:d.label,revision:n[t].revision+1,edited:!1,localInvalid:void 0,localText:void 0}}for(let[t,d]of Object.entries(n))_optionalChain([d, 'access', _4 => _4.replacement, 'optionalAccess', _5 => _5.fill])===e&&(n[t]={...d,replacement:void 0});return a=a.filter(t=>t!==i),c(n),!0},failRequest(e){_optionalChain([l, 'optionalAccess', _6 => _6.id])===e&&(l=void 0,c({...s.fields}))},replace(e,i){if(!Object.hasOwn(s.fields,e))return!1;let n=s.fields[e];return f||!_optionalChain([n, 'optionalAccess', _7 => _7.replacement])||n.revision!==i||n.replacement.revision!==i?!1:(m(e,{...n,value:n.replacement.value,validation:n.replacement.validation,revision:i+1,edited:!1,replacement:void 0,localInvalid:void 0,localText:void 0}),!0)},cancelReplacement(e){if(!Object.hasOwn(s.fields,e))return;let i=s.fields[e];i&&!f&&m(e,{...i,replacement:void 0})},cancel(){l=void 0,c({...s.fields})},dispose(){f=!0,l=void 0,a=[],c({}),v.clear()}}}exports.a = F;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o='[role="dialog"]',t='[aria-modal="true"]',L=o+t;export{o as a,t as b,L as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as m}from"react";import{Fragment as p,jsx as e,jsxs as i}from"react/jsx-runtime";function d({value:t,t:r}){return t==null||t===""?r("chat.block.empty"):Array.isArray(t)?t.length?e(p,{children:t.map((n,o)=>i(m,{children:[o?", ":null,e(d,{value:n,t:r})]},o))}):r("chat.block.empty"):typeof t=="object"?e("dl",{children:Object.entries(t).map(([n,o])=>i("div",{children:[e("dt",{children:n}),e("dd",{children:e(d,{value:o,t:r})})]},n))}):String(t)}export{d as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function o(){try{return process.env.NODE_ENV==="production"}catch{return!1}}export{o as a};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var W=function(e,t){return W=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},W(e,t)};function w(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");W(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var c=function(){return c=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},c.apply(this,arguments)};function ae(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function V(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function j(e,t){var n=t&&t.cache?t.cache:Ge,r=t&&t.serializer?t.serializer:Re,i=t&&t.strategy?t.strategy:Le;return i(e,{cache:n,serializer:r})}function Ie(e){return e==null||typeof e=="number"||typeof e=="boolean"}function se(e,t,n,r){var i=Ie(r)?r:n(r),o=t.get(i);return typeof o>"u"&&(o=e.call(this,r),t.set(i,o)),o}function he(e,t,n){var r=Array.prototype.slice.call(arguments,3),i=n(r),o=t.get(i);return typeof o>"u"&&(o=e.apply(this,r),t.set(i,o)),o}function z(e,t,n,r,i){return n.bind(t,e,r,i)}function Le(e,t){var n=e.length===1?se:he;return z(e,this,n,t.cache.create(),t.serializer)}function Oe(e,t){return z(e,this,he,t.cache.create(),t.serializer)}function Ce(e,t){return z(e,this,se,t.cache.create(),t.serializer)}var Re=function(){return JSON.stringify(arguments)},Me=(function(){function e(){this.cache=Object.create(null)}return e.prototype.get=function(t){return this.cache[t]},e.prototype.set=function(t,n){this.cache[t]=n},e})(),Ge={create:function(){return new Me}},X={variadic:Oe,monadic:Ce};var l;(function(e){e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",e[e.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",e[e.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",e[e.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",e[e.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",e[e.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",e[e.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",e[e.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",e[e.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",e[e.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",e[e.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",e[e.INVALID_TAG=23]="INVALID_TAG",e[e.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",e[e.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",e[e.UNCLOSED_TAG=27]="UNCLOSED_TAG"})(l||(l={}));var b;(function(e){e[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural",e[e.pound=7]="pound",e[e.tag=8]="tag"})(b||(b={}));var T;(function(e){e[e.number=0]="number",e[e.dateTime=1]="dateTime"})(T||(T={}));function Z(e){return e.type===b.literal}function Y(e){return e.type===b.argument}function N(e){return e.type===b.number}function I(e){return e.type===b.date}function L(e){return e.type===b.time}function O(e){return e.type===b.select}function C(e){return e.type===b.plural}function ue(e){return e.type===b.pound}function R(e){return e.type===b.tag}function k(e){return!!(e&&typeof e=="object"&&e.type===T.number)}function M(e){return!!(e&&typeof e=="object"&&e.type===T.dateTime)}var J=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/;var De=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function fe(e){var t={};return e.replace(De,function(n){var r=n.length;switch(n[0]){case"G":t.era=r===4?"long":r===5?"narrow":"short";break;case"y":t.year=r===2?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":t.month=["numeric","2-digit","short","long","narrow"][r-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":t.day=["numeric","2-digit"][r-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":t.weekday=r===4?"long":r===5?"narrow":"short";break;case"e":if(r<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][r-4];break;case"c":if(r<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][r-4];break;case"a":t.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":t.hourCycle="h12",t.hour=["numeric","2-digit"][r-1];break;case"H":t.hourCycle="h23",t.hour=["numeric","2-digit"][r-1];break;case"K":t.hourCycle="h11",t.hour=["numeric","2-digit"][r-1];break;case"k":t.hourCycle="h24",t.hour=["numeric","2-digit"][r-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":t.minute=["numeric","2-digit"][r-1];break;case"s":t.second=["numeric","2-digit"][r-1];break;case"S":case"A":throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":t.timeZoneName=r<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""}),t}var le=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;function xe(e){if(e.length===0)throw new Error("Number skeleton cannot be empty");for(var t=e.split(le).filter(function(f){return f.length>0}),n=[],r=0,i=t;r<i.length;r++){var o=i[r],a=o.split("/");if(a.length===0)throw new Error("Invalid number skeleton");for(var h=a[0],x=a.slice(1),u=0,s=x;u<s.length;u++){var m=s[u];if(m.length===0)throw new Error("Invalid number skeleton")}n.push({stem:h,options:x})}return n}function Ue(e){return e.replace(/^(.*?)-/,"")}var ce=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,be=/^(@+)?(\+|#+)?[rs]?$/g,Fe=/(\*)(0+)|(#+)(0+)|(0+)/g,Ee=/^(0+)$/;function pe(e){var t={};return e[e.length-1]==="r"?t.roundingPriority="morePrecision":e[e.length-1]==="s"&&(t.roundingPriority="lessPrecision"),e.replace(be,function(n,r,i){return typeof i!="string"?(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length):i==="+"?t.minimumSignificantDigits=r.length:r[0]==="#"?t.maximumSignificantDigits=r.length:(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length+(typeof i=="string"?i.length:0)),""}),t}function ye(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function Ve(e){var t;if(e[0]==="E"&&e[1]==="E"?(t={notation:"engineering"},e=e.slice(2)):e[0]==="E"&&(t={notation:"scientific"},e=e.slice(1)),t){var n=e.slice(0,2);if(n==="+!"?(t.signDisplay="always",e=e.slice(2)):n==="+?"&&(t.signDisplay="exceptZero",e=e.slice(2)),!Ee.test(e))throw new Error("Malformed concise eng/scientific notation");t.minimumIntegerDigits=e.length}return t}function me(e){var t={},n=ye(e);return n||t}function ve(e){for(var t={},n=0,r=e;n<r.length;n++){var i=r[n];switch(i.stem){case"percent":case"%":t.style="percent";continue;case"%x100":t.style="percent",t.scale=100;continue;case"currency":t.style="currency",t.currency=i.options[0];continue;case"group-off":case",_":t.useGrouping=!1;continue;case"precision-integer":case".":t.maximumFractionDigits=0;continue;case"measure-unit":case"unit":t.style="unit",t.unit=Ue(i.options[0]);continue;case"compact-short":case"K":t.notation="compact",t.compactDisplay="short";continue;case"compact-long":case"KK":t.notation="compact",t.compactDisplay="long";continue;case"scientific":t=c(c(c({},t),{notation:"scientific"}),i.options.reduce(function(x,u){return c(c({},x),me(u))},{}));continue;case"engineering":t=c(c(c({},t),{notation:"engineering"}),i.options.reduce(function(x,u){return c(c({},x),me(u))},{}));continue;case"notation-simple":t.notation="standard";continue;case"unit-width-narrow":t.currencyDisplay="narrowSymbol",t.unitDisplay="narrow";continue;case"unit-width-short":t.currencyDisplay="code",t.unitDisplay="short";continue;case"unit-width-full-name":t.currencyDisplay="name",t.unitDisplay="long";continue;case"unit-width-iso-code":t.currencyDisplay="symbol";continue;case"scale":t.scale=parseFloat(i.options[0]);continue;case"rounding-mode-floor":t.roundingMode="floor";continue;case"rounding-mode-ceiling":t.roundingMode="ceil";continue;case"rounding-mode-down":t.roundingMode="trunc";continue;case"rounding-mode-up":t.roundingMode="expand";continue;case"rounding-mode-half-even":t.roundingMode="halfEven";continue;case"rounding-mode-half-down":t.roundingMode="halfTrunc";continue;case"rounding-mode-half-up":t.roundingMode="halfExpand";continue;case"integer-width":if(i.options.length>1)throw new RangeError("integer-width stems only accept a single optional option");i.options[0].replace(Fe,function(x,u,s,m,f,E){if(u)t.minimumIntegerDigits=s.length;else{if(m&&f)throw new Error("We currently do not support maximum integer digits");if(E)throw new Error("We currently do not support exact integer digits")}return""});continue}if(Ee.test(i.stem)){t.minimumIntegerDigits=i.stem.length;continue}if(ce.test(i.stem)){if(i.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");i.stem.replace(ce,function(x,u,s,m,f,E){return s==="*"?t.minimumFractionDigits=u.length:m&&m[0]==="#"?t.maximumFractionDigits=m.length:f&&E?(t.minimumFractionDigits=f.length,t.maximumFractionDigits=f.length+E.length):(t.minimumFractionDigits=u.length,t.maximumFractionDigits=u.length),""});var o=i.options[0];o==="w"?t=c(c({},t),{trailingZeroDisplay:"stripIfInteger"}):o&&(t=c(c({},t),pe(o)));continue}if(be.test(i.stem)){t=c(c({},t),pe(i.stem));continue}var a=ye(i.stem);a&&(t=c(c({},t),a));var h=Ve(i.stem);h&&(t=c(c({},t),h))}return t}var G={"001":["H","h"],419:["h","H","hB","hb"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["h","H","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["h","H","hB","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["h","H","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["h","H","hB","hb"],CU:["h","H","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["h","H","hB","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GT:["h","H","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["h","H","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["h","H","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["h","H","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["h","H","hB","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["h","H","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["h","H","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["h","H","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"en-HK":["h","hb","H","hB"],"en-IL":["H","h","hb","hB"],"en-MY":["h","hb","H","hB"],"es-BR":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]};function ge(e,t){for(var n="",r=0;r<e.length;r++){var i=e.charAt(r);if(i==="j"){for(var o=0;r+1<e.length&&e.charAt(r+1)===i;)o++,r++;var a=1+(o&1),h=o<2?1:3+(o>>1),x="a",u=je(t);for((u=="H"||u=="k")&&(h=0);h-- >0;)n+=x;for(;a-- >0;)n=u+n}else i==="J"?n+="H":n+=i}return n}function je(e){var t=e.hourCycle;if(t===void 0&&e.hourCycles&&e.hourCycles.length&&(t=e.hourCycles[0]),t)switch(t){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}var n=e.language,r;n!=="root"&&(r=e.maximize().region);var i=G[r||""]||G[n||""]||G["".concat(n,"-001")]||G["001"];return i[0]}var Q,Xe=new RegExp("^".concat(J.source,"*")),ke=new RegExp("".concat(J.source,"*$"));function p(e,t){return{start:e,end:t}}var We=!!String.prototype.startsWith&&"_a".startsWith("a",1),ze=!!String.fromCodePoint,Ze=!!Object.fromEntries,Ye=!!String.prototype.codePointAt,Je=!!String.prototype.trimStart,Qe=!!String.prototype.trimEnd,qe=!!Number.isSafeInteger,$e=qe?Number.isSafeInteger:function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},$=!0;try{de=Se("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu"),$=((Q=de.exec("a"))===null||Q===void 0?void 0:Q[0])==="a"}catch{$=!1}var de,_e=We?function(t,n,r){return t.startsWith(n,r)}:function(t,n,r){return t.slice(r,r+n.length)===n},K=ze?String.fromCodePoint:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r="",i=t.length,o=0,a;i>o;){if(a=t[o++],a>1114111)throw RangeError(a+" is not a valid code point");r+=a<65536?String.fromCharCode(a):String.fromCharCode(((a-=65536)>>10)+55296,a%1024+56320)}return r},He=Ze?Object.fromEntries:function(t){for(var n={},r=0,i=t;r<i.length;r++){var o=i[r],a=o[0],h=o[1];n[a]=h}return n},Te=Ye?function(t,n){return t.codePointAt(n)}:function(t,n){var r=t.length;if(!(n<0||n>=r)){var i=t.charCodeAt(n),o;return i<55296||i>56319||n+1===r||(o=t.charCodeAt(n+1))<56320||o>57343?i:(i-55296<<10)+(o-56320)+65536}},Ke=Je?function(t){return t.trimStart()}:function(t){return t.replace(Xe,"")},et=Qe?function(t){return t.trimEnd()}:function(t){return t.replace(ke,"")};function Se(e,t){return new RegExp(e,t)}var ee;$?(q=Se("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu"),ee=function(t,n){var r;q.lastIndex=n;var i=q.exec(t);return(r=i[1])!==null&&r!==void 0?r:""}):ee=function(t,n){for(var r=[];;){var i=Te(t,n);if(i===void 0||Ae(i)||nt(i))break;r.push(i),n+=i>=65536?2:1}return K.apply(void 0,r)};var q,Be=(function(){function e(t,n){n===void 0&&(n={}),this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!n.ignoreTag,this.locale=n.locale,this.requiresOtherClause=!!n.requiresOtherClause,this.shouldParseSkeletons=!!n.shouldParseSkeletons}return e.prototype.parse=function(){if(this.offset()!==0)throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(t,n,r){for(var i=[];!this.isEOF();){var o=this.char();if(o===123){var a=this.parseArgument(t,r);if(a.err)return a;i.push(a.val)}else{if(o===125&&t>0)break;if(o===35&&(n==="plural"||n==="selectordinal")){var h=this.clonePosition();this.bump(),i.push({type:b.pound,location:p(h,this.clonePosition())})}else if(o===60&&!this.ignoreTag&&this.peek()===47){if(r)break;return this.error(l.UNMATCHED_CLOSING_TAG,p(this.clonePosition(),this.clonePosition()))}else if(o===60&&!this.ignoreTag&&te(this.peek()||0)){var a=this.parseTag(t,n);if(a.err)return a;i.push(a.val)}else{var a=this.parseLiteral(t,n);if(a.err)return a;i.push(a.val)}}}return{val:i,err:null}},e.prototype.parseTag=function(t,n){var r=this.clonePosition();this.bump();var i=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:b.literal,value:"<".concat(i,"/>"),location:p(r,this.clonePosition())},err:null};if(this.bumpIf(">")){var o=this.parseMessage(t+1,n,!0);if(o.err)return o;var a=o.val,h=this.clonePosition();if(this.bumpIf("</")){if(this.isEOF()||!te(this.char()))return this.error(l.INVALID_TAG,p(h,this.clonePosition()));var x=this.clonePosition(),u=this.parseTagName();return i!==u?this.error(l.UNMATCHED_CLOSING_TAG,p(x,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:b.tag,value:i,children:a,location:p(r,this.clonePosition())},err:null}:this.error(l.INVALID_TAG,p(h,this.clonePosition())))}else return this.error(l.UNCLOSED_TAG,p(r,this.clonePosition()))}else return this.error(l.INVALID_TAG,p(r,this.clonePosition()))},e.prototype.parseTagName=function(){var t=this.offset();for(this.bump();!this.isEOF()&&rt(this.char());)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(t,n){for(var r=this.clonePosition(),i="";;){var o=this.tryParseQuote(n);if(o){i+=o;continue}var a=this.tryParseUnquoted(t,n);if(a){i+=a;continue}var h=this.tryParseLeftAngleBracket();if(h){i+=h;continue}break}var x=p(r,this.clonePosition());return{val:{type:b.literal,value:i,location:x},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!tt(this.peek()||0))?(this.bump(),"<"):null},e.prototype.tryParseQuote=function(t){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(t==="plural"||t==="selectordinal")break;return null;default:return null}this.bump();var n=[this.char()];for(this.bump();!this.isEOF();){var r=this.char();if(r===39)if(this.peek()===39)n.push(39),this.bump();else{this.bump();break}else n.push(r);this.bump()}return K.apply(void 0,n)},e.prototype.tryParseUnquoted=function(t,n){if(this.isEOF())return null;var r=this.char();return r===60||r===123||r===35&&(n==="plural"||n==="selectordinal")||r===125&&t>0?null:(this.bump(),K(r))},e.prototype.parseArgument=function(t,n){var r=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(l.EXPECT_ARGUMENT_CLOSING_BRACE,p(r,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(l.EMPTY_ARGUMENT,p(r,this.clonePosition()));var i=this.parseIdentifierIfPossible().value;if(!i)return this.error(l.MALFORMED_ARGUMENT,p(r,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(l.EXPECT_ARGUMENT_CLOSING_BRACE,p(r,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:b.argument,value:i,location:p(r,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(l.EXPECT_ARGUMENT_CLOSING_BRACE,p(r,this.clonePosition())):this.parseArgumentOptions(t,n,i,r);default:return this.error(l.MALFORMED_ARGUMENT,p(r,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var t=this.clonePosition(),n=this.offset(),r=ee(this.message,n),i=n+r.length;this.bumpTo(i);var o=this.clonePosition(),a=p(t,o);return{value:r,location:a}},e.prototype.parseArgumentOptions=function(t,n,r,i){var o,a=this.clonePosition(),h=this.parseIdentifierIfPossible().value,x=this.clonePosition();switch(h){case"":return this.error(l.EXPECT_ARGUMENT_TYPE,p(a,x));case"number":case"date":case"time":{this.bumpSpace();var u=null;if(this.bumpIf(",")){this.bumpSpace();var s=this.clonePosition(),m=this.parseSimpleArgStyleIfPossible();if(m.err)return m;var f=et(m.val);if(f.length===0)return this.error(l.EXPECT_ARGUMENT_STYLE,p(this.clonePosition(),this.clonePosition()));var E=p(s,this.clonePosition());u={style:f,styleLocation:E}}var v=this.tryParseArgumentClose(i);if(v.err)return v;var g=p(i,this.clonePosition());if(u&&_e(u?.style,"::",0)){var _=Ke(u.style.slice(2));if(h==="number"){var m=this.parseNumberSkeletonFromString(_,u.styleLocation);return m.err?m:{val:{type:b.number,value:r,location:g,style:m.val},err:null}}else{if(_.length===0)return this.error(l.EXPECT_DATE_TIME_SKELETON,g);var A=_;this.locale&&(A=ge(_,this.locale));var f={type:T.dateTime,pattern:A,location:u.styleLocation,parsedOptions:this.shouldParseSkeletons?fe(A):{}},B=h==="date"?b.date:b.time;return{val:{type:B,value:r,location:g,style:f},err:null}}}return{val:{type:h==="number"?b.number:h==="date"?b.date:b.time,value:r,location:g,style:(o=u?.style)!==null&&o!==void 0?o:null},err:null}}case"plural":case"selectordinal":case"select":{var d=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(l.EXPECT_SELECT_ARGUMENT_OPTIONS,p(d,c({},d)));this.bumpSpace();var P=this.parseIdentifierIfPossible(),H=0;if(h!=="select"&&P.value==="offset"){if(!this.bumpIf(":"))return this.error(l.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,p(this.clonePosition(),this.clonePosition()));this.bumpSpace();var m=this.tryParseDecimalInteger(l.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,l.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(m.err)return m;this.bumpSpace(),P=this.parseIdentifierIfPossible(),H=m.val}var F=this.tryParsePluralOrSelectOptions(t,h,n,P);if(F.err)return F;var v=this.tryParseArgumentClose(i);if(v.err)return v;var oe=p(i,this.clonePosition());return h==="select"?{val:{type:b.select,value:r,options:He(F.val),location:oe},err:null}:{val:{type:b.plural,value:r,options:He(F.val),offset:H,pluralType:h==="plural"?"cardinal":"ordinal",location:oe},err:null}}default:return this.error(l.INVALID_ARGUMENT_TYPE,p(a,x))}},e.prototype.tryParseArgumentClose=function(t){return this.isEOF()||this.char()!==125?this.error(l.EXPECT_ARGUMENT_CLOSING_BRACE,p(t,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var t=0,n=this.clonePosition();!this.isEOF();){var r=this.char();switch(r){case 39:{this.bump();var i=this.clonePosition();if(!this.bumpUntil("'"))return this.error(l.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,p(i,this.clonePosition()));this.bump();break}case 123:{t+=1,this.bump();break}case 125:{if(t>0)t-=1;else return{val:this.message.slice(n.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(n.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(t,n){var r=[];try{r=xe(t)}catch{return this.error(l.INVALID_NUMBER_SKELETON,n)}return{val:{type:T.number,tokens:r,location:n,parsedOptions:this.shouldParseSkeletons?ve(r):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(t,n,r,i){for(var o,a=!1,h=[],x=new Set,u=i.value,s=i.location;;){if(u.length===0){var m=this.clonePosition();if(n!=="select"&&this.bumpIf("=")){var f=this.tryParseDecimalInteger(l.EXPECT_PLURAL_ARGUMENT_SELECTOR,l.INVALID_PLURAL_ARGUMENT_SELECTOR);if(f.err)return f;s=p(m,this.clonePosition()),u=this.message.slice(m.offset,this.offset())}else break}if(x.has(u))return this.error(n==="select"?l.DUPLICATE_SELECT_ARGUMENT_SELECTOR:l.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,s);u==="other"&&(a=!0),this.bumpSpace();var E=this.clonePosition();if(!this.bumpIf("{"))return this.error(n==="select"?l.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:l.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,p(this.clonePosition(),this.clonePosition()));var v=this.parseMessage(t+1,n,r);if(v.err)return v;var g=this.tryParseArgumentClose(E);if(g.err)return g;h.push([u,{value:v.val,location:p(E,this.clonePosition())}]),x.add(u),this.bumpSpace(),o=this.parseIdentifierIfPossible(),u=o.value,s=o.location}return h.length===0?this.error(n==="select"?l.EXPECT_SELECT_ARGUMENT_SELECTOR:l.EXPECT_PLURAL_ARGUMENT_SELECTOR,p(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!a?this.error(l.MISSING_OTHER_CLAUSE,p(this.clonePosition(),this.clonePosition())):{val:h,err:null}},e.prototype.tryParseDecimalInteger=function(t,n){var r=1,i=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(r=-1);for(var o=!1,a=0;!this.isEOF();){var h=this.char();if(h>=48&&h<=57)o=!0,a=a*10+(h-48),this.bump();else break}var x=p(i,this.clonePosition());return o?(a*=r,$e(a)?{val:a,err:null}:this.error(n,x)):this.error(t,x)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var t=this.position.offset;if(t>=this.message.length)throw Error("out of bound");var n=Te(this.message,t);if(n===void 0)throw Error("Offset ".concat(t," is at invalid UTF-16 code unit boundary"));return n},e.prototype.error=function(t,n){return{val:null,err:{kind:t,message:this.message,location:n}}},e.prototype.bump=function(){if(!this.isEOF()){var t=this.char();t===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=t<65536?1:2)}},e.prototype.bumpIf=function(t){if(_e(this.message,t,this.offset())){for(var n=0;n<t.length;n++)this.bump();return!0}return!1},e.prototype.bumpUntil=function(t){var n=this.offset(),r=this.message.indexOf(t,n);return r>=0?(this.bumpTo(r),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(t){if(this.offset()>t)throw Error("targetOffset ".concat(t," must be greater than or equal to the current offset ").concat(this.offset()));for(t=Math.min(t,this.message.length);;){var n=this.offset();if(n===t)break;if(n>t)throw Error("targetOffset ".concat(t," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&Ae(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var t=this.char(),n=this.offset(),r=this.message.charCodeAt(n+(t>=65536?2:1));return r??null},e})();function te(e){return e>=97&&e<=122||e>=65&&e<=90}function tt(e){return te(e)||e===47}function rt(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function Ae(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function nt(e){return e>=33&&e<=35||e===36||e>=37&&e<=39||e===40||e===41||e===42||e===43||e===44||e===45||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||e===91||e===92||e===93||e===94||e===96||e===123||e===124||e===125||e===126||e===161||e>=162&&e<=165||e===166||e===167||e===169||e===171||e===172||e===174||e===176||e===177||e===182||e===187||e===191||e===215||e===247||e>=8208&&e<=8213||e>=8214&&e<=8215||e===8216||e===8217||e===8218||e>=8219&&e<=8220||e===8221||e===8222||e===8223||e>=8224&&e<=8231||e>=8240&&e<=8248||e===8249||e===8250||e>=8251&&e<=8254||e>=8257&&e<=8259||e===8260||e===8261||e===8262||e>=8263&&e<=8273||e===8274||e===8275||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||e===8608||e>=8609&&e<=8610||e===8611||e>=8612&&e<=8613||e===8614||e>=8615&&e<=8621||e===8622||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||e===8658||e===8659||e===8660||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||e===8968||e===8969||e===8970||e===8971||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||e===9001||e===9002||e>=9003&&e<=9083||e===9084||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||e===9655||e>=9656&&e<=9664||e===9665||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||e===9839||e>=9840&&e<=10087||e===10088||e===10089||e===10090||e===10091||e===10092||e===10093||e===10094||e===10095||e===10096||e===10097||e===10098||e===10099||e===10100||e===10101||e>=10132&&e<=10175||e>=10176&&e<=10180||e===10181||e===10182||e>=10183&&e<=10213||e===10214||e===10215||e===10216||e===10217||e===10218||e===10219||e===10220||e===10221||e===10222||e===10223||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||e===10627||e===10628||e===10629||e===10630||e===10631||e===10632||e===10633||e===10634||e===10635||e===10636||e===10637||e===10638||e===10639||e===10640||e===10641||e===10642||e===10643||e===10644||e===10645||e===10646||e===10647||e===10648||e>=10649&&e<=10711||e===10712||e===10713||e===10714||e===10715||e>=10716&&e<=10747||e===10748||e===10749||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||e===11158||e>=11159&&e<=11263||e>=11776&&e<=11777||e===11778||e===11779||e===11780||e===11781||e>=11782&&e<=11784||e===11785||e===11786||e===11787||e===11788||e===11789||e>=11790&&e<=11798||e===11799||e>=11800&&e<=11801||e===11802||e===11803||e===11804||e===11805||e>=11806&&e<=11807||e===11808||e===11809||e===11810||e===11811||e===11812||e===11813||e===11814||e===11815||e===11816||e===11817||e>=11818&&e<=11822||e===11823||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||e===11840||e===11841||e===11842||e>=11843&&e<=11855||e>=11856&&e<=11857||e===11858||e>=11859&&e<=11903||e>=12289&&e<=12291||e===12296||e===12297||e===12298||e===12299||e===12300||e===12301||e===12302||e===12303||e===12304||e===12305||e>=12306&&e<=12307||e===12308||e===12309||e===12310||e===12311||e===12312||e===12313||e===12314||e===12315||e===12316||e===12317||e>=12318&&e<=12319||e===12320||e===12336||e===64830||e===64831||e>=65093&&e<=65094}function re(e){e.forEach(function(t){if(delete t.location,O(t)||C(t))for(var n in t.options)delete t.options[n].location,re(t.options[n].value);else N(t)&&k(t.style)||(I(t)||L(t))&&M(t.style)?delete t.style.location:R(t)&&re(t.children)})}function Pe(e,t){t===void 0&&(t={}),t=c({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var n=new Be(e,t).parse();if(n.err){var r=SyntaxError(l[n.err.kind]);throw r.location=n.err.location,r.originalMessage=n.err.message,r}return t?.captureLocation||re(n.val),n.val}var S;(function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"})(S||(S={}));var D=(function(e){w(t,e);function t(n,r,i){var o=e.call(this,n)||this;return o.code=r,o.originalMessage=i,o}return t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t})(Error);var ne=(function(e){w(t,e);function t(n,r,i,o){return e.call(this,'Invalid values for "'.concat(n,'": "').concat(r,'". Options are "').concat(Object.keys(i).join('", "'),'"'),S.INVALID_VALUE,o)||this}return t})(D);var we=(function(e){w(t,e);function t(n,r,i){return e.call(this,'Value for "'.concat(n,'" must be of type ').concat(r),S.INVALID_VALUE,i)||this}return t})(D);var Ne=(function(e){w(t,e);function t(n,r){return e.call(this,'The intl string context variable "'.concat(n,'" was not provided to the string "').concat(r,'"'),S.MISSING_VALUE,r)||this}return t})(D);var y;(function(e){e[e.literal=0]="literal",e[e.object=1]="object"})(y||(y={}));function it(e){return e.length<2?e:e.reduce(function(t,n){var r=t[t.length-1];return!r||r.type!==y.literal||n.type!==y.literal?t.push(n):r.value+=n.value,t},[])}function ot(e){return typeof e=="function"}function U(e,t,n,r,i,o,a){if(e.length===1&&Z(e[0]))return[{type:y.literal,value:e[0].value}];for(var h=[],x=0,u=e;x<u.length;x++){var s=u[x];if(Z(s)){h.push({type:y.literal,value:s.value});continue}if(ue(s)){typeof o=="number"&&h.push({type:y.literal,value:n.getNumberFormat(t).format(o)});continue}var m=s.value;if(!(i&&m in i))throw new Ne(m,a);var f=i[m];if(Y(s)){(!f||typeof f=="string"||typeof f=="number")&&(f=typeof f=="string"||typeof f=="number"?String(f):""),h.push({type:typeof f=="string"?y.literal:y.object,value:f});continue}if(I(s)){var E=typeof s.style=="string"?r.date[s.style]:M(s.style)?s.style.parsedOptions:void 0;h.push({type:y.literal,value:n.getDateTimeFormat(t,E).format(f)});continue}if(L(s)){var E=typeof s.style=="string"?r.time[s.style]:M(s.style)?s.style.parsedOptions:r.time.medium;h.push({type:y.literal,value:n.getDateTimeFormat(t,E).format(f)});continue}if(N(s)){var E=typeof s.style=="string"?r.number[s.style]:k(s.style)?s.style.parsedOptions:void 0;E&&E.scale&&(f=f*(E.scale||1)),h.push({type:y.literal,value:n.getNumberFormat(t,E).format(f)});continue}if(R(s)){var v=s.children,g=s.value,_=i[g];if(!ot(_))throw new we(g,"function",a);var A=U(v,t,n,r,i,o),B=_(A.map(function(H){return H.value}));Array.isArray(B)||(B=[B]),h.push.apply(h,B.map(function(H){return{type:typeof H=="string"?y.literal:y.object,value:H}}))}if(O(s)){var d=s.options[f]||s.options.other;if(!d)throw new ne(s.value,f,Object.keys(s.options),a);h.push.apply(h,U(d.value,t,n,r,i));continue}if(C(s)){var d=s.options["=".concat(f)];if(!d){if(!Intl.PluralRules)throw new D(`Intl.PluralRules is not available in this environment.
|
|
2
|
+
Try polyfilling it using "@formatjs/intl-pluralrules"
|
|
3
|
+
`,S.MISSING_INTL_API,a);var P=n.getPluralRules(t,{type:s.pluralType}).select(f-(s.offset||0));d=s.options[P]||s.options.other}if(!d)throw new ne(s.value,f,Object.keys(s.options),a);h.push.apply(h,U(d.value,t,n,r,i,f-(s.offset||0)));continue}}return it(h)}function at(e,t){return t?c(c(c({},e||{}),t||{}),Object.keys(e).reduce(function(n,r){return n[r]=c(c({},e[r]),t[r]||{}),n},{})):e}function st(e,t){return t?Object.keys(e).reduce(function(n,r){return n[r]=at(e[r],t[r]),n},c({},e)):e}function ie(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,n){e[t]=n}}}}}function ht(e){return e===void 0&&(e={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:j(function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return new((t=Intl.NumberFormat).bind.apply(t,V([void 0],n,!1)))},{cache:ie(e.number),strategy:X.variadic}),getDateTimeFormat:j(function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return new((t=Intl.DateTimeFormat).bind.apply(t,V([void 0],n,!1)))},{cache:ie(e.dateTime),strategy:X.variadic}),getPluralRules:j(function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return new((t=Intl.PluralRules).bind.apply(t,V([void 0],n,!1)))},{cache:ie(e.pluralRules),strategy:X.variadic})}}var ut=(function(){function e(t,n,r,i){n===void 0&&(n=e.defaultLocale);var o=this;if(this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(u){var s=o.formatToParts(u);if(s.length===1)return s[0].value;var m=s.reduce(function(f,E){return!f.length||E.type!==y.literal||typeof f[f.length-1]!="string"?f.push(E.value):f[f.length-1]+=E.value,f},[]);return m.length<=1?m[0]||"":m},this.formatToParts=function(u){return U(o.ast,o.locales,o.formatters,o.formats,u,void 0,o.message)},this.resolvedOptions=function(){var u;return{locale:((u=o.resolvedLocale)===null||u===void 0?void 0:u.toString())||Intl.NumberFormat.supportedLocalesOf(o.locales)[0]}},this.getAst=function(){return o.ast},this.locales=n,this.resolvedLocale=e.resolveLocale(n),typeof t=="string"){if(this.message=t,!e.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");var a=i||{},h=a.formatters,x=ae(a,["formatters"]);this.ast=e.__parse(t,c(c({},x),{locale:this.resolvedLocale}))}else this.ast=t;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");this.formats=st(e.formats,r),this.formatters=i&&i.formatters||ht(this.formatterCache)}return Object.defineProperty(e,"defaultLocale",{get:function(){return e.memoizedDefaultLocale||(e.memoizedDefaultLocale=new Intl.NumberFormat().resolvedOptions().locale),e.memoizedDefaultLocale},enumerable:!1,configurable:!0}),e.memoizedDefaultLocale=null,e.resolveLocale=function(t){if(!(typeof Intl.Locale>"u")){var n=Intl.NumberFormat.supportedLocalesOf(t);return n.length>0?new Intl.Locale(n[0]):new Intl.Locale(typeof t=="string"?t:t[0])}},e.__parse=Pe,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e})();function ir(e,t){try{return Intl.getCanonicalLocales(e)[0]}catch{return t?"zh-Hans":"en"}}export{ut as a,ir as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t={"chat.block.required":"{label} (required)","chat.block.requiredMissing":"Fill in the required fields to submit.","chat.block.answerMissing":"Answer the question to submit.","chat.block.empty":"\u2014","chat.block.tierLow":"Low risk","chat.block.tierSensitive":"Sensitive","chat.block.undoCompareAndSet":"Undo restores the previous values","chat.block.undoArchiveCreated":"Undo archives what was created","chat.block.undoInverse":"Undo runs a reverse step","chat.block.status":"Status: {status}","chat.block.outcomeDone":"Done","chat.block.outcomeFailed":"Failed","chat.block.retryable":"It can be tried again","chat.block.notRetryable":"It cannot be tried again","chat.block.state.proposed":"Proposed","chat.block.state.awaiting-confirmation":"Waiting for confirmation","chat.block.state.running":"Running","chat.block.state.undoing":"Undoing","chat.block.state.completed":"Completed","chat.block.state.submitted":"Submitted","chat.block.state.undone":"Undone","chat.block.state.needs-attention":"Needs attention","chat.block.state.cancelled":"Cancelled","chat.block.run":"Run","chat.block.runMissing":"Fill in the required fields to run.","chat.block.favourite":"Favourite: {title}","chat.block.flowLoading":"Loading request\u2026","chat.block.flowsLoading":"Loading saved requests\u2026","chat.block.flowsEmpty":"No saved requests here yet.","chat.block.answered":"Answered","chat.block.answeredWith":"Answered: {answer}"},e={"chat.block.required":"{label}\uFF08\u5FC5\u586B\uFF09","chat.block.requiredMissing":"\u8BF7\u586B\u5199\u5FC5\u586B\u9879\u540E\u518D\u63D0\u4EA4\u3002","chat.block.answerMissing":"\u8BF7\u5148\u56DE\u7B54\u95EE\u9898\u518D\u63D0\u4EA4\u3002","chat.block.empty":"\u2014","chat.block.tierLow":"\u4F4E\u98CE\u9669","chat.block.tierSensitive":"\u654F\u611F","chat.block.undoCompareAndSet":"\u64A4\u9500\u4F1A\u6062\u590D\u539F\u6765\u7684\u503C","chat.block.undoArchiveCreated":"\u64A4\u9500\u4F1A\u5F52\u6863\u5DF2\u521B\u5EFA\u7684\u5185\u5BB9","chat.block.undoInverse":"\u64A4\u9500\u4F1A\u6267\u884C\u53CD\u5411\u6B65\u9AA4","chat.block.status":"\u72B6\u6001\uFF1A{status}","chat.block.outcomeDone":"\u5DF2\u5B8C\u6210","chat.block.outcomeFailed":"\u5931\u8D25","chat.block.retryable":"\u53EF\u4EE5\u91CD\u8BD5","chat.block.notRetryable":"\u65E0\u6CD5\u91CD\u8BD5","chat.block.state.proposed":"\u5DF2\u63D0\u8BAE","chat.block.state.awaiting-confirmation":"\u7B49\u5F85\u786E\u8BA4","chat.block.state.running":"\u8FD0\u884C\u4E2D","chat.block.state.undoing":"\u6B63\u5728\u64A4\u9500","chat.block.state.completed":"\u5DF2\u5B8C\u6210","chat.block.state.submitted":"\u5DF2\u63D0\u4EA4","chat.block.state.undone":"\u5DF2\u64A4\u9500","chat.block.state.needs-attention":"\u9700\u8981\u5904\u7406","chat.block.state.cancelled":"\u5DF2\u53D6\u6D88","chat.block.run":"\u8FD0\u884C","chat.block.runMissing":"\u8BF7\u5148\u586B\u5199\u5FC5\u586B\u5B57\u6BB5\u518D\u8FD0\u884C\u3002","chat.block.favourite":"\u6536\u85CF\uFF1A{title}","chat.block.flowLoading":"\u6B63\u5728\u52A0\u8F7D\u8BF7\u6C42\u2026\u2026","chat.block.flowsLoading":"\u6B63\u5728\u52A0\u8F7D\u5DF2\u4FDD\u5B58\u7684\u8BF7\u6C42\u2026\u2026","chat.block.flowsEmpty":"\u8FD9\u91CC\u8FD8\u6CA1\u6709\u5DF2\u4FDD\u5B58\u7684\u8BF7\u6C42\u3002","chat.block.answered":"\u5DF2\u56DE\u7B54","chat.block.answeredWith":"\u5DF2\u56DE\u7B54\uFF1A{answer}"};export{t as a,e as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var K=["1.1","1.0"],J= exports.b =["plans","flows","widgets","step-up","scheduled","form-fill","plan-recovery","plan-leave","plan-keep","reply-stop"];function W(e){return e.filter(a=>a!=="plan-leave"&&a!=="plan-keep"||e.includes("plan-recovery"))}function F(e,a=[],s){let o=K.find(c=>e.includes(c));if(!o)throw new Error("update-required");return{protocol:o,capabilities:W(J.filter(c=>a.includes(c)&&(!s||s.capabilities.includes(c))&&(c!=="form-fill"||o==="1.1")))}}function H(e){return{text:e.fallback,disabled:!0,update:!0}}var $={client:[],conversation:["client"],stream:["conversation"],connection:["stream"],recovery:["stream"],"plan-read":["conversation","connection"],"flow-load":["client"],"flow-run":["client"],binding:["client"],runner:["conversation","external"],invocation:["runner"]},U=new WeakMap;function q(e,a){if(a){let y=$[e],n=_nullishCoalesce(U.get(a), () => ("external"));if(!y.includes(n))throw new Error(`A ${e} scope cannot have this parent`)}else if(e!=="client"&&e!=="runner")throw new Error(`A ${e} scope needs a parent`);let s=globalThis,o=new s.AbortController,c=_optionalChain([s, 'access', _ => _.AbortSignal, 'optionalAccess', _2 => _2.any]),p=(y,n,f=()=>o.abort())=>(U.set(y,e),{signal:y,abort:f,end:n});if(!a)return p(o.signal,()=>{});if(c)return p(c.call(s.AbortSignal,[a,o.signal]),()=>{});let b=()=>o.abort();a.aborted?o.abort():a.addEventListener("abort",b,{once:!0});let m=()=>a.removeEventListener("abort",b);return p(o.signal,m,()=>{m(),o.abort()})}function A(e,a){return e.aborted?(a(),()=>{}):(e.addEventListener("abort",a,{once:!0}),()=>e.removeEventListener("abort",a))}var k=class extends Error{constructor(){super("plan-read-refused"),this.name="PlanReadRefused"}},L=e=>e instanceof k?"plan-changed":"connection-lost";function j(e,a){return{proposed:["awaiting-confirmation","cancelled"],"awaiting-confirmation":["running","submitted","cancelled"],running:["undoing","completed","needs-attention"],undoing:["undone","needs-attention"],completed:["undoing"],submitted:[],undone:[],"needs-attention":["running","undoing"],cancelled:[]}[e].includes(a)}var C=new Error("retired");function z(e){let a=null,s=new Set,o,c=q("runner",e.signal),p=!1,b,m=async(n,f)=>{if(f.signal.aborted)throw C;let t=await e.read(n);return f.signal.aborted||_optionalChain([e, 'access', _3 => _3.onRecord, 'optionalCall', _4 => _4(t)]),t},y=async(n,f,t)=>{let r;try{r=await m(n,t)}catch(i){throw i!==C&&!t.signal.aborted&&t.acceptance&&e.interrupted&&await e.interrupted(n,L(i)),i}if(t.signal.aborted)return;if(r.recovery&&(_optionalChain([t, 'access', _5 => _5.acceptance, 'optionalAccess', _6 => _6.planId])!==n||t.acceptance.executionId!==r.recovery.executionId))throw new Error("unauthorized-run");if(r.plan.kind!=="immediate"||r.plan.stage!=="final"||r.state!=="running")return;if(!f||r.plan.digest!==f)throw new Error("invalid-plan");let u={...r.plan,steps:r.plan.steps.map(i=>({...i,request:i.request?{...i.request,headers:{...i.request.headers}}:void 0}))},S=u.steps,O=S.filter(i=>i.undo==="none");if(O.length>1||O.length===1&&_optionalChain([S, 'access', _7 => _7.at, 'call', _8 => _8(-1), 'optionalAccess', _9 => _9.undo])!=="none"||S.some(i=>!i.request||!["POST","PUT","PATCH"].includes(i.request.method)))throw new Error("invalid-plan");let x,R=!1,E=()=>{R=!0,x!==void 0&&_optionalChain([e, 'access', _10 => _10.clock, 'optionalAccess', _11 => _11.clearTimeout, 'call', _12 => _12(x)]),x=void 0},N=A(t.signal,E),l=async i=>{E(),t.context&&delete t.context.stepUpCode,!t.signal.aborted&&(i&&e.interrupted&&await e.interrupted(n,i),t.signal.aborted||await m(n,t).catch(()=>{}))},v=async()=>{try{return await m(n,t)}catch(i){throw i!==C&&await l(L(i)),i}},T=async()=>{if(!(R||t.signal.aborted)){try{await e.heartbeat(n,t.acceptance)}catch (e2){t.signal.aborted||(p=!0)}!R&&!t.signal.aborted&&e.clock&&(x=e.clock.setTimeout(()=>{x=void 0,T()},_nullishCoalesce(e.heartbeatMs, () => (1e4))))}};await T();try{for(let[i,g]of S.entries()){if(t.signal.aborted)return;if(p)return l("renewal-refused");if(s.has(n))return l();if(r=await v(),t.signal.aborted)return;if(p)return l("renewal-refused");if(s.has(n))return l();if(r.state!=="running")return;if(r.outcomes.some(d=>d.stepId===g.id&&d.attributed&&d.status>=200&&d.status<300))continue;let P=r.plan;if(P.kind!=="immediate"||P.stage!=="final"||P.digest!==u.digest||JSON.stringify(_optionalChain([P, 'access', _13 => _13.steps, 'access', _14 => _14[i], 'optionalAccess', _15 => _15.request]))!==JSON.stringify(g.request))throw await l("plan-changed"),new Error("invalid-plan");let h=g.request,w={signal:t.signal,planId:n,stepId:g.id,headers:{...h.headers,"Waypoint-Step":`${n}.${i}`,...t.acceptance?{"Waypoint-Execution":t.acceptance.executionId,"Waypoint-Fence":String(t.acceptance.fence)}:{}}};if(g.stepUp){let d=await _optionalChain([e, 'access', _16 => _16.stepUp, 'optionalCall', _17 => _17(n,g.id)]);if(!d)return l("step-up-failed");if(t.signal.aborted)return;if(p)return l("renewal-refused");if(s.has(n))return l();if(r=await v(),r.state!=="running")return;if(r.plan.kind!=="immediate"||r.plan.stage!=="final"||r.plan.digest!==u.digest||JSON.stringify(_optionalChain([r, 'access', _18 => _18.plan, 'access', _19 => _19.steps, 'access', _20 => _20[i], 'optionalAccess', _21 => _21.request]))!==JSON.stringify(h))throw await l("plan-changed"),new Error("invalid-plan");if(r.outcomes.some(I=>I.stepId===g.id&&I.attributed&&I.status>=200&&I.status<300))continue;w.stepUpCode=d}if(t.signal.aborted)return;if(p)return l("renewal-refused");if(s.has(n))return l();try{t.context=w,await e.request({...h,headers:{...h.headers}},w)}catch (e3){return delete w.stepUpCode,t.context===w&&(t.context=void 0),l("step-failed")}finally{delete w.stepUpCode,t.context===w&&(t.context=void 0)}if(r=await v(),!r.outcomes.some(d=>d.stepId===g.id&&d.attributed&&d.status>=200&&d.status<300))return l("attribution-missing");if(s.has(n))return l()}}finally{E(),N()}};return{run(n,f,t){if(a)return o===n?a:Promise.reject(new Error("active-plan"));if(s.has(n)||c.signal.aborted)return Promise.resolve();o=n,p=!1;let r=q("invocation",c.signal),u={scope:r,signal:r.signal,...t?{acceptance:t}:{}};return A(u.signal,()=>{u.context&&delete u.context.stepUpCode}),b=u,a=y(n,f,u).catch(S=>{if(S!==C)throw S}).finally(()=>{r.end(),b===u&&(b=void 0),a=null,o=void 0}),a},stop(n=o){n&&s.add(n)},interrupt(){_optionalChain([b, 'optionalAccess', _22 => _22.scope, 'access', _23 => _23.abort, 'call', _24 => _24()])},dispose(){c.abort()}}}exports.a = K; exports.b = J; exports.c = W; exports.d = F; exports.e = H; exports.f = q; exports.g = A; exports.h = k; exports.i = j; exports.j = z;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as A}from"./chunk-L4PFFRDE.js";var o=e=>`chat.recovery.${e}`,G=["alreadyClosedByWinner","alreadyKept","alreadyStoppedNeedsDecision","cancelStarted","cancelledNoChanges","capabilityMissing","currentStopped","initialTargetSettled","initialTargetStopped","intentSuperseded","keepReasonChanged","keptForwardClosed","leaveCompletedByKeep","leaveCoveredByKeep","leaveNeedsReview","leaveSafetyNeedsReview","leftKnown","leftUnconfirmed","planClosedKept","reviewTargetSettled","reviewTargetStopped","stopped","stoppedNoChanges","acknowledgmentAhead","cancelCoveredByLeaveSafety","cancelCoveredByStopNoChanges","cancelDefeatedByStop","choiceReplacedByStop","initialTargetClosed","keepDefeatedByWinner","leaveDefeatedByWinner","leaveNoDecision","leaveSafetyAlreadyStopped","reopenedEvidence"],z={...Object.fromEntries(G.map(e=>[e,o(e)])),alreadyClosed:o("alreadyClosedByWinner"),acknowledgmentStale:o("keepReasonChanged"),intentConflict:o("intentTargetChanged"),invalidTarget:o("intentTargetChanged"),intentUnavailable:o("keepReasonUnavailable"),keepBlockedActive:o("keepReasonActive"),keepBlockedUnknown:o("keepReasonUnknown"),keepBlockedReview:o("keepReasonPreview"),keepNoDecision:o("keepReasonNoSource"),planSealed:o("alreadyKept"),keptElsewhere:o("keptAlready")},x={...Object.fromEntries(["stopNotSent","stopNotSentElsewhere","stopUnconfirmed","leaveNotSent","leaveUnconfirmed","keepNotSent","keepUnconfirmed"].map(e=>[e,o(e)])),cancelInitialNotSent:o("cancelNotSent"),cancelInitialUnconfirmed:o("cancelUnconfirmed"),cancelReviewNotSent:o("reviewCancelNotSent"),cancelReviewUnconfirmed:o("reviewCancelUnconfirmed"),stopRefused:o("requestRefused"),cancelInitialRefused:o("requestRefused"),cancelReviewRefused:o("requestRefused"),leaveRefused:o("requestRefused"),keepRefused:o("requestRefused")},Q=new Set(["leftUnconfirmed"]),Z={leaveCompletedByKeep:o("leaveCompletedByKeep"),leaveCoveredByKeep:o("leaveCoveredByKeep"),keptElsewhere:o("keptAlready")};function ee(e){let n=[],t=(s,c)=>{s&&!n.some(u=>u.key===s)&&n.push(c?{key:s,values:c}:{key:s})};for(let s of e.keys??[])t(z[s],Q.has(s)&&typeof e.count=="number"?{count:e.count}:void 0);e.requestKey&&t(o(e.requestKey));let a=s=>{s!==void 0&&t(o(s?"requestedIntentApplied":"requestedIntentNotApplied"))};a(e.requestedTargetApplied);let r=e.savedDisposition;r&&t(o(r.phase==="left-known"?"leftKnown":"leftUnconfirmed"),r.phase==="left-known"?void 0:{count:r.count});let i=e.finalHistory;return i&&(i.relation&&t(Z[i.relation]),i.keptFact?.keepEffect==="forward-closed"&&t(o("keptForwardClosed")),a(i.requestedTargetApplied),i.contradictedAfterSeal?.length&&t(o("laterReportAfterKeep"))),n}var ne={user:"winnerStopUser","connection-lost":"winnerStopConnection","renewal-refused":"winnerStopRenewal","step-failed":"winnerStopStep","step-up-failed":"winnerStopStepUp","identity-lost":"winnerStopIdentity","attribution-missing":"winnerStopAttribution","plan-changed":"winnerStopChanged","adapter-configuration":"winnerStopAdapter"},O={stop:4,"cancel-initial":3,"cancel-review":3,keep:2,leave:1},V={stop:"stop",decline:"cancel-initial",leave:"leave",keep:"keep"},T={stop:o("checkIntentStatus"),"cancel-initial":o("checkIntentStatus"),"cancel-review":o("checkIntentStatus"),leave:o("checkSavedChoice"),keep:o("checkKeepStatus")},te={capabilityMissing:null,keepNoDecision:null,sealed:null,keepBlockedActive:o("keepReasonActive"),keepBlockedUnknown:o("keepReasonUnknown"),loading:o("actionLoading"),intentUnavailable:o("keepReasonUnavailable")},ae=new Set(["proposal","initial-review","cancelled"]),oe=new Set(["forward-active","readback","left-reopened","left-unconfirmed","completed","left-known"]),se=new Set(["forward-active","readback","left-reopened"]),re=new Set(["readback","left-reopened"]),b=(e,n,t)=>t?{id:e,labelKey:n,available:!1,reasonKey:t}:{id:e,labelKey:n,available:!0};function ie(e,n){let t=B(e,n),a=t?[t]:[];return n.state==="running"&&a.push(b("stop","chat.stop")),a}function B(e,n){let t=A(n,e.conversationId);if(n.state!=="awaiting-confirmation"||!t)return;let r={...b("confirm",t.schedule?"chat.confirmation.schedule":"chat.confirmation.apply",e.now>=Date.parse(t.expiresAt)?"chat.confirmation.expired":void 0),countedLabelKey:t.schedule?"chat.confirmation.scheduleCount":"chat.confirmation.applyCount",labelValues:{count:t.items.length}};return t.schedule?{...r,schedule:!0}:r}function le(e,n){let a=n.recovery.phase,r=[],i=a==="initial-review"&&B(e,n);if(i&&r.push(i),(a==="proposal"||a==="initial-review"||a==="forward-active")&&r.push(b("stop","chat.stop")),(a==="proposal"||a==="initial-review")&&r.push(b("decline","chat.cancel")),se.has(a)&&r.push(b("leave",o("leave"),e.capabilities.includes("plan-leave")?void 0:o("capabilityMissing"))),oe.has(a)){let s=e.keepReview;if(!("disabled"in s))r.push(b("keep",o("keepChanges")));else{let c=te[s.disabled];c&&r.push(b("keep",o("keepChanges"),c))}}if(re.has(a))for(let s of["undoSelected","continue"])r.push(b(s,o(s),o("notAvailableYet")));return r}function W(e,n){if(!(n?.retryAt===void 0||n.lastProblem?.cause!=="rate-limited"||e.now>=n.retryAt))return{seconds:Math.ceil((n.retryAt-e.now)/1e3)}}function N(e,n,t){let a=n,r=W(e,t);if(t){let s=r?{id:"status",labelKey:T[t.kind],available:!1,reasonKey:o("retryAfterSeconds"),reasonValues:r}:{id:"status",labelKey:T[t.kind],available:!0,busy:t.delivery==="sending"},c=!1;a=a.map(u=>V[u.id]===t.kind?(c=!0,s):u),c||(a=[...a,s])}let i=[...t?[t.kind]:[],...e.pending].map(s=>O[s]);if(i.length){let s=Math.max(...i);a=a.map(c=>{if(c.id==="status")return c;let u=V[c.id],l=c.id==="confirm"?0:u?O[u]:void 0;if(l===void 0||l>s)return c;let p=u&&e.pending.includes(u);return{...c,available:!1,reasonKey:o("intentPendingReason"),...p?{busy:!0}:{}}})}return e.conversationUnavailable&&(a=a.map(s=>({...s,available:!1,reasonKey:o("refreshConversation")}))),a}function U(e,n){let t=e.recovery,a=t.steps??[],r=s=>a.filter(c=>c.truth===s).length,i=(s,c)=>c?{key:o(s),values:c}:{key:o(s)};if(t.sealed)return{label:i("keptKnown"),tone:"neutral",attention:!1};switch(t.phase){case"proposal":return{label:i("statusProposal"),tone:"neutral",attention:!1};case"initial-review":return{label:i("heading"),tone:"neutral",attention:!1};case"forward-active":return{label:i(n?.kind==="stop"?"stopping":"currentRunning"),tone:"progress",attention:!1};case"readback":case"left-reopened":return{label:i("heading"),tone:"warning",attention:!0};case"completed":return{label:i("statusCompleted"),tone:"success",attention:!1};case"cancelled":return{label:i(r("done")?"currentStopped":"cancelledNoChanges"),tone:"neutral",attention:!1};case"left-known":return{label:i("leftKnown"),tone:"neutral",attention:!1};case"left-unconfirmed":return{label:i("leftUnconfirmed",{count:r("unknown")}),tone:"warning",attention:!1}}}function D(e){let n=e.plan;if(!n)return null;let t=!!n.recovery&&e.capabilities.includes("plan-recovery");if(n.recovery&&(e.readOnly||!t||n.recovery.profile!=="plan-recovery-v1"||!U(n,void 0)))return{planId:n.id,status:{dataStatus:n.recovery.phase,wireState:n.state,label:{key:o("heading")},tone:"neutral",attention:!1},intent:null,steps:[],lines:[{key:o("updateToControl")},{key:`chat.block.state.${n.state}`}],notice:[],alert:null,actions:[],pending:[],conversationUnavailable:e.conversationUnavailable,readOnly:!0};let a=e.overlay&&e.overlay.planId===n.id?e.overlay:void 0,r=e.notice&&(e.notice.planId??n.id)===n.id?ee(e.notice):[],i=e.alert,s=W(e,a),c=a?.lastProblem?.key,u=i&&a?{serial:i.serial,..."restoreFocus"in i?{restoreFocus:!0}:{action:i.action},...c&&x[c]?{message:{key:x[c]}}:{},retryAvailable:!s&&!e.conversationUnavailable,...e.conversationUnavailable?{retryReasonKey:o("refreshConversation")}:s?{retryReasonKey:o("retryAfterSeconds"),retryValues:s}:{}}:i&&"restoreFocus"in i?{serial:i.serial,restoreFocus:!0,retryAvailable:!0}:null;if(!t)return{planId:n.id,status:null,intent:null,steps:[],lines:[],notice:[],alert:null,actions:N({...e,pending:[]},ie(e,n),void 0),pending:[],conversationUnavailable:e.conversationUnavailable};let l=n.recovery,p=new Map(n.plan.kind==="immediate"?n.plan.steps.map((f,R)=>[f.id,{index:R+1,resource:f.resource}]):[]),v=new Set(l.contradictedAfterSeal??[]),h=l.phase==="forward-active",k=(l.steps??[]).map((f,R)=>({stepId:f.stepId,index:p.get(f.stepId)?.index??R+1,...p.get(f.stepId)?.resource!==void 0&&{resource:p.get(f.stepId).resource},truth:f.truth,textKey:o(f.truth==="done"?"done":f.truth==="not-done"?"notDone":h?"stepNotKnownYet":"unknown"),...l.sealed&&v.has(f.stepId)?{lateReport:"contradicted"}:{}})),g=[],w=k.filter(f=>f.truth==="unknown").length,I=k.filter(f=>f.truth==="not-done").length;!l.steps?.length&&!ae.has(l.phase)&&g.push({key:o("stepsNotKnownYet")});let m=!1;!l.sealed&&!h&&w&&(g.push({key:o("stepsUnknown"),values:{count:w}}),m=!0),!l.sealed&&l.phase==="completed"&&I&&(g.push({key:o("stepsNotDone"),values:{count:I}}),m=!0),l.sealed&&v.size&&(g.push({key:o("laterReportAfterKeep")}),m=!0);let d=l.winner;d?.kind==="stop"?(g.push({key:o(ne[d.cause])}),l.phase==="readback"&&g.push({key:o("stopped")})):d&&g.push({key:o(d.kind==="leave"?"winnerLeave":d.kind==="keep"?"winnerKeep":"winnerCancel")});let y=U(n,a);return{planId:n.id,status:{dataStatus:l.phase,wireState:n.state,label:y.label,tone:y.tone,attention:y.attention||m,...l.sealed?{result:"kept"}:{}},intent:a?{kind:a.kind,status:a.delivery}:null,steps:k,lines:g,notice:r,alert:u,actions:N(e,le(e,n),a),pending:e.pending,conversationUnavailable:e.conversationUnavailable}}function L(e,n){let t=e.review==="forward-only"?[{key:o("confirmKeepForwardOnly")},{key:o("keepRemainingSteps"),values:{count:e.remaining}}]:[{key:o("confirmEndRetention")}],a=n.conversationUnavailable?o("refreshConversation"):n.status?.result==="kept"?o("alreadyKept"):n.intent||n.pending.length?o("intentPendingReason"):void 0;return{messages:t,proceed:a?{available:!1,reasonKey:a}:{available:!0}}}import{createContext as ce,useContext as de,useRef as pe,useSyncExternalStore as q}from"react";var ue=ce(null);function S(e){let n=de(ue),t=e??n;if(!t)throw new Error("A client is required");return t}function Ae(e){let n=S(e);return q(n.subscribe,n.getSnapshot,n.getSnapshot)}function K(e,n=Object.is,t){let a=S(t),r=pe(void 0),i=()=>{let s=a.getSnapshot(),c=r.current;if(c&&c.snapshot===s&&c.selector===e)return c.value;let u=e(s);return c&&n(c.value,u)?(r.current={snapshot:s,selector:e,value:c.value},c.value):(r.current={snapshot:s,selector:e,value:u},u)};return q(a.subscribe,i,i)}var _=new WeakMap;function fe(e,n){let t=_.get(e);return t||(t=new Map(e.map(a=>[a.id,a])),_.set(e,t)),t.get(n)}function Ce(e,n){return K(t=>t.conversation?fe(t.conversation.messages,e):void 0,Object.is,n)}function j(e,n){let t=Object.keys(e);return t.length===Object.keys(n).length&&t.every(a=>Object.is(e[a],n[a]))}import{useCallback as F,useEffect as M,useState as P}from"react";var ye={disabled:"keepNoDecision"};function Ve(e){let n=S(e),t=K(d=>({plan:d.plan,intentOverlays:d.intentOverlays,conversationId:d.conversationId,capabilities:d.capabilities,conversationUnavailable:d.conversationUnavailable,intentNotice:d.intentNotice,intentAlert:d.intentAlert,planReadOnly:d.planReadOnly,keepReview:d.plan?n.keepChangesReview(d.plan.id):ye}),(d,y)=>j({...d,keepReview:0},{...y,keepReview:0})&&JSON.stringify(d.keepReview)===JSON.stringify(y.keepReview),n),a=t.plan,[r,i]=P([]),[s,c]=P(()=>Date.now()),[u,l]=P(null),p=a?.id;M(()=>{i([]),l(null)},[p]);let v=p?t.intentOverlays[p]:void 0,h=v?.retryAt;M(()=>{if(h===void 0)return;let d=h-Date.now();if(d<=0)return;let y=setTimeout(()=>c(Date.now()),d);return()=>clearTimeout(y)},[h]);let k=A(a,t.conversationId)?.expiresAt;M(()=>{if(!k)return;let d=Date.parse(k)-Date.now();if(!(d>0))return;let y=setTimeout(()=>c(Date.now()),d+1);return()=>clearTimeout(y)},[k]);let g=D({plan:a,capabilities:t.capabilities,conversationUnavailable:t.conversationUnavailable,overlay:v,notice:t.intentNotice,alert:t.intentAlert,keepReview:t.keepReview,pending:r,now:Math.max(s,Date.now()),conversationId:t.conversationId,readOnly:t.planReadOnly}),w=F((d,y)=>{i(f=>[...f,d]),y.finally(()=>i(f=>f.filter(R=>R!==d)))},[]),I=F(d=>{if(p)switch(d){case"confirm":n.confirmPlan();return;case"stop":{n.stopPlan(p);let y=n.getSnapshot();!y.planReadOnly&&!y.intentOverlays[p]&&w("stop",n.checkIntentStatus(p));return}case"decline":w("cancel-initial",n.declinePlan());return;case"leave":w("leave",n.leavePlan(p));return;case"keep":{let y=n.keepChangesReview(p);"disabled"in y||l(y);return}case"status":case"retry":n.checkIntentStatus(p);return}},[p,n,w]),m=u&&g?{...L(u,g),onProceed:()=>{let d=u;l(null),w("keep",n.keepChanges(d))},onCancel:()=>l(null)}:null;return{view:g,press:I,sheet:m}}import{useCallback as C,useSyncExternalStore as ge}from"react";var Y=new WeakMap,ve=e=>{let n=Y.get(e);return n||Y.set(e,n={cards:new Map,listeners:new Set}),n},$=(e,n,t)=>JSON.stringify([e,n,t]),E=new WeakMap,H=e=>{E.delete(e.cards);for(let n of e.listeners)n()},we=128,J=(e,n)=>{let t=n;for(let a=0;a<e.length;a++)t^=e.charCodeAt(a),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")},X=e=>J(e,2166136261)+J(e,731459039),he=e=>JSON.stringify(e,(n,t)=>t&&typeof t=="object"&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([a],[r])=>a<r?-1:1)):t),ke=e=>e.replace(/[^\w.~-]/g,n=>`%${(n.charCodeAt(0)+65536).toString(16).slice(1)}`);function be(e,n,t,a){let r=`card:${[e,n,t].map(ke).join(":")}:${X(he(a))}`;return r.length<=we?r:`card~${X(r)}`}function Be(e){let n=S(e),t=K(l=>l.conversationId,Object.is,n),a=ve(n),r=C(l=>(a.listeners.add(l),()=>a.listeners.delete(l)),[a]),i=C(()=>{let l=E.get(a.cards);l||E.set(a.cards,l=new Map);let p=l.get(t);return p||(p=new Set([...a.cards.values()].filter(v=>v.conversationId===t).map(v=>v.blockId)),l.set(t,p)),p},[a,t]),s=ge(r,i,i),c=C((l,p,v="")=>{let h=$(t,v,l.id);if(a.cards.has(h))return Promise.resolve();let k={...p,blockId:typeof p.blockId=="string"?p.blockId:l.id,clientReplyId:be(t,v,l.id,p)};a.cards.set(h,{conversationId:t,blockId:l.id}),H(a);let g=()=>{a.cards.delete(h),H(a)};return n.replyOutcome(k).then(w=>(w.accepted||g(),w),g)},[n,a,t]),u=C((l,p="")=>!!l.answered||a.cards.has($(t,p,l.id)),[a,t,s]);return{answered:s,isAnswered:u,reply:c}}var me={"sign-in":"chat.problem.signIn",retryable:"chat.problem.retryable","rate-limited":"chat.problem.rateLimited",refused:"chat.problem.refused",closed:"chat.problem.closed",full:"chat.problem.full",declined:"chat.problem.declined",unavailable:"chat.problem.unavailable","step-up-cancelled":"chat.problem.stepUp","invalid-read":"chat.problem.invalid","invalid-plan":"chat.problem.invalid","plan-changed":"chat.planChanged","update-required":"chat.update",mismatch:"chat.problem.mismatch","agreement-expired":"chat.problem.agreement","in-doubt":"chat.problem.inDoubt",replaced:"chat.problem.replaced","needs-attention":"chat.problem.needsAttention",stopped:"chat.stopped"},Se=e=>e.code==="replaced"?"refresh":["retryable","rate-limited","unavailable","agreement-expired"].includes(e.code)?"retry":void 0;function De(e,n={}){let t=e.id==="conversation-read"&&(e.code==="unavailable"||e.code==="retryable"),a=e.id==="conversation-unavailable"?"chat.conversationUnavailable":t?"chat.conversationReadFailed":n.answeredElsewhere?"chat.problem.answered":me[e.code]??"chat.failure",r=Se(e);return{key:a,...r&&{action:r},code:e.code,id:e.id}}function Le(e,n={}){if(e==="none")return{actions:[]};let t={id:"retry",labelKey:"chat.retry"};return{key:`reply.${e}`,actions:e==="overdue"?[{id:"keepWaiting",labelKey:"chat.reply.keepWaiting"},t]:e==="writing"?n.canStop?[{id:"stop",labelKey:"chat.reply.stop"}]:[]:n.canRetry===!1?[]:[t]}}export{ee as a,D as b,L as c,ue as d,Ae as e,K as f,Ce as g,j as h,Ve as i,be as j,Be as k,Se as l,De as m,Le as n};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var W=function(e,t){return W=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},W(e,t)};function w(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");W(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var c=function(){return c=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},c.apply(this,arguments)};function ae(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function V(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function j(e,t){var n=t&&t.cache?t.cache:Ge,r=t&&t.serializer?t.serializer:Re,i=t&&t.strategy?t.strategy:Le;return i(e,{cache:n,serializer:r})}function Ie(e){return e==null||typeof e=="number"||typeof e=="boolean"}function se(e,t,n,r){var i=Ie(r)?r:n(r),o=t.get(i);return typeof o>"u"&&(o=e.call(this,r),t.set(i,o)),o}function he(e,t,n){var r=Array.prototype.slice.call(arguments,3),i=n(r),o=t.get(i);return typeof o>"u"&&(o=e.apply(this,r),t.set(i,o)),o}function z(e,t,n,r,i){return n.bind(t,e,r,i)}function Le(e,t){var n=e.length===1?se:he;return z(e,this,n,t.cache.create(),t.serializer)}function Oe(e,t){return z(e,this,he,t.cache.create(),t.serializer)}function Ce(e,t){return z(e,this,se,t.cache.create(),t.serializer)}var Re=function(){return JSON.stringify(arguments)},Me=(function(){function e(){this.cache=Object.create(null)}return e.prototype.get=function(t){return this.cache[t]},e.prototype.set=function(t,n){this.cache[t]=n},e})(),Ge={create:function(){return new Me}},X={variadic:Oe,monadic:Ce};var l;(function(e){e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",e[e.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",e[e.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",e[e.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",e[e.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",e[e.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",e[e.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",e[e.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",e[e.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",e[e.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",e[e.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",e[e.INVALID_TAG=23]="INVALID_TAG",e[e.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",e[e.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",e[e.UNCLOSED_TAG=27]="UNCLOSED_TAG"})(l||(l={}));var b;(function(e){e[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural",e[e.pound=7]="pound",e[e.tag=8]="tag"})(b||(b={}));var T;(function(e){e[e.number=0]="number",e[e.dateTime=1]="dateTime"})(T||(T={}));function Z(e){return e.type===b.literal}function Y(e){return e.type===b.argument}function N(e){return e.type===b.number}function I(e){return e.type===b.date}function L(e){return e.type===b.time}function O(e){return e.type===b.select}function C(e){return e.type===b.plural}function ue(e){return e.type===b.pound}function R(e){return e.type===b.tag}function k(e){return!!(e&&typeof e=="object"&&e.type===T.number)}function M(e){return!!(e&&typeof e=="object"&&e.type===T.dateTime)}var J=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/;var De=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function fe(e){var t={};return e.replace(De,function(n){var r=n.length;switch(n[0]){case"G":t.era=r===4?"long":r===5?"narrow":"short";break;case"y":t.year=r===2?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":t.month=["numeric","2-digit","short","long","narrow"][r-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":t.day=["numeric","2-digit"][r-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":t.weekday=r===4?"long":r===5?"narrow":"short";break;case"e":if(r<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][r-4];break;case"c":if(r<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][r-4];break;case"a":t.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":t.hourCycle="h12",t.hour=["numeric","2-digit"][r-1];break;case"H":t.hourCycle="h23",t.hour=["numeric","2-digit"][r-1];break;case"K":t.hourCycle="h11",t.hour=["numeric","2-digit"][r-1];break;case"k":t.hourCycle="h24",t.hour=["numeric","2-digit"][r-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":t.minute=["numeric","2-digit"][r-1];break;case"s":t.second=["numeric","2-digit"][r-1];break;case"S":case"A":throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":t.timeZoneName=r<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""}),t}var le=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;function xe(e){if(e.length===0)throw new Error("Number skeleton cannot be empty");for(var t=e.split(le).filter(function(f){return f.length>0}),n=[],r=0,i=t;r<i.length;r++){var o=i[r],a=o.split("/");if(a.length===0)throw new Error("Invalid number skeleton");for(var h=a[0],x=a.slice(1),u=0,s=x;u<s.length;u++){var m=s[u];if(m.length===0)throw new Error("Invalid number skeleton")}n.push({stem:h,options:x})}return n}function Ue(e){return e.replace(/^(.*?)-/,"")}var ce=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,be=/^(@+)?(\+|#+)?[rs]?$/g,Fe=/(\*)(0+)|(#+)(0+)|(0+)/g,Ee=/^(0+)$/;function pe(e){var t={};return e[e.length-1]==="r"?t.roundingPriority="morePrecision":e[e.length-1]==="s"&&(t.roundingPriority="lessPrecision"),e.replace(be,function(n,r,i){return typeof i!="string"?(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length):i==="+"?t.minimumSignificantDigits=r.length:r[0]==="#"?t.maximumSignificantDigits=r.length:(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length+(typeof i=="string"?i.length:0)),""}),t}function ye(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function Ve(e){var t;if(e[0]==="E"&&e[1]==="E"?(t={notation:"engineering"},e=e.slice(2)):e[0]==="E"&&(t={notation:"scientific"},e=e.slice(1)),t){var n=e.slice(0,2);if(n==="+!"?(t.signDisplay="always",e=e.slice(2)):n==="+?"&&(t.signDisplay="exceptZero",e=e.slice(2)),!Ee.test(e))throw new Error("Malformed concise eng/scientific notation");t.minimumIntegerDigits=e.length}return t}function me(e){var t={},n=ye(e);return n||t}function ve(e){for(var t={},n=0,r=e;n<r.length;n++){var i=r[n];switch(i.stem){case"percent":case"%":t.style="percent";continue;case"%x100":t.style="percent",t.scale=100;continue;case"currency":t.style="currency",t.currency=i.options[0];continue;case"group-off":case",_":t.useGrouping=!1;continue;case"precision-integer":case".":t.maximumFractionDigits=0;continue;case"measure-unit":case"unit":t.style="unit",t.unit=Ue(i.options[0]);continue;case"compact-short":case"K":t.notation="compact",t.compactDisplay="short";continue;case"compact-long":case"KK":t.notation="compact",t.compactDisplay="long";continue;case"scientific":t=c(c(c({},t),{notation:"scientific"}),i.options.reduce(function(x,u){return c(c({},x),me(u))},{}));continue;case"engineering":t=c(c(c({},t),{notation:"engineering"}),i.options.reduce(function(x,u){return c(c({},x),me(u))},{}));continue;case"notation-simple":t.notation="standard";continue;case"unit-width-narrow":t.currencyDisplay="narrowSymbol",t.unitDisplay="narrow";continue;case"unit-width-short":t.currencyDisplay="code",t.unitDisplay="short";continue;case"unit-width-full-name":t.currencyDisplay="name",t.unitDisplay="long";continue;case"unit-width-iso-code":t.currencyDisplay="symbol";continue;case"scale":t.scale=parseFloat(i.options[0]);continue;case"rounding-mode-floor":t.roundingMode="floor";continue;case"rounding-mode-ceiling":t.roundingMode="ceil";continue;case"rounding-mode-down":t.roundingMode="trunc";continue;case"rounding-mode-up":t.roundingMode="expand";continue;case"rounding-mode-half-even":t.roundingMode="halfEven";continue;case"rounding-mode-half-down":t.roundingMode="halfTrunc";continue;case"rounding-mode-half-up":t.roundingMode="halfExpand";continue;case"integer-width":if(i.options.length>1)throw new RangeError("integer-width stems only accept a single optional option");i.options[0].replace(Fe,function(x,u,s,m,f,E){if(u)t.minimumIntegerDigits=s.length;else{if(m&&f)throw new Error("We currently do not support maximum integer digits");if(E)throw new Error("We currently do not support exact integer digits")}return""});continue}if(Ee.test(i.stem)){t.minimumIntegerDigits=i.stem.length;continue}if(ce.test(i.stem)){if(i.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");i.stem.replace(ce,function(x,u,s,m,f,E){return s==="*"?t.minimumFractionDigits=u.length:m&&m[0]==="#"?t.maximumFractionDigits=m.length:f&&E?(t.minimumFractionDigits=f.length,t.maximumFractionDigits=f.length+E.length):(t.minimumFractionDigits=u.length,t.maximumFractionDigits=u.length),""});var o=i.options[0];o==="w"?t=c(c({},t),{trailingZeroDisplay:"stripIfInteger"}):o&&(t=c(c({},t),pe(o)));continue}if(be.test(i.stem)){t=c(c({},t),pe(i.stem));continue}var a=ye(i.stem);a&&(t=c(c({},t),a));var h=Ve(i.stem);h&&(t=c(c({},t),h))}return t}var G={"001":["H","h"],419:["h","H","hB","hb"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["h","H","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["h","H","hB","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["h","H","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["h","H","hB","hb"],CU:["h","H","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["h","H","hB","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GT:["h","H","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["h","H","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["h","H","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["h","H","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["h","H","hB","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["h","H","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["h","H","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["h","H","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"en-HK":["h","hb","H","hB"],"en-IL":["H","h","hb","hB"],"en-MY":["h","hb","H","hB"],"es-BR":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]};function ge(e,t){for(var n="",r=0;r<e.length;r++){var i=e.charAt(r);if(i==="j"){for(var o=0;r+1<e.length&&e.charAt(r+1)===i;)o++,r++;var a=1+(o&1),h=o<2?1:3+(o>>1),x="a",u=je(t);for((u=="H"||u=="k")&&(h=0);h-- >0;)n+=x;for(;a-- >0;)n=u+n}else i==="J"?n+="H":n+=i}return n}function je(e){var t=e.hourCycle;if(t===void 0&&e.hourCycles&&e.hourCycles.length&&(t=e.hourCycles[0]),t)switch(t){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}var n=e.language,r;n!=="root"&&(r=e.maximize().region);var i=G[r||""]||G[n||""]||G["".concat(n,"-001")]||G["001"];return i[0]}var Q,Xe=new RegExp("^".concat(J.source,"*")),ke=new RegExp("".concat(J.source,"*$"));function p(e,t){return{start:e,end:t}}var We=!!String.prototype.startsWith&&"_a".startsWith("a",1),ze=!!String.fromCodePoint,Ze=!!Object.fromEntries,Ye=!!String.prototype.codePointAt,Je=!!String.prototype.trimStart,Qe=!!String.prototype.trimEnd,qe=!!Number.isSafeInteger,$e=qe?Number.isSafeInteger:function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},$=!0;try{de=Se("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu"),$=((Q=de.exec("a"))===null||Q===void 0?void 0:Q[0])==="a"}catch (e2){$=!1}var de,_e=We?function(t,n,r){return t.startsWith(n,r)}:function(t,n,r){return t.slice(r,r+n.length)===n},K=ze?String.fromCodePoint:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r="",i=t.length,o=0,a;i>o;){if(a=t[o++],a>1114111)throw RangeError(a+" is not a valid code point");r+=a<65536?String.fromCharCode(a):String.fromCharCode(((a-=65536)>>10)+55296,a%1024+56320)}return r},He=Ze?Object.fromEntries:function(t){for(var n={},r=0,i=t;r<i.length;r++){var o=i[r],a=o[0],h=o[1];n[a]=h}return n},Te=Ye?function(t,n){return t.codePointAt(n)}:function(t,n){var r=t.length;if(!(n<0||n>=r)){var i=t.charCodeAt(n),o;return i<55296||i>56319||n+1===r||(o=t.charCodeAt(n+1))<56320||o>57343?i:(i-55296<<10)+(o-56320)+65536}},Ke=Je?function(t){return t.trimStart()}:function(t){return t.replace(Xe,"")},et=Qe?function(t){return t.trimEnd()}:function(t){return t.replace(ke,"")};function Se(e,t){return new RegExp(e,t)}var ee;$?(q=Se("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu"),ee=function(t,n){var r;q.lastIndex=n;var i=q.exec(t);return(r=i[1])!==null&&r!==void 0?r:""}):ee=function(t,n){for(var r=[];;){var i=Te(t,n);if(i===void 0||Ae(i)||nt(i))break;r.push(i),n+=i>=65536?2:1}return K.apply(void 0,r)};var q,Be=(function(){function e(t,n){n===void 0&&(n={}),this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!n.ignoreTag,this.locale=n.locale,this.requiresOtherClause=!!n.requiresOtherClause,this.shouldParseSkeletons=!!n.shouldParseSkeletons}return e.prototype.parse=function(){if(this.offset()!==0)throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(t,n,r){for(var i=[];!this.isEOF();){var o=this.char();if(o===123){var a=this.parseArgument(t,r);if(a.err)return a;i.push(a.val)}else{if(o===125&&t>0)break;if(o===35&&(n==="plural"||n==="selectordinal")){var h=this.clonePosition();this.bump(),i.push({type:b.pound,location:p(h,this.clonePosition())})}else if(o===60&&!this.ignoreTag&&this.peek()===47){if(r)break;return this.error(l.UNMATCHED_CLOSING_TAG,p(this.clonePosition(),this.clonePosition()))}else if(o===60&&!this.ignoreTag&&te(this.peek()||0)){var a=this.parseTag(t,n);if(a.err)return a;i.push(a.val)}else{var a=this.parseLiteral(t,n);if(a.err)return a;i.push(a.val)}}}return{val:i,err:null}},e.prototype.parseTag=function(t,n){var r=this.clonePosition();this.bump();var i=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:b.literal,value:"<".concat(i,"/>"),location:p(r,this.clonePosition())},err:null};if(this.bumpIf(">")){var o=this.parseMessage(t+1,n,!0);if(o.err)return o;var a=o.val,h=this.clonePosition();if(this.bumpIf("</")){if(this.isEOF()||!te(this.char()))return this.error(l.INVALID_TAG,p(h,this.clonePosition()));var x=this.clonePosition(),u=this.parseTagName();return i!==u?this.error(l.UNMATCHED_CLOSING_TAG,p(x,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:b.tag,value:i,children:a,location:p(r,this.clonePosition())},err:null}:this.error(l.INVALID_TAG,p(h,this.clonePosition())))}else return this.error(l.UNCLOSED_TAG,p(r,this.clonePosition()))}else return this.error(l.INVALID_TAG,p(r,this.clonePosition()))},e.prototype.parseTagName=function(){var t=this.offset();for(this.bump();!this.isEOF()&&rt(this.char());)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(t,n){for(var r=this.clonePosition(),i="";;){var o=this.tryParseQuote(n);if(o){i+=o;continue}var a=this.tryParseUnquoted(t,n);if(a){i+=a;continue}var h=this.tryParseLeftAngleBracket();if(h){i+=h;continue}break}var x=p(r,this.clonePosition());return{val:{type:b.literal,value:i,location:x},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!tt(this.peek()||0))?(this.bump(),"<"):null},e.prototype.tryParseQuote=function(t){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(t==="plural"||t==="selectordinal")break;return null;default:return null}this.bump();var n=[this.char()];for(this.bump();!this.isEOF();){var r=this.char();if(r===39)if(this.peek()===39)n.push(39),this.bump();else{this.bump();break}else n.push(r);this.bump()}return K.apply(void 0,n)},e.prototype.tryParseUnquoted=function(t,n){if(this.isEOF())return null;var r=this.char();return r===60||r===123||r===35&&(n==="plural"||n==="selectordinal")||r===125&&t>0?null:(this.bump(),K(r))},e.prototype.parseArgument=function(t,n){var r=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(l.EXPECT_ARGUMENT_CLOSING_BRACE,p(r,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(l.EMPTY_ARGUMENT,p(r,this.clonePosition()));var i=this.parseIdentifierIfPossible().value;if(!i)return this.error(l.MALFORMED_ARGUMENT,p(r,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(l.EXPECT_ARGUMENT_CLOSING_BRACE,p(r,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:b.argument,value:i,location:p(r,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(l.EXPECT_ARGUMENT_CLOSING_BRACE,p(r,this.clonePosition())):this.parseArgumentOptions(t,n,i,r);default:return this.error(l.MALFORMED_ARGUMENT,p(r,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var t=this.clonePosition(),n=this.offset(),r=ee(this.message,n),i=n+r.length;this.bumpTo(i);var o=this.clonePosition(),a=p(t,o);return{value:r,location:a}},e.prototype.parseArgumentOptions=function(t,n,r,i){var o,a=this.clonePosition(),h=this.parseIdentifierIfPossible().value,x=this.clonePosition();switch(h){case"":return this.error(l.EXPECT_ARGUMENT_TYPE,p(a,x));case"number":case"date":case"time":{this.bumpSpace();var u=null;if(this.bumpIf(",")){this.bumpSpace();var s=this.clonePosition(),m=this.parseSimpleArgStyleIfPossible();if(m.err)return m;var f=et(m.val);if(f.length===0)return this.error(l.EXPECT_ARGUMENT_STYLE,p(this.clonePosition(),this.clonePosition()));var E=p(s,this.clonePosition());u={style:f,styleLocation:E}}var v=this.tryParseArgumentClose(i);if(v.err)return v;var g=p(i,this.clonePosition());if(u&&_e(_optionalChain([u, 'optionalAccess', _2 => _2.style]),"::",0)){var _=Ke(u.style.slice(2));if(h==="number"){var m=this.parseNumberSkeletonFromString(_,u.styleLocation);return m.err?m:{val:{type:b.number,value:r,location:g,style:m.val},err:null}}else{if(_.length===0)return this.error(l.EXPECT_DATE_TIME_SKELETON,g);var A=_;this.locale&&(A=ge(_,this.locale));var f={type:T.dateTime,pattern:A,location:u.styleLocation,parsedOptions:this.shouldParseSkeletons?fe(A):{}},B=h==="date"?b.date:b.time;return{val:{type:B,value:r,location:g,style:f},err:null}}}return{val:{type:h==="number"?b.number:h==="date"?b.date:b.time,value:r,location:g,style:(o=_optionalChain([u, 'optionalAccess', _3 => _3.style]))!==null&&o!==void 0?o:null},err:null}}case"plural":case"selectordinal":case"select":{var d=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(l.EXPECT_SELECT_ARGUMENT_OPTIONS,p(d,c({},d)));this.bumpSpace();var P=this.parseIdentifierIfPossible(),H=0;if(h!=="select"&&P.value==="offset"){if(!this.bumpIf(":"))return this.error(l.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,p(this.clonePosition(),this.clonePosition()));this.bumpSpace();var m=this.tryParseDecimalInteger(l.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,l.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(m.err)return m;this.bumpSpace(),P=this.parseIdentifierIfPossible(),H=m.val}var F=this.tryParsePluralOrSelectOptions(t,h,n,P);if(F.err)return F;var v=this.tryParseArgumentClose(i);if(v.err)return v;var oe=p(i,this.clonePosition());return h==="select"?{val:{type:b.select,value:r,options:He(F.val),location:oe},err:null}:{val:{type:b.plural,value:r,options:He(F.val),offset:H,pluralType:h==="plural"?"cardinal":"ordinal",location:oe},err:null}}default:return this.error(l.INVALID_ARGUMENT_TYPE,p(a,x))}},e.prototype.tryParseArgumentClose=function(t){return this.isEOF()||this.char()!==125?this.error(l.EXPECT_ARGUMENT_CLOSING_BRACE,p(t,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var t=0,n=this.clonePosition();!this.isEOF();){var r=this.char();switch(r){case 39:{this.bump();var i=this.clonePosition();if(!this.bumpUntil("'"))return this.error(l.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,p(i,this.clonePosition()));this.bump();break}case 123:{t+=1,this.bump();break}case 125:{if(t>0)t-=1;else return{val:this.message.slice(n.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(n.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(t,n){var r=[];try{r=xe(t)}catch (e3){return this.error(l.INVALID_NUMBER_SKELETON,n)}return{val:{type:T.number,tokens:r,location:n,parsedOptions:this.shouldParseSkeletons?ve(r):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(t,n,r,i){for(var o,a=!1,h=[],x=new Set,u=i.value,s=i.location;;){if(u.length===0){var m=this.clonePosition();if(n!=="select"&&this.bumpIf("=")){var f=this.tryParseDecimalInteger(l.EXPECT_PLURAL_ARGUMENT_SELECTOR,l.INVALID_PLURAL_ARGUMENT_SELECTOR);if(f.err)return f;s=p(m,this.clonePosition()),u=this.message.slice(m.offset,this.offset())}else break}if(x.has(u))return this.error(n==="select"?l.DUPLICATE_SELECT_ARGUMENT_SELECTOR:l.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,s);u==="other"&&(a=!0),this.bumpSpace();var E=this.clonePosition();if(!this.bumpIf("{"))return this.error(n==="select"?l.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:l.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,p(this.clonePosition(),this.clonePosition()));var v=this.parseMessage(t+1,n,r);if(v.err)return v;var g=this.tryParseArgumentClose(E);if(g.err)return g;h.push([u,{value:v.val,location:p(E,this.clonePosition())}]),x.add(u),this.bumpSpace(),o=this.parseIdentifierIfPossible(),u=o.value,s=o.location}return h.length===0?this.error(n==="select"?l.EXPECT_SELECT_ARGUMENT_SELECTOR:l.EXPECT_PLURAL_ARGUMENT_SELECTOR,p(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!a?this.error(l.MISSING_OTHER_CLAUSE,p(this.clonePosition(),this.clonePosition())):{val:h,err:null}},e.prototype.tryParseDecimalInteger=function(t,n){var r=1,i=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(r=-1);for(var o=!1,a=0;!this.isEOF();){var h=this.char();if(h>=48&&h<=57)o=!0,a=a*10+(h-48),this.bump();else break}var x=p(i,this.clonePosition());return o?(a*=r,$e(a)?{val:a,err:null}:this.error(n,x)):this.error(t,x)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var t=this.position.offset;if(t>=this.message.length)throw Error("out of bound");var n=Te(this.message,t);if(n===void 0)throw Error("Offset ".concat(t," is at invalid UTF-16 code unit boundary"));return n},e.prototype.error=function(t,n){return{val:null,err:{kind:t,message:this.message,location:n}}},e.prototype.bump=function(){if(!this.isEOF()){var t=this.char();t===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=t<65536?1:2)}},e.prototype.bumpIf=function(t){if(_e(this.message,t,this.offset())){for(var n=0;n<t.length;n++)this.bump();return!0}return!1},e.prototype.bumpUntil=function(t){var n=this.offset(),r=this.message.indexOf(t,n);return r>=0?(this.bumpTo(r),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(t){if(this.offset()>t)throw Error("targetOffset ".concat(t," must be greater than or equal to the current offset ").concat(this.offset()));for(t=Math.min(t,this.message.length);;){var n=this.offset();if(n===t)break;if(n>t)throw Error("targetOffset ".concat(t," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&Ae(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var t=this.char(),n=this.offset(),r=this.message.charCodeAt(n+(t>=65536?2:1));return _nullishCoalesce(r, () => (null))},e})();function te(e){return e>=97&&e<=122||e>=65&&e<=90}function tt(e){return te(e)||e===47}function rt(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function Ae(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function nt(e){return e>=33&&e<=35||e===36||e>=37&&e<=39||e===40||e===41||e===42||e===43||e===44||e===45||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||e===91||e===92||e===93||e===94||e===96||e===123||e===124||e===125||e===126||e===161||e>=162&&e<=165||e===166||e===167||e===169||e===171||e===172||e===174||e===176||e===177||e===182||e===187||e===191||e===215||e===247||e>=8208&&e<=8213||e>=8214&&e<=8215||e===8216||e===8217||e===8218||e>=8219&&e<=8220||e===8221||e===8222||e===8223||e>=8224&&e<=8231||e>=8240&&e<=8248||e===8249||e===8250||e>=8251&&e<=8254||e>=8257&&e<=8259||e===8260||e===8261||e===8262||e>=8263&&e<=8273||e===8274||e===8275||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||e===8608||e>=8609&&e<=8610||e===8611||e>=8612&&e<=8613||e===8614||e>=8615&&e<=8621||e===8622||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||e===8658||e===8659||e===8660||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||e===8968||e===8969||e===8970||e===8971||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||e===9001||e===9002||e>=9003&&e<=9083||e===9084||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||e===9655||e>=9656&&e<=9664||e===9665||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||e===9839||e>=9840&&e<=10087||e===10088||e===10089||e===10090||e===10091||e===10092||e===10093||e===10094||e===10095||e===10096||e===10097||e===10098||e===10099||e===10100||e===10101||e>=10132&&e<=10175||e>=10176&&e<=10180||e===10181||e===10182||e>=10183&&e<=10213||e===10214||e===10215||e===10216||e===10217||e===10218||e===10219||e===10220||e===10221||e===10222||e===10223||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||e===10627||e===10628||e===10629||e===10630||e===10631||e===10632||e===10633||e===10634||e===10635||e===10636||e===10637||e===10638||e===10639||e===10640||e===10641||e===10642||e===10643||e===10644||e===10645||e===10646||e===10647||e===10648||e>=10649&&e<=10711||e===10712||e===10713||e===10714||e===10715||e>=10716&&e<=10747||e===10748||e===10749||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||e===11158||e>=11159&&e<=11263||e>=11776&&e<=11777||e===11778||e===11779||e===11780||e===11781||e>=11782&&e<=11784||e===11785||e===11786||e===11787||e===11788||e===11789||e>=11790&&e<=11798||e===11799||e>=11800&&e<=11801||e===11802||e===11803||e===11804||e===11805||e>=11806&&e<=11807||e===11808||e===11809||e===11810||e===11811||e===11812||e===11813||e===11814||e===11815||e===11816||e===11817||e>=11818&&e<=11822||e===11823||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||e===11840||e===11841||e===11842||e>=11843&&e<=11855||e>=11856&&e<=11857||e===11858||e>=11859&&e<=11903||e>=12289&&e<=12291||e===12296||e===12297||e===12298||e===12299||e===12300||e===12301||e===12302||e===12303||e===12304||e===12305||e>=12306&&e<=12307||e===12308||e===12309||e===12310||e===12311||e===12312||e===12313||e===12314||e===12315||e===12316||e===12317||e>=12318&&e<=12319||e===12320||e===12336||e===64830||e===64831||e>=65093&&e<=65094}function re(e){e.forEach(function(t){if(delete t.location,O(t)||C(t))for(var n in t.options)delete t.options[n].location,re(t.options[n].value);else N(t)&&k(t.style)||(I(t)||L(t))&&M(t.style)?delete t.style.location:R(t)&&re(t.children)})}function Pe(e,t){t===void 0&&(t={}),t=c({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var n=new Be(e,t).parse();if(n.err){var r=SyntaxError(l[n.err.kind]);throw r.location=n.err.location,r.originalMessage=n.err.message,r}return _optionalChain([t, 'optionalAccess', _4 => _4.captureLocation])||re(n.val),n.val}var S;(function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"})(S||(S={}));var D=(function(e){w(t,e);function t(n,r,i){var o=e.call(this,n)||this;return o.code=r,o.originalMessage=i,o}return t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t})(Error);var ne=(function(e){w(t,e);function t(n,r,i,o){return e.call(this,'Invalid values for "'.concat(n,'": "').concat(r,'". Options are "').concat(Object.keys(i).join('", "'),'"'),S.INVALID_VALUE,o)||this}return t})(D);var we=(function(e){w(t,e);function t(n,r,i){return e.call(this,'Value for "'.concat(n,'" must be of type ').concat(r),S.INVALID_VALUE,i)||this}return t})(D);var Ne=(function(e){w(t,e);function t(n,r){return e.call(this,'The intl string context variable "'.concat(n,'" was not provided to the string "').concat(r,'"'),S.MISSING_VALUE,r)||this}return t})(D);var y;(function(e){e[e.literal=0]="literal",e[e.object=1]="object"})(y||(y={}));function it(e){return e.length<2?e:e.reduce(function(t,n){var r=t[t.length-1];return!r||r.type!==y.literal||n.type!==y.literal?t.push(n):r.value+=n.value,t},[])}function ot(e){return typeof e=="function"}function U(e,t,n,r,i,o,a){if(e.length===1&&Z(e[0]))return[{type:y.literal,value:e[0].value}];for(var h=[],x=0,u=e;x<u.length;x++){var s=u[x];if(Z(s)){h.push({type:y.literal,value:s.value});continue}if(ue(s)){typeof o=="number"&&h.push({type:y.literal,value:n.getNumberFormat(t).format(o)});continue}var m=s.value;if(!(i&&m in i))throw new Ne(m,a);var f=i[m];if(Y(s)){(!f||typeof f=="string"||typeof f=="number")&&(f=typeof f=="string"||typeof f=="number"?String(f):""),h.push({type:typeof f=="string"?y.literal:y.object,value:f});continue}if(I(s)){var E=typeof s.style=="string"?r.date[s.style]:M(s.style)?s.style.parsedOptions:void 0;h.push({type:y.literal,value:n.getDateTimeFormat(t,E).format(f)});continue}if(L(s)){var E=typeof s.style=="string"?r.time[s.style]:M(s.style)?s.style.parsedOptions:r.time.medium;h.push({type:y.literal,value:n.getDateTimeFormat(t,E).format(f)});continue}if(N(s)){var E=typeof s.style=="string"?r.number[s.style]:k(s.style)?s.style.parsedOptions:void 0;E&&E.scale&&(f=f*(E.scale||1)),h.push({type:y.literal,value:n.getNumberFormat(t,E).format(f)});continue}if(R(s)){var v=s.children,g=s.value,_=i[g];if(!ot(_))throw new we(g,"function",a);var A=U(v,t,n,r,i,o),B=_(A.map(function(H){return H.value}));Array.isArray(B)||(B=[B]),h.push.apply(h,B.map(function(H){return{type:typeof H=="string"?y.literal:y.object,value:H}}))}if(O(s)){var d=s.options[f]||s.options.other;if(!d)throw new ne(s.value,f,Object.keys(s.options),a);h.push.apply(h,U(d.value,t,n,r,i));continue}if(C(s)){var d=s.options["=".concat(f)];if(!d){if(!Intl.PluralRules)throw new D(`Intl.PluralRules is not available in this environment.
|
|
2
|
+
Try polyfilling it using "@formatjs/intl-pluralrules"
|
|
3
|
+
`,S.MISSING_INTL_API,a);var P=n.getPluralRules(t,{type:s.pluralType}).select(f-(s.offset||0));d=s.options[P]||s.options.other}if(!d)throw new ne(s.value,f,Object.keys(s.options),a);h.push.apply(h,U(d.value,t,n,r,i,f-(s.offset||0)));continue}}return it(h)}function at(e,t){return t?c(c(c({},e||{}),t||{}),Object.keys(e).reduce(function(n,r){return n[r]=c(c({},e[r]),t[r]||{}),n},{})):e}function st(e,t){return t?Object.keys(e).reduce(function(n,r){return n[r]=at(e[r],t[r]),n},c({},e)):e}function ie(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,n){e[t]=n}}}}}function ht(e){return e===void 0&&(e={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:j(function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return new((t=Intl.NumberFormat).bind.apply(t,V([void 0],n,!1)))},{cache:ie(e.number),strategy:X.variadic}),getDateTimeFormat:j(function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return new((t=Intl.DateTimeFormat).bind.apply(t,V([void 0],n,!1)))},{cache:ie(e.dateTime),strategy:X.variadic}),getPluralRules:j(function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return new((t=Intl.PluralRules).bind.apply(t,V([void 0],n,!1)))},{cache:ie(e.pluralRules),strategy:X.variadic})}}var ut=(function(){function e(t,n,r,i){n===void 0&&(n=e.defaultLocale);var o=this;if(this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(u){var s=o.formatToParts(u);if(s.length===1)return s[0].value;var m=s.reduce(function(f,E){return!f.length||E.type!==y.literal||typeof f[f.length-1]!="string"?f.push(E.value):f[f.length-1]+=E.value,f},[]);return m.length<=1?m[0]||"":m},this.formatToParts=function(u){return U(o.ast,o.locales,o.formatters,o.formats,u,void 0,o.message)},this.resolvedOptions=function(){var u;return{locale:((u=o.resolvedLocale)===null||u===void 0?void 0:u.toString())||Intl.NumberFormat.supportedLocalesOf(o.locales)[0]}},this.getAst=function(){return o.ast},this.locales=n,this.resolvedLocale=e.resolveLocale(n),typeof t=="string"){if(this.message=t,!e.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");var a=i||{},h=a.formatters,x=ae(a,["formatters"]);this.ast=e.__parse(t,c(c({},x),{locale:this.resolvedLocale}))}else this.ast=t;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");this.formats=st(e.formats,r),this.formatters=i&&i.formatters||ht(this.formatterCache)}return Object.defineProperty(e,"defaultLocale",{get:function(){return e.memoizedDefaultLocale||(e.memoizedDefaultLocale=new Intl.NumberFormat().resolvedOptions().locale),e.memoizedDefaultLocale},enumerable:!1,configurable:!0}),e.memoizedDefaultLocale=null,e.resolveLocale=function(t){if(!(typeof Intl.Locale>"u")){var n=Intl.NumberFormat.supportedLocalesOf(t);return n.length>0?new Intl.Locale(n[0]):new Intl.Locale(typeof t=="string"?t:t[0])}},e.__parse=Pe,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e})();function ir(e,t){try{return Intl.getCanonicalLocales(e)[0]}catch (e4){return t?"zh-Hans":"en"}}exports.a = ut; exports.b = ir;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk3KV7TDDRcjs = require('./chunk-3KV7TDDR.cjs');var o=e=>`chat.recovery.${e}`,G=["alreadyClosedByWinner","alreadyKept","alreadyStoppedNeedsDecision","cancelStarted","cancelledNoChanges","capabilityMissing","currentStopped","initialTargetSettled","initialTargetStopped","intentSuperseded","keepReasonChanged","keptForwardClosed","leaveCompletedByKeep","leaveCoveredByKeep","leaveNeedsReview","leaveSafetyNeedsReview","leftKnown","leftUnconfirmed","planClosedKept","reviewTargetSettled","reviewTargetStopped","stopped","stoppedNoChanges","acknowledgmentAhead","cancelCoveredByLeaveSafety","cancelCoveredByStopNoChanges","cancelDefeatedByStop","choiceReplacedByStop","initialTargetClosed","keepDefeatedByWinner","leaveDefeatedByWinner","leaveNoDecision","leaveSafetyAlreadyStopped","reopenedEvidence"],z={...Object.fromEntries(G.map(e=>[e,o(e)])),alreadyClosed:o("alreadyClosedByWinner"),acknowledgmentStale:o("keepReasonChanged"),intentConflict:o("intentTargetChanged"),invalidTarget:o("intentTargetChanged"),intentUnavailable:o("keepReasonUnavailable"),keepBlockedActive:o("keepReasonActive"),keepBlockedUnknown:o("keepReasonUnknown"),keepBlockedReview:o("keepReasonPreview"),keepNoDecision:o("keepReasonNoSource"),planSealed:o("alreadyKept"),keptElsewhere:o("keptAlready")},x={...Object.fromEntries(["stopNotSent","stopNotSentElsewhere","stopUnconfirmed","leaveNotSent","leaveUnconfirmed","keepNotSent","keepUnconfirmed"].map(e=>[e,o(e)])),cancelInitialNotSent:o("cancelNotSent"),cancelInitialUnconfirmed:o("cancelUnconfirmed"),cancelReviewNotSent:o("reviewCancelNotSent"),cancelReviewUnconfirmed:o("reviewCancelUnconfirmed"),stopRefused:o("requestRefused"),cancelInitialRefused:o("requestRefused"),cancelReviewRefused:o("requestRefused"),leaveRefused:o("requestRefused"),keepRefused:o("requestRefused")},Q=new Set(["leftUnconfirmed"]),Z={leaveCompletedByKeep:o("leaveCompletedByKeep"),leaveCoveredByKeep:o("leaveCoveredByKeep"),keptElsewhere:o("keptAlready")};function ee(e){let n=[],t=(s,c)=>{s&&!n.some(u=>u.key===s)&&n.push(c?{key:s,values:c}:{key:s})};for(let s of _nullishCoalesce(e.keys, () => ([])))t(z[s],Q.has(s)&&typeof e.count=="number"?{count:e.count}:void 0);e.requestKey&&t(o(e.requestKey));let a=s=>{s!==void 0&&t(o(s?"requestedIntentApplied":"requestedIntentNotApplied"))};a(e.requestedTargetApplied);let r=e.savedDisposition;r&&t(o(r.phase==="left-known"?"leftKnown":"leftUnconfirmed"),r.phase==="left-known"?void 0:{count:r.count});let i=e.finalHistory;return i&&(i.relation&&t(Z[i.relation]),_optionalChain([i, 'access', _2 => _2.keptFact, 'optionalAccess', _3 => _3.keepEffect])==="forward-closed"&&t(o("keptForwardClosed")),a(i.requestedTargetApplied),_optionalChain([i, 'access', _4 => _4.contradictedAfterSeal, 'optionalAccess', _5 => _5.length])&&t(o("laterReportAfterKeep"))),n}var ne={user:"winnerStopUser","connection-lost":"winnerStopConnection","renewal-refused":"winnerStopRenewal","step-failed":"winnerStopStep","step-up-failed":"winnerStopStepUp","identity-lost":"winnerStopIdentity","attribution-missing":"winnerStopAttribution","plan-changed":"winnerStopChanged","adapter-configuration":"winnerStopAdapter"},O={stop:4,"cancel-initial":3,"cancel-review":3,keep:2,leave:1},V={stop:"stop",decline:"cancel-initial",leave:"leave",keep:"keep"},T={stop:o("checkIntentStatus"),"cancel-initial":o("checkIntentStatus"),"cancel-review":o("checkIntentStatus"),leave:o("checkSavedChoice"),keep:o("checkKeepStatus")},te={capabilityMissing:null,keepNoDecision:null,sealed:null,keepBlockedActive:o("keepReasonActive"),keepBlockedUnknown:o("keepReasonUnknown"),loading:o("actionLoading"),intentUnavailable:o("keepReasonUnavailable")},ae=new Set(["proposal","initial-review","cancelled"]),oe=new Set(["forward-active","readback","left-reopened","left-unconfirmed","completed","left-known"]),se=new Set(["forward-active","readback","left-reopened"]),re=new Set(["readback","left-reopened"]),b=(e,n,t)=>t?{id:e,labelKey:n,available:!1,reasonKey:t}:{id:e,labelKey:n,available:!0};function ie(e,n){let t=B(e,n),a=t?[t]:[];return n.state==="running"&&a.push(b("stop","chat.stop")),a}function B(e,n){let t=_chunk3KV7TDDRcjs.l.call(void 0, n,e.conversationId);if(n.state!=="awaiting-confirmation"||!t)return;let r={...b("confirm",t.schedule?"chat.confirmation.schedule":"chat.confirmation.apply",e.now>=Date.parse(t.expiresAt)?"chat.confirmation.expired":void 0),countedLabelKey:t.schedule?"chat.confirmation.scheduleCount":"chat.confirmation.applyCount",labelValues:{count:t.items.length}};return t.schedule?{...r,schedule:!0}:r}function le(e,n){let a=n.recovery.phase,r=[],i=a==="initial-review"&&B(e,n);if(i&&r.push(i),(a==="proposal"||a==="initial-review"||a==="forward-active")&&r.push(b("stop","chat.stop")),(a==="proposal"||a==="initial-review")&&r.push(b("decline","chat.cancel")),se.has(a)&&r.push(b("leave",o("leave"),e.capabilities.includes("plan-leave")?void 0:o("capabilityMissing"))),oe.has(a)){let s=e.keepReview;if(!("disabled"in s))r.push(b("keep",o("keepChanges")));else{let c=te[s.disabled];c&&r.push(b("keep",o("keepChanges"),c))}}if(re.has(a))for(let s of["undoSelected","continue"])r.push(b(s,o(s),o("notAvailableYet")));return r}function W(e,n){if(!(_optionalChain([n, 'optionalAccess', _6 => _6.retryAt])===void 0||_optionalChain([n, 'access', _7 => _7.lastProblem, 'optionalAccess', _8 => _8.cause])!=="rate-limited"||e.now>=n.retryAt))return{seconds:Math.ceil((n.retryAt-e.now)/1e3)}}function N(e,n,t){let a=n,r=W(e,t);if(t){let s=r?{id:"status",labelKey:T[t.kind],available:!1,reasonKey:o("retryAfterSeconds"),reasonValues:r}:{id:"status",labelKey:T[t.kind],available:!0,busy:t.delivery==="sending"},c=!1;a=a.map(u=>V[u.id]===t.kind?(c=!0,s):u),c||(a=[...a,s])}let i=[...t?[t.kind]:[],...e.pending].map(s=>O[s]);if(i.length){let s=Math.max(...i);a=a.map(c=>{if(c.id==="status")return c;let u=V[c.id],l=c.id==="confirm"?0:u?O[u]:void 0;if(l===void 0||l>s)return c;let p=u&&e.pending.includes(u);return{...c,available:!1,reasonKey:o("intentPendingReason"),...p?{busy:!0}:{}}})}return e.conversationUnavailable&&(a=a.map(s=>({...s,available:!1,reasonKey:o("refreshConversation")}))),a}function U(e,n){let t=e.recovery,a=_nullishCoalesce(t.steps, () => ([])),r=s=>a.filter(c=>c.truth===s).length,i=(s,c)=>c?{key:o(s),values:c}:{key:o(s)};if(t.sealed)return{label:i("keptKnown"),tone:"neutral",attention:!1};switch(t.phase){case"proposal":return{label:i("statusProposal"),tone:"neutral",attention:!1};case"initial-review":return{label:i("heading"),tone:"neutral",attention:!1};case"forward-active":return{label:i(_optionalChain([n, 'optionalAccess', _9 => _9.kind])==="stop"?"stopping":"currentRunning"),tone:"progress",attention:!1};case"readback":case"left-reopened":return{label:i("heading"),tone:"warning",attention:!0};case"completed":return{label:i("statusCompleted"),tone:"success",attention:!1};case"cancelled":return{label:i(r("done")?"currentStopped":"cancelledNoChanges"),tone:"neutral",attention:!1};case"left-known":return{label:i("leftKnown"),tone:"neutral",attention:!1};case"left-unconfirmed":return{label:i("leftUnconfirmed",{count:r("unknown")}),tone:"warning",attention:!1}}}function D(e){let n=e.plan;if(!n)return null;let t=!!n.recovery&&e.capabilities.includes("plan-recovery");if(n.recovery&&(e.readOnly||!t||n.recovery.profile!=="plan-recovery-v1"||!U(n,void 0)))return{planId:n.id,status:{dataStatus:n.recovery.phase,wireState:n.state,label:{key:o("heading")},tone:"neutral",attention:!1},intent:null,steps:[],lines:[{key:o("updateToControl")},{key:`chat.block.state.${n.state}`}],notice:[],alert:null,actions:[],pending:[],conversationUnavailable:e.conversationUnavailable,readOnly:!0};let a=e.overlay&&e.overlay.planId===n.id?e.overlay:void 0,r=e.notice&&(_nullishCoalesce(e.notice.planId, () => (n.id)))===n.id?ee(e.notice):[],i=e.alert,s=W(e,a),c=_optionalChain([a, 'optionalAccess', _10 => _10.lastProblem, 'optionalAccess', _11 => _11.key]),u=i&&a?{serial:i.serial,..."restoreFocus"in i?{restoreFocus:!0}:{action:i.action},...c&&x[c]?{message:{key:x[c]}}:{},retryAvailable:!s&&!e.conversationUnavailable,...e.conversationUnavailable?{retryReasonKey:o("refreshConversation")}:s?{retryReasonKey:o("retryAfterSeconds"),retryValues:s}:{}}:i&&"restoreFocus"in i?{serial:i.serial,restoreFocus:!0,retryAvailable:!0}:null;if(!t)return{planId:n.id,status:null,intent:null,steps:[],lines:[],notice:[],alert:null,actions:N({...e,pending:[]},ie(e,n),void 0),pending:[],conversationUnavailable:e.conversationUnavailable};let l=n.recovery,p=new Map(n.plan.kind==="immediate"?n.plan.steps.map((f,R)=>[f.id,{index:R+1,resource:f.resource}]):[]),v=new Set(_nullishCoalesce(l.contradictedAfterSeal, () => ([]))),h=l.phase==="forward-active",k=(_nullishCoalesce(l.steps, () => ([]))).map((f,R)=>({stepId:f.stepId,index:_nullishCoalesce(_optionalChain([p, 'access', _12 => _12.get, 'call', _13 => _13(f.stepId), 'optionalAccess', _14 => _14.index]), () => (R+1)),..._optionalChain([p, 'access', _15 => _15.get, 'call', _16 => _16(f.stepId), 'optionalAccess', _17 => _17.resource])!==void 0&&{resource:p.get(f.stepId).resource},truth:f.truth,textKey:o(f.truth==="done"?"done":f.truth==="not-done"?"notDone":h?"stepNotKnownYet":"unknown"),...l.sealed&&v.has(f.stepId)?{lateReport:"contradicted"}:{}})),g=[],w=k.filter(f=>f.truth==="unknown").length,I=k.filter(f=>f.truth==="not-done").length;!_optionalChain([l, 'access', _18 => _18.steps, 'optionalAccess', _19 => _19.length])&&!ae.has(l.phase)&&g.push({key:o("stepsNotKnownYet")});let m=!1;!l.sealed&&!h&&w&&(g.push({key:o("stepsUnknown"),values:{count:w}}),m=!0),!l.sealed&&l.phase==="completed"&&I&&(g.push({key:o("stepsNotDone"),values:{count:I}}),m=!0),l.sealed&&v.size&&(g.push({key:o("laterReportAfterKeep")}),m=!0);let d=l.winner;_optionalChain([d, 'optionalAccess', _20 => _20.kind])==="stop"?(g.push({key:o(ne[d.cause])}),l.phase==="readback"&&g.push({key:o("stopped")})):d&&g.push({key:o(d.kind==="leave"?"winnerLeave":d.kind==="keep"?"winnerKeep":"winnerCancel")});let y=U(n,a);return{planId:n.id,status:{dataStatus:l.phase,wireState:n.state,label:y.label,tone:y.tone,attention:y.attention||m,...l.sealed?{result:"kept"}:{}},intent:a?{kind:a.kind,status:a.delivery}:null,steps:k,lines:g,notice:r,alert:u,actions:N(e,le(e,n),a),pending:e.pending,conversationUnavailable:e.conversationUnavailable}}function L(e,n){let t=e.review==="forward-only"?[{key:o("confirmKeepForwardOnly")},{key:o("keepRemainingSteps"),values:{count:e.remaining}}]:[{key:o("confirmEndRetention")}],a=n.conversationUnavailable?o("refreshConversation"):_optionalChain([n, 'access', _21 => _21.status, 'optionalAccess', _22 => _22.result])==="kept"?o("alreadyKept"):n.intent||n.pending.length?o("intentPendingReason"):void 0;return{messages:t,proceed:a?{available:!1,reasonKey:a}:{available:!0}}}var _react = require('react');var ue=_react.createContext.call(void 0, null);function S(e){let n=_react.useContext.call(void 0, ue),t=_nullishCoalesce(e, () => (n));if(!t)throw new Error("A client is required");return t}function Ae(e){let n=S(e);return _react.useSyncExternalStore.call(void 0, n.subscribe,n.getSnapshot,n.getSnapshot)}function K(e,n=Object.is,t){let a=S(t),r=_react.useRef.call(void 0, void 0),i=()=>{let s=a.getSnapshot(),c=r.current;if(c&&c.snapshot===s&&c.selector===e)return c.value;let u=e(s);return c&&n(c.value,u)?(r.current={snapshot:s,selector:e,value:c.value},c.value):(r.current={snapshot:s,selector:e,value:u},u)};return _react.useSyncExternalStore.call(void 0, a.subscribe,i,i)}var _=new WeakMap;function fe(e,n){let t=_.get(e);return t||(t=new Map(e.map(a=>[a.id,a])),_.set(e,t)),t.get(n)}function Ce(e,n){return K(t=>t.conversation?fe(t.conversation.messages,e):void 0,Object.is,n)}function j(e,n){let t=Object.keys(e);return t.length===Object.keys(n).length&&t.every(a=>Object.is(e[a],n[a]))}var ye={disabled:"keepNoDecision"};function Ve(e){let n=S(e),t=K(d=>({plan:d.plan,intentOverlays:d.intentOverlays,conversationId:d.conversationId,capabilities:d.capabilities,conversationUnavailable:d.conversationUnavailable,intentNotice:d.intentNotice,intentAlert:d.intentAlert,planReadOnly:d.planReadOnly,keepReview:d.plan?n.keepChangesReview(d.plan.id):ye}),(d,y)=>j({...d,keepReview:0},{...y,keepReview:0})&&JSON.stringify(d.keepReview)===JSON.stringify(y.keepReview),n),a=t.plan,[r,i]=_react.useState.call(void 0, []),[s,c]=_react.useState.call(void 0, ()=>Date.now()),[u,l]=_react.useState.call(void 0, null),p=_optionalChain([a, 'optionalAccess', _23 => _23.id]);_react.useEffect.call(void 0, ()=>{i([]),l(null)},[p]);let v=p?t.intentOverlays[p]:void 0,h=_optionalChain([v, 'optionalAccess', _24 => _24.retryAt]);_react.useEffect.call(void 0, ()=>{if(h===void 0)return;let d=h-Date.now();if(d<=0)return;let y=setTimeout(()=>c(Date.now()),d);return()=>clearTimeout(y)},[h]);let k=_optionalChain([_chunk3KV7TDDRcjs.l.call(void 0, a,t.conversationId), 'optionalAccess', _25 => _25.expiresAt]);_react.useEffect.call(void 0, ()=>{if(!k)return;let d=Date.parse(k)-Date.now();if(!(d>0))return;let y=setTimeout(()=>c(Date.now()),d+1);return()=>clearTimeout(y)},[k]);let g=D({plan:a,capabilities:t.capabilities,conversationUnavailable:t.conversationUnavailable,overlay:v,notice:t.intentNotice,alert:t.intentAlert,keepReview:t.keepReview,pending:r,now:Math.max(s,Date.now()),conversationId:t.conversationId,readOnly:t.planReadOnly}),w=_react.useCallback.call(void 0, (d,y)=>{i(f=>[...f,d]),y.finally(()=>i(f=>f.filter(R=>R!==d)))},[]),I=_react.useCallback.call(void 0, d=>{if(p)switch(d){case"confirm":n.confirmPlan();return;case"stop":{n.stopPlan(p);let y=n.getSnapshot();!y.planReadOnly&&!y.intentOverlays[p]&&w("stop",n.checkIntentStatus(p));return}case"decline":w("cancel-initial",n.declinePlan());return;case"leave":w("leave",n.leavePlan(p));return;case"keep":{let y=n.keepChangesReview(p);"disabled"in y||l(y);return}case"status":case"retry":n.checkIntentStatus(p);return}},[p,n,w]),m=u&&g?{...L(u,g),onProceed:()=>{let d=u;l(null),w("keep",n.keepChanges(d))},onCancel:()=>l(null)}:null;return{view:g,press:I,sheet:m}}var Y=new WeakMap,ve=e=>{let n=Y.get(e);return n||Y.set(e,n={cards:new Map,listeners:new Set}),n},$=(e,n,t)=>JSON.stringify([e,n,t]),E=new WeakMap,H=e=>{E.delete(e.cards);for(let n of e.listeners)n()},we=128,J=(e,n)=>{let t=n;for(let a=0;a<e.length;a++)t^=e.charCodeAt(a),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")},X=e=>J(e,2166136261)+J(e,731459039),he=e=>JSON.stringify(e,(n,t)=>t&&typeof t=="object"&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([a],[r])=>a<r?-1:1)):t),ke=e=>e.replace(/[^\w.~-]/g,n=>`%${(n.charCodeAt(0)+65536).toString(16).slice(1)}`);function be(e,n,t,a){let r=`card:${[e,n,t].map(ke).join(":")}:${X(he(a))}`;return r.length<=we?r:`card~${X(r)}`}function Be(e){let n=S(e),t=K(l=>l.conversationId,Object.is,n),a=ve(n),r=_react.useCallback.call(void 0, l=>(a.listeners.add(l),()=>a.listeners.delete(l)),[a]),i=_react.useCallback.call(void 0, ()=>{let l=E.get(a.cards);l||E.set(a.cards,l=new Map);let p=l.get(t);return p||(p=new Set([...a.cards.values()].filter(v=>v.conversationId===t).map(v=>v.blockId)),l.set(t,p)),p},[a,t]),s=_react.useSyncExternalStore.call(void 0, r,i,i),c=_react.useCallback.call(void 0, (l,p,v="")=>{let h=$(t,v,l.id);if(a.cards.has(h))return Promise.resolve();let k={...p,blockId:typeof p.blockId=="string"?p.blockId:l.id,clientReplyId:be(t,v,l.id,p)};a.cards.set(h,{conversationId:t,blockId:l.id}),H(a);let g=()=>{a.cards.delete(h),H(a)};return n.replyOutcome(k).then(w=>(w.accepted||g(),w),g)},[n,a,t]),u=_react.useCallback.call(void 0, (l,p="")=>!!l.answered||a.cards.has($(t,p,l.id)),[a,t,s]);return{answered:s,isAnswered:u,reply:c}}var me={"sign-in":"chat.problem.signIn",retryable:"chat.problem.retryable","rate-limited":"chat.problem.rateLimited",refused:"chat.problem.refused",closed:"chat.problem.closed",full:"chat.problem.full",declined:"chat.problem.declined",unavailable:"chat.problem.unavailable","step-up-cancelled":"chat.problem.stepUp","invalid-read":"chat.problem.invalid","invalid-plan":"chat.problem.invalid","plan-changed":"chat.planChanged","update-required":"chat.update",mismatch:"chat.problem.mismatch","agreement-expired":"chat.problem.agreement","in-doubt":"chat.problem.inDoubt",replaced:"chat.problem.replaced","needs-attention":"chat.problem.needsAttention",stopped:"chat.stopped"},Se= exports.l =e=>e.code==="replaced"?"refresh":["retryable","rate-limited","unavailable","agreement-expired"].includes(e.code)?"retry":void 0;function De(e,n={}){let t=e.id==="conversation-read"&&(e.code==="unavailable"||e.code==="retryable"),a=e.id==="conversation-unavailable"?"chat.conversationUnavailable":t?"chat.conversationReadFailed":n.answeredElsewhere?"chat.problem.answered":_nullishCoalesce(me[e.code], () => ("chat.failure")),r=Se(e);return{key:a,...r&&{action:r},code:e.code,id:e.id}}function Le(e,n={}){if(e==="none")return{actions:[]};let t={id:"retry",labelKey:"chat.retry"};return{key:`reply.${e}`,actions:e==="overdue"?[{id:"keepWaiting",labelKey:"chat.reply.keepWaiting"},t]:e==="writing"?n.canStop?[{id:"stop",labelKey:"chat.reply.stop"}]:[]:n.canRetry===!1?[]:[t]}}exports.a = ee; exports.b = D; exports.c = L; exports.d = ue; exports.e = Ae; exports.f = K; exports.g = Ce; exports.h = j; exports.i = Ve; exports.j = be; exports.k = Be; exports.l = Se; exports.m = De; exports.n = Le;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t={background:"#ffffff",foreground:"#18212f",muted:"#526071",accent:"#245ad1",border:"#ccd4df",surface:"#f2f5f9",danger:"#b42318",space:"0.75rem",radius:"0.5rem",fontSize:"1rem",fontFamily:"system-ui, sans-serif",shadow:"0 0.25rem 1rem #0002",motion:"120ms",space1:"0.25rem",space2:"0.5rem",fontSizeSm:"0.875rem",fontSizeLg:"1.125rem",motionFast:"80ms",motionSlow:"200ms",easing:"cubic-bezier(0.2, 0, 0, 1)",focusRing:"#245ad1",controlBorder:"#6b7889",success:"#1a7f37",warning:"#8a5c00"},s={...t,background:"#141b25",foreground:"#eef2f7",muted:"#aebbc9",accent:"#8fb1ff",border:"#465363",surface:"#202b39",danger:"#ffaaa4",focusRing:"#8fb1ff",controlBorder:"#8593a5",success:"#6fdd8b",warning:"#f2cc60"};function f(r){return Object.fromEntries(Object.entries(r).filter(e=>e[1]!==void 0).map(([e,o])=>[`--wp-${e.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}`,o]))}export{t as a,s as b,f as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
async function f(t,s){let n=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/.exec(t);if(!n)throw new Error("Invalid flow frontmatter");let{loadFrontmatter:o}=await import("./flow-parser.js"),r=o(n[1]);return i(typeof r=="object"&&r!==null?{...r,body:n[2]??""}:r,s)}function i(t,s){if(typeof t!="object"||t===null||Array.isArray(t))throw new Error("Invalid flow");let n=t;if(n.format!=="1.0"||typeof n.id!="string"||!n.id||typeof n.title!="string"||!n.title||!["prompt","structured"].includes(n.kind)||!Array.isArray(n.parameters)||!Array.isArray(n.tags)||!n.tags.every(r=>typeof r=="string")||typeof n.body!="string")throw new Error("Invalid flow");let o=new Set;for(let r of n.parameters){if(!r||typeof r.name!="string"||!r.name||o.has(r.name)||!["string","number","boolean"].includes(r.type)||typeof r.required!="boolean"||typeof r.label!="string"||r.default!==void 0&&typeof r.default!==r.type)throw new Error("Invalid flow parameter");o.add(r.name)}if(n.kind==="structured"){if(!Array.isArray(n.steps)||!n.steps.length)throw new Error("Invalid flow steps");for(let r of n.steps){if(!r||!s.includes(r.operation)||typeof r.arguments!="object"||r.arguments===null||Array.isArray(r.arguments))throw new Error("Unknown operation");for(let e of JSON.stringify(r.arguments).matchAll(/\{\{([^}]+)\}\}/g))if(!o.has(e[1]))throw new Error("Unknown parameter")}}else if(n.steps!==void 0)throw new Error("Prompt cannot contain steps");return n}function p(t,s){let n=Object.create(null);for(let r of t.parameters){let e=s[r.name]??r.default;if(e===void 0&&r.required)throw new Error("Missing parameter");if(e!==void 0&&typeof e!==r.type)throw new Error("Invalid parameter type");n[r.name]=e}let o=r=>{if(typeof r=="string"){let e=/^\{\{([^}]+)\}\}$/.exec(r);return e?n[e[1]]:r}return Array.isArray(r)?r.map(o):r&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([e,a])=>[e,o(a)])):r};return(t.steps??[]).map(r=>({operation:r.operation,arguments:o(r.arguments)}))}export{f as a,i as b,p as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var K=["1.1","1.0"],J=["plans","flows","widgets","step-up","scheduled","form-fill","plan-recovery","plan-leave","plan-keep","reply-stop"];function W(e){return e.filter(a=>a!=="plan-leave"&&a!=="plan-keep"||e.includes("plan-recovery"))}function F(e,a=[],s){let o=K.find(c=>e.includes(c));if(!o)throw new Error("update-required");return{protocol:o,capabilities:W(J.filter(c=>a.includes(c)&&(!s||s.capabilities.includes(c))&&(c!=="form-fill"||o==="1.1")))}}function H(e){return{text:e.fallback,disabled:!0,update:!0}}var $={client:[],conversation:["client"],stream:["conversation"],connection:["stream"],recovery:["stream"],"plan-read":["conversation","connection"],"flow-load":["client"],"flow-run":["client"],binding:["client"],runner:["conversation","external"],invocation:["runner"]},U=new WeakMap;function q(e,a){if(a){let y=$[e],n=U.get(a)??"external";if(!y.includes(n))throw new Error(`A ${e} scope cannot have this parent`)}else if(e!=="client"&&e!=="runner")throw new Error(`A ${e} scope needs a parent`);let s=globalThis,o=new s.AbortController,c=s.AbortSignal?.any,p=(y,n,f=()=>o.abort())=>(U.set(y,e),{signal:y,abort:f,end:n});if(!a)return p(o.signal,()=>{});if(c)return p(c.call(s.AbortSignal,[a,o.signal]),()=>{});let b=()=>o.abort();a.aborted?o.abort():a.addEventListener("abort",b,{once:!0});let m=()=>a.removeEventListener("abort",b);return p(o.signal,m,()=>{m(),o.abort()})}function A(e,a){return e.aborted?(a(),()=>{}):(e.addEventListener("abort",a,{once:!0}),()=>e.removeEventListener("abort",a))}var k=class extends Error{constructor(){super("plan-read-refused"),this.name="PlanReadRefused"}},L=e=>e instanceof k?"plan-changed":"connection-lost";function j(e,a){return{proposed:["awaiting-confirmation","cancelled"],"awaiting-confirmation":["running","submitted","cancelled"],running:["undoing","completed","needs-attention"],undoing:["undone","needs-attention"],completed:["undoing"],submitted:[],undone:[],"needs-attention":["running","undoing"],cancelled:[]}[e].includes(a)}var C=new Error("retired");function z(e){let a=null,s=new Set,o,c=q("runner",e.signal),p=!1,b,m=async(n,f)=>{if(f.signal.aborted)throw C;let t=await e.read(n);return f.signal.aborted||e.onRecord?.(t),t},y=async(n,f,t)=>{let r;try{r=await m(n,t)}catch(i){throw i!==C&&!t.signal.aborted&&t.acceptance&&e.interrupted&&await e.interrupted(n,L(i)),i}if(t.signal.aborted)return;if(r.recovery&&(t.acceptance?.planId!==n||t.acceptance.executionId!==r.recovery.executionId))throw new Error("unauthorized-run");if(r.plan.kind!=="immediate"||r.plan.stage!=="final"||r.state!=="running")return;if(!f||r.plan.digest!==f)throw new Error("invalid-plan");let u={...r.plan,steps:r.plan.steps.map(i=>({...i,request:i.request?{...i.request,headers:{...i.request.headers}}:void 0}))},S=u.steps,O=S.filter(i=>i.undo==="none");if(O.length>1||O.length===1&&S.at(-1)?.undo!=="none"||S.some(i=>!i.request||!["POST","PUT","PATCH"].includes(i.request.method)))throw new Error("invalid-plan");let x,R=!1,E=()=>{R=!0,x!==void 0&&e.clock?.clearTimeout(x),x=void 0},N=A(t.signal,E),l=async i=>{E(),t.context&&delete t.context.stepUpCode,!t.signal.aborted&&(i&&e.interrupted&&await e.interrupted(n,i),t.signal.aborted||await m(n,t).catch(()=>{}))},v=async()=>{try{return await m(n,t)}catch(i){throw i!==C&&await l(L(i)),i}},T=async()=>{if(!(R||t.signal.aborted)){try{await e.heartbeat(n,t.acceptance)}catch{t.signal.aborted||(p=!0)}!R&&!t.signal.aborted&&e.clock&&(x=e.clock.setTimeout(()=>{x=void 0,T()},e.heartbeatMs??1e4))}};await T();try{for(let[i,g]of S.entries()){if(t.signal.aborted)return;if(p)return l("renewal-refused");if(s.has(n))return l();if(r=await v(),t.signal.aborted)return;if(p)return l("renewal-refused");if(s.has(n))return l();if(r.state!=="running")return;if(r.outcomes.some(d=>d.stepId===g.id&&d.attributed&&d.status>=200&&d.status<300))continue;let P=r.plan;if(P.kind!=="immediate"||P.stage!=="final"||P.digest!==u.digest||JSON.stringify(P.steps[i]?.request)!==JSON.stringify(g.request))throw await l("plan-changed"),new Error("invalid-plan");let h=g.request,w={signal:t.signal,planId:n,stepId:g.id,headers:{...h.headers,"Waypoint-Step":`${n}.${i}`,...t.acceptance?{"Waypoint-Execution":t.acceptance.executionId,"Waypoint-Fence":String(t.acceptance.fence)}:{}}};if(g.stepUp){let d=await e.stepUp?.(n,g.id);if(!d)return l("step-up-failed");if(t.signal.aborted)return;if(p)return l("renewal-refused");if(s.has(n))return l();if(r=await v(),r.state!=="running")return;if(r.plan.kind!=="immediate"||r.plan.stage!=="final"||r.plan.digest!==u.digest||JSON.stringify(r.plan.steps[i]?.request)!==JSON.stringify(h))throw await l("plan-changed"),new Error("invalid-plan");if(r.outcomes.some(I=>I.stepId===g.id&&I.attributed&&I.status>=200&&I.status<300))continue;w.stepUpCode=d}if(t.signal.aborted)return;if(p)return l("renewal-refused");if(s.has(n))return l();try{t.context=w,await e.request({...h,headers:{...h.headers}},w)}catch{return delete w.stepUpCode,t.context===w&&(t.context=void 0),l("step-failed")}finally{delete w.stepUpCode,t.context===w&&(t.context=void 0)}if(r=await v(),!r.outcomes.some(d=>d.stepId===g.id&&d.attributed&&d.status>=200&&d.status<300))return l("attribution-missing");if(s.has(n))return l()}}finally{E(),N()}};return{run(n,f,t){if(a)return o===n?a:Promise.reject(new Error("active-plan"));if(s.has(n)||c.signal.aborted)return Promise.resolve();o=n,p=!1;let r=q("invocation",c.signal),u={scope:r,signal:r.signal,...t?{acceptance:t}:{}};return A(u.signal,()=>{u.context&&delete u.context.stepUpCode}),b=u,a=y(n,f,u).catch(S=>{if(S!==C)throw S}).finally(()=>{r.end(),b===u&&(b=void 0),a=null,o=void 0}),a},stop(n=o){n&&s.add(n)},interrupt(){b?.scope.abort()},dispose(){c.abort()}}}export{K as a,J as b,W as c,F as d,H as e,q as f,A as g,k as h,j as i,z as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var b=u=>JSON.parse(JSON.stringify(u===void 0?null:u));function F(u){let f=!1,s={pending:!1,fields:Object.create(null)},v=new Set,l,g=Object.create(null);for(let e of u.fields){if(Object.hasOwn(g,e.name))throw new Error("Duplicate field");e.tier==="low"&&(g[e.name]={label:e.label,value:b(e.value),revision:0,edited:!1})}s={fields:g,pending:!1};let a=[],O=e=>Object.keys(e.fields).filter(i=>s.fields[i]?.revision===e.fields[i].revision),c=e=>{s={fields:e,pending:l!==void 0},s={...s,fills:a.map(i=>({id:i.id,fields:O(i)})).filter(i=>i.fields.length)};for(let i of v)i()},m=(e,i)=>c({...s.fields,[e]:i});return{getSnapshot:()=>s,subscribe(e){return v.add(e),()=>{v.delete(e)}},begin(e){if(f)throw new Error("Disposed form");let i=e.field?[e.field]:Object.keys(s.fields);if(!i.length||i.some(t=>!Object.hasOwn(s.fields,t)))throw new Error("Unknown field");let n=u.ids();return l={id:n,revisions:Object.fromEntries(i.map(t=>[t,s.fields[t].revision]))},c({...s.fields}),b({requestId:n,text:e.text,references:e.references??[],attachments:e.attachments??[],...e.field?{field:e.field}:{},fields:i.map(t=>({name:t,label:s.fields[t].label,tier:"low",value:s.fields[t].value}))})},receive(e){if(!e||typeof e!="object")return!1;let i=e;if(f||!l||i.requestId!==l.id||!i.values||typeof i.values!="object"||Array.isArray(i.values))return!1;let n=Object.keys(l.revisions);if(Object.keys(i.values).length!==n.length||n.some(o=>!Object.hasOwn(i.values,o)))return!1;for(let o of n){let r=i.values[o];if(!r||!Object.hasOwn(r,"value")||r.label!==void 0&&typeof r.label!="string"||!r.validation||!["valid","invalid"].includes(r.validation.status)||!Array.isArray(r.validation.messages)||r.validation.messages.some(p=>typeof p!="string")||r.validation.guidance!==void 0&&typeof r.validation.guidance!="string")return!1}let t={...s.fields},d={id:l.id,fields:{}};for(let o of n){let r=t[o],p=b(i.values[o]);r.edited||r.revision!==l.revisions[o]?t[o]={...r,replacement:{...p,revision:r.revision,fill:l.id}}:(t[o]={...r,...p,revision:r.revision+1,edited:!1,replacement:void 0},d.fields[o]={draft:r,revision:r.revision+1})}return Object.keys(d.fields).length&&(a=[...a,d].slice(-20)),l=void 0,c(t),!0},edit(e,i){if(!Object.hasOwn(s.fields,e))return;let n=s.fields[e];f||!n||m(e,{...n,value:b(i),revision:n.revision+1,edited:!0,validation:void 0,replacement:void 0,localInvalid:void 0,localText:void 0})},markEdited(e,i){if(!Object.hasOwn(s.fields,e))return;let n=s.fields[e];f||!n||m(e,{...n,revision:n.revision+1,edited:!0,validation:void 0,replacement:void 0,localInvalid:!0,localText:i})},revert(e){let i=a.find(t=>t.id===e);if(f||l||!i)return!1;let n={...s.fields};for(let t of O(i)){let{draft:d}=i.fields[t];n[t]={...n[t],value:d.value,validation:d.validation,label:d.label,revision:n[t].revision+1,edited:!1,localInvalid:void 0,localText:void 0}}for(let[t,d]of Object.entries(n))d.replacement?.fill===e&&(n[t]={...d,replacement:void 0});return a=a.filter(t=>t!==i),c(n),!0},failRequest(e){l?.id===e&&(l=void 0,c({...s.fields}))},replace(e,i){if(!Object.hasOwn(s.fields,e))return!1;let n=s.fields[e];return f||!n?.replacement||n.revision!==i||n.replacement.revision!==i?!1:(m(e,{...n,value:n.replacement.value,validation:n.replacement.validation,revision:i+1,edited:!1,replacement:void 0,localInvalid:void 0,localText:void 0}),!0)},cancelReplacement(e){if(!Object.hasOwn(s.fields,e))return;let i=s.fields[e];i&&!f&&m(e,{...i,replacement:void 0})},cancel(){l=void 0,c({...s.fields})},dispose(){f=!0,l=void 0,a=[],c({}),v.clear()}}}export{F as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }function s(n,i,e){let r=e.resource===void 0?void 0:_optionalChain([i, 'optionalAccess', _ => _.resource, 'optionalCall', _2 => _2(e.resource)]);return r?n("chat.stepNamed",{name:r,index:e.index}):n("chat.stepName",{index:e.index})}exports.a = s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});function o(){try{return process.env.NODE_ENV==="production"}catch (e){return!1}}exports.a = o;
|