@appsolutely-io/waypoint 0.0.0-stage → 0.1.1-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +260 -2
- package/dist/block-reply-DN4RiLL0.d.cts +169 -0
- package/dist/block-reply-Dtof9ild.d.ts +169 -0
- package/dist/blocks-25YOJ5SS.cjs +1 -0
- package/dist/blocks-UJ7GUJHD.js +1 -0
- package/dist/chunk-3KV7TDDR.cjs +3 -0
- package/dist/chunk-4BWV3SEL.cjs +1 -0
- package/dist/chunk-4ZGW4HM4.cjs +1 -0
- package/dist/chunk-5TBO732O.js +1 -0
- package/dist/chunk-6OZSKCPT.cjs +1 -0
- package/dist/chunk-C3VS33WJ.js +1 -0
- package/dist/chunk-D2EGPBCX.cjs +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-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-M3UENQ6L.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-Q6BD2YL3.cjs +1 -0
- package/dist/chunk-Q7BULGQG.cjs +1 -0
- package/dist/chunk-QS3MKZOY.cjs +3 -0
- package/dist/chunk-RHBDQGD4.js +1 -0
- package/dist/chunk-RZZDQWC2.js +1 -0
- package/dist/chunk-S73WZWDP.js +1 -0
- package/dist/chunk-SD2KAIVE.js +1 -0
- package/dist/chunk-T5XF2R74.js +1 -0
- package/dist/chunk-TCFCSGQ3.js +1 -0
- package/dist/chunk-TGL3DR2K.js +1 -0
- package/dist/chunk-TODYQ3SG.cjs +1 -0
- package/dist/chunk-TVSQHTK2.cjs +1 -0
- package/dist/chunk-UYR3UEIW.cjs +1 -0
- package/dist/chunk-VGGJGRNK.cjs +1 -0
- package/dist/chunk-W6Y7H56X.js +1 -0
- package/dist/chunk-XSHOLIC7.cjs +1 -0
- package/dist/chunk-XWDB2LS3.cjs +1 -0
- package/dist/cli.js +3 -0
- package/dist/confirmation-view-CICNJJIO.js +1 -0
- package/dist/confirmation-view-OMWHUYVC.cjs +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-AIULKYOS.cjs +1 -0
- package/dist/flows-panel-YEJ36RTY.js +1 -0
- package/dist/form-extras-QYE32TUY.cjs +1 -0
- package/dist/form-extras-SBBOMJS2.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-DPNfYTMG.d.cts +148 -0
- package/dist/i18n-DPNfYTMG.d.ts +148 -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-BSRKJFFE.cjs +17 -0
- package/dist/markdown-ETLB66BK.js +17 -0
- package/dist/message-actions-3HGE6VTS.js +1 -0
- package/dist/message-actions-F6SPLTT7.cjs +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 +419 -0
- package/dist/react/index.d.ts +419 -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-OWY2CWOH.cjs +3 -0
- package/dist/recovery-panel-VOKVDDZD.js +3 -0
- package/dist/reply-controls-5CWIAKIG.js +1 -0
- package/dist/reply-controls-CPWB4VBK.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-3hQ6CCGr.d.cts +19 -0
- package/dist/step-name-BdkYnb5g.d.ts +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 +796 -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 +2385 -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 +183 -0
- package/etc/react.api.md +2968 -0
- package/etc/skin-antd.api.md +2989 -0
- package/etc/skin-default.api.md +61 -0
- package/etc/testing.api.md +3034 -0
- package/package.json +168 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Ge}from"./chunk-FQSWQLRW.js";import{a as Rn,b as Fn}from"./chunk-OWT55N6J.js";import{d as On,e as Me,f as wt,g as Bn,h as Hn,i as kt,j as Un}from"./chunk-RHBDQGD4.js";import{a as Nn,b as Dn,c as An}from"./chunk-RZZDQWC2.js";import{b as Ln,c as In}from"./chunk-M63QOANE.js";import{f as Te,l as yt}from"./chunk-L4PFFRDE.js";import{useLayoutEffect as $n,useRef as Wn}from"react";var Xe=new WeakMap;function V(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function O(e,t){let n=t;for(;n;){if(n===e)return!0;n=n.parentNode??(n instanceof ShadowRoot?n.host:null)}return!1}function ve(e){return e.composedPath?.()[0]??e.target}var Ct=new WeakMap,Kr=0;function Kn(e){let t=new Set,n=[],o=a=>{t.has(a)||a.hasAttribute("inert")||(a.setAttribute("inert",e.mark),e.set.push(a))};for(let a=e.drawer;;){t.add(a);let l=a instanceof Element?a.assignedSlot:null;l&&a.parentNode&&n.push(a.parentNode);let c=l??a.parentNode;if(!c||c.nodeType===Node.DOCUMENT_NODE)break;n.push(c),a=c instanceof ShadowRoot?c.host:c}for(let a of n)for(let l of a.children)o(l);if(typeof MutationObserver=="function"){e.watch=new MutationObserver(a=>{for(let l of a)for(let c of l.addedNodes)c instanceof Element&&o(c)});for(let a of n)e.watch.observe(a,{childList:!0})}}function qn(e){e.watch?.disconnect(),e.watch=void 0;for(let t of e.set)t.getAttribute("inert")===e.mark&&t.removeAttribute("inert");e.set=[]}function Et(e){let t=e.ownerDocument,n=Ct.get(t)??[];Ct.set(t,n);let o=n.at(-1);o&&qn(o);let a={drawer:e.closest("[data-wp-modal-root]")??e,mark:`waypoint-${++Kr}`,set:[]};return n.push(a),Kn(a),()=>{let l=n.indexOf(a);if(l<0)return;qn(a),n.splice(l,1);let c=n.at(-1);l===n.length&&c&&Kn(c)}}var qr='a[href], button, input, select, textarea, summary, iframe, [tabindex], [contenteditable]:not([contenteditable="false"])';function oe(e){return e instanceof HTMLElement&&e.isConnected&&e.matches(qr)&&!e.matches('input[type="hidden"], :disabled')&&!e.closest("[hidden], [inert]")&&(typeof e.checkVisibility!="function"||e.checkVisibility({visibilityProperty:!0}))}function zr(e,t){for(let n=e;n;){if(n instanceof Element&&oe(n))return n;if(n===t)return null;n=n.parentNode??(n instanceof ShadowRoot?n.host:null)}return null}function jr(e){return O(e,V(e.ownerDocument))}var xt=e=>{let t=V(e);return!t||t===e.body};function ye(e){let t=Xe.get(e);if(t)return t;let n={origins:new Set,last:null};return t=n,Xe.set(e,n),e.addEventListener("focusin",o=>{let a=ve(o);n.last=a,n.disabled=null;for(let l of n.origins)!O(l.root,a)&&!l.owned.some(c=>O(c,a))&&(l.valid=!1,n.origins.delete(l))},!0),e.addEventListener("focusout",o=>{let a=ve(o);o.relatedTarget||queueMicrotask(()=>{if(!a?.isConnected||!xt(e))return;if(a.matches(":disabled"))return void(n.disabled=a);let l=Ct.get(e)?.at(-1)?.drawer;if(!(l&&O(l,a))){n.last=null;for(let c of n.origins)c.valid=!1;n.origins.clear()}})},!0),e.addEventListener("pointerdown",()=>{n.last&&!n.last.isConnected&&xt(e)&&(n.last=null)},!0),n}function ce(e){e&&(e.valid=!1,Xe.get(e.root.ownerDocument)?.origins.delete(e))}function Vn(e){let t=Xe.get(e.ownerDocument);if(t)for(let n of t.origins)O(e,n.root)&&ce(n)}function St(e){ye(e)}function Tt(e,t,n,o){let a="nativeEvent"in e?e.nativeEvent:e,l=ve(a);if(!O(t,l))return;let c={owner:n,action:o,root:t,control:zr(l,t)??l,owned:[],valid:!0};return ye(t.ownerDocument).origins.add(c),c}var _n=new WeakMap;function Gn(e){let t=V(e.ownerDocument);t&&O(e,t)&&(ye(e.ownerDocument).last=t,_n.set(e,t))}function Pt(e,t){if(!e)return!1;let{last:n}=ye(t);return!!n&&(O(e,n)||_n.get(e)===n)&&(!n.isConnected||n===ye(t).disabled)&&xt(t)}function X(e,t){let{root:n,origin:o,removed:a}=t;if(!e||!e.isConnected)return!1;let l=n.ownerDocument;if(ye(l),t.stillCurrent&&!t.stillCurrent()||!(o?o.valid&&o.owner===t.owner&&(jr(n)||Pt(a??o.control,l)):Pt(a,l)||t.enterModal===!0&&e===n&&e.matches(In)))return!1;e.focus({preventScroll:t.preventScroll??!1});let s=V(l)===e;return s?ye(l).last=e:t.missed?.(),s}var zn=new WeakMap,jn=e=>{let t=zn.get(e);return t||zn.set(e,t=new Set),t};function Mt(e){let t=Wn(null),n=Wn({});return $n(()=>{St(document);let o=jn(document),a=n.current;return()=>{o.delete(a)}},[]),$n(()=>{let o=jn(document),a=t.current;if(!a||a.isConnected)return void o.delete(n.current);if(!Pt(a,document))return t.current=null,void o.delete(n.current);let l=e().find(c=>c?.isConnected);if(!(l instanceof HTMLElement))return void o.add(n.current);t.current=null,o.delete(n.current),X(l,{root:l,owner:"",removed:a})}),o=>{t.current=o.target}}import{createContext as Vr,useContext as _r,useEffect as Rt,useMemo as Ft,useRef as Y,useState as Gr}from"react";import{jsx as Qr}from"react/jsx-runtime";var Lt=Vr(null),Ae=()=>_r(Lt),Xn=new WeakMap,Xr=0;function Re(e,t){let n=Xn.get(e);return n===void 0&&Xn.set(e,n=++Xr),`${n}:${t}`}function Yn(e,t,n,o,a=l=>l){let l=Y(null),c=Y(t);c.current=t;let s=Y(a);s.current=a,Rt(()=>{let u=e.current;if(u)return St(u.ownerDocument),()=>Vn(u)},[e]);let h=Ft(()=>({root:()=>e.current,owner:()=>c.current,ownerOf:u=>s.current(u),originFor(u,p){let f=l.current,M=e.current;return f&&M?Tt(f,M,p??c.current,u):void 0},composer:()=>n.current,transcript:()=>o.current}),[e,n,o,t]),b=u=>{let p=u.nativeEvent;l.current=p,Zn(()=>{l.current===p&&(l.current=null)})};return{value:h,captureProps:{onClickCapture:b,onKeyDownCapture:b,onPointerDownCapture:b}}}function It(e,t,n){let[o,a]=Gr({active:e,conversationId:t});o.active!==e&&a({active:e,conversationId:t});let l=e&&o.active&&o.conversationId!==t,c=Y(n);return c.current=n,Rt(()=>{l&&c.current()},[l]),l}var Zn=e=>setTimeout(e,0);function Yr(e){return!!e?.closest('textarea, select, [contenteditable]:not([contenteditable="false"]), input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="image"])')}function Jn(e){if(!e)return!1;let t=V(e.ownerDocument);return O(e,t)&&!Yr(t)}function ee(e,t,n){let{origin:o,removed:a,fallback:l}=n,c=e?.root(),s=(u,p)=>!!c&&(!!o||!!a)&&X(u,{root:c,origin:o,removed:a,owner:n.owner,stillCurrent:n.stillCurrent,preventScroll:!0,missed:p}),h=!1,b=s(t,()=>h=!0);return!b&&h&&l&&l!==t&&(b=s(l)),(!n.keep||!b)&&ce(o),b}function Nt(e,t,n,o){t.current?.element!==e&&(t.current={element:e,opener:V(e.ownerDocument)}),o?.(),X(e,{root:e,owner:"",enterModal:!0,stillCurrent:n})}function Dt(e,t,n){let o=e.current;o&&queueMicrotask(()=>{if(e.current!==o)return;let a=n?.(),l=oe(o.opener)?o.opener:a,c={root:o.element,owner:"",removed:o.element,stillCurrent:t,preventScroll:!0};X(l,{...c,missed:()=>{a!==l&&X(a,c)}}),o.element.isConnected||(e.current=void 0)})}function At({as:e,focusInto:t,restoreFocus:n,...o}){let a=Y(void 0),l=Y(void 0);return Rt(()=>()=>{a.current?.(),a.current=void 0},[]),Qr(e,{...o,focusInto:c=>{if(a.current?.(),t){let s=!1,h=()=>{a.current=Et(c),s=!0};t(c,h),s||h()}else Nt(c,l,void 0,()=>{a.current=Et(c)})},restoreFocus:c=>{Gn(c),a.current?.(),a.current=void 0,n?n(c):Dt(l)}})}function Ot(e,t,n){let o=Ae(),a=Y(void 0),l=Y(void 0),c=Y(t);c.current=t;let s=Y(n);return s.current=n,Ft(()=>o?{focusInto(h,b){let u=o.owner(),p=o.originFor(`drawer:${e}`,u);if(a.current={origin:p,key:u},!p){Nt(h,l,()=>o.owner()===u&&(c.current?.()??!0),b);return}l.current=void 0,ee(o,h,{origin:p,owner:u,stillCurrent:()=>o.owner()===u&&(c.current?.()??!0),keep:!0})},restoreFocus(h){let b=a.current;if(a.current=void 0,!b)return;if(!b.origin){Dt(l,()=>o.owner()===b.key,()=>{let p=s.current?.();return oe(p??null)?p:o.transcript()});return}let u={origin:b.origin,key:b.key};queueMicrotask(()=>Zr(o,h,u,s.current?.()))},release(){let h=a.current;a.current=void 0,ce(h?.origin)}}:{},[o,e])}function Zr(e,t,n,o){let a=V(t.ownerDocument);if(!O(t,a)&&a&&a!==t.ownerDocument.body)return ce(n.origin);let l=n.origin.control,c=oe(o??null)?o:e.transcript(),s=oe(l)?l:c;ee(e,s,{origin:n.origin,owner:n.key,stillCurrent:()=>e.owner()===n.key,removed:t,fallback:c})}var Ye=null;function Zo(e,t,n){let o=Tt(e.nativeEvent,t,"form-field","open");if(!o)return n?.();let a={origin:o,claimed:!1,settled:n};Ye=a,Zn(()=>{Ye===a&&(Ye=null),a.claimed||(ce(o),a.settled?.())})}function Jo(){let e=Y(void 0),t=Y(void 0);return Ft(()=>({focusInto(n){let o=Ye??void 0;if(e.current=o,!o){Nt(n,t);return}t.current=void 0;let a=o.origin;o.claimed=!0,a.owned.push(n),X(n,{root:a.root,origin:a,owner:a.owner,preventScroll:!0})},restoreFocus(n){let o=e.current;if(e.current=void 0,!o){Dt(t);return}queueMicrotask(()=>{Jr(n,o.origin),o.settled?.()})}}),[])}function Jr(e,t){let n=[...t.root.querySelectorAll("*")].find(oe),o={root:e,origin:t,removed:e,owner:t.owner,preventScroll:!0},a=!oe(t.control);a||X(t.control,{...o,missed:()=>a=!0}),a&&n&&n!==t.control&&X(n,o),ce(t)}import{useEffect as qo,useState as $e,useSyncExternalStore as zo}from"react";import{createContext as Zt,useContext as _,useEffect as ae,useLayoutEffect as ke,useMemo as Jt,useRef as S,useState as K,useId as Ue,useSyncExternalStore as vo,lazy as yo,Suspense as wo,Component as ko}from"react";var eo=/[--]/g;function Bt(e,t=120){let n=e.replace(eo,"").replace(/\s+/g," ").trim();if(!n||typeof Intl.Segmenter!="function")return;let o=[];for(let a of new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(n)){if(o.length===t)return`${o.join("")}\u2026`;o.push(a.segment)}return n}var Ze=class{owner;policy=[];byId=new Map;begin(t,n,o){if(t!==this.owner||n.length!==this.policy.length||n.some((l,c)=>l!==this.policy[c])){this.owner=t,this.policy=n,this.byId=new Map;return}if(!this.byId.size)return;let a=new Map(o.map(l=>[l.id,l.source]));for(let[l,c]of this.byId)(!a.has(l)||a.get(l)!==c.source)&&this.byId.delete(l)}get(t,n,o){let a=this.byId.get(t);if(a&&a.source===n)return a.value;let l=o(n);return this.byId.set(t,{source:n,value:l}),l}entries(){return[...this.byId].map(([t,n])=>({id:t,source:n.source}))}};import{useLayoutEffect as Qn,useRef as er,useState as to}from"react";var tr=24,Ht=150,no=100,ro=new Set(["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "]),oo="[data-message-id]",Fe=e=>Math.max(0,e.scrollHeight-e.clientHeight),nr=e=>e.scrollHeight-e.clientHeight-e.scrollTop,Je=()=>performance.now(),ao=e=>typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16),Ut=e=>[...e.querySelectorAll(oo)].filter(t=>t.closest(".wp-transcript")===e),Qe=e=>e.getAttribute("data-message-id");function rr(e,t,n,o,a){let[l,c]=to(!0),s=er({pinned:!0,token:void 0,expected:[],lastTop:0,sizeFrame:!1,anchor:void 0,shown:void 0}).current,h=m=>{s.pinned=m,c(m)},b=()=>{clearTimeout(s.token?.timer),s.token=void 0},u=(m,P)=>{let C=Math.min(Math.max(0,P),Fe(m));s.expected.push({top:C,at:Je()}),typeof m.scrollTo=="function"?m.scrollTo({top:C,behavior:"instant"}):m.scrollTop=C,s.lastTop=m.scrollTop},p=m=>{let P=m.getBoundingClientRect().top,C=Ut(m),L=C.find(E=>E.getBoundingClientRect().bottom>P+.5);s.anchor=L&&{id:Qe(L),offset:L.getBoundingClientRect().top-P,order:C.map(Qe)}},f=m=>{let P=s.anchor;if(!P)return p(m);let C=new Map(Ut(m).map(R=>[Qe(R),R])),L=P.order.indexOf(P.id),E=C.get(P.id)??P.order.slice(L+1).map(R=>C.get(R)).find(Boolean)??P.order.slice(0,Math.max(0,L)).reverse().map(R=>C.get(R)).find(Boolean);if(!E)u(m,0);else{let R=E.getBoundingClientRect().top-m.getBoundingClientRect().top-P.offset;Math.abs(R)>.5&&u(m,m.scrollTop+R)}p(m)},M=()=>{let m=e.current;m&&(s.token&&!s.token.used&&!s.token.held&&b(),s.pinned?nr(m)>.5&&u(m,Fe(m)):f(m))},d=er(M);return d.current=M,Qn(()=>{let m=o===0;(n!==s.shown||m)&&(s.shown=n,s.anchor=void 0,b(),s.pinned||h(!0)),M()},[a,n,o]),Qn(()=>{let m=e.current;if(!m)return;let P=m.ownerDocument,C=v=>{clearTimeout(v.timer);let y=()=>{if(s.token!==v||v.held)return;let k=Je()-Math.max(v.lastInput,v.lastScroll);k>=Ht?s.token=void 0:v.timer=setTimeout(y,Ht-k)};v.timer=setTimeout(y,Ht)},L=v=>{let y=s.token??={used:!1,held:!1,lastInput:0,lastScroll:0};y.lastInput=Je(),v&&(y.held=!0),C(y)},E=()=>{let v=s.token;v?.held&&(v.held=!1,C(v))},R=()=>L(),N=()=>L(!0),W=v=>{ro.has(v.key)&&O(m,V(P))&&L()},se=()=>{let v=m.scrollTop,y=s.lastTop;s.lastTop=v;let k=Je();s.expected=s.expected.filter(Ce=>k-Ce.at<no);let q=s.expected.findIndex(Ce=>Math.abs(Ce.top-v)<=1),ie=s.token,D=Fe(m),le=Math.abs(v-D)<=1&&y>D+.5,he=q>=0||!ie||le||s.sizeFrame&&Math.abs(v-D)<=1;q>=0&&s.expected.splice(0,q+1),he||(ie.used=!0,ie.lastScroll=k,C(ie),v<y-.5?h(!1):v>y+.5&&nr(m)<=tr&&!s.pinned&&h(!0)),s.pinned||p(m)};m.addEventListener("wheel",R,{passive:!0}),m.addEventListener("touchstart",N,{passive:!0}),m.addEventListener("touchmove",R,{passive:!0}),m.addEventListener("pointerdown",N),m.addEventListener("keydown",W),m.addEventListener("scroll",se,{passive:!0});for(let v of["pointerup","pointercancel","touchend","touchcancel"])P.addEventListener(v,E,!0);let w=typeof ResizeObserver=="function"?new ResizeObserver(()=>{s.sizeFrame=!0,ao(()=>s.sizeFrame=!1),d.current()}):void 0;return w?.observe(m),t.current&&w?.observe(t.current),()=>{m.removeEventListener("wheel",R),m.removeEventListener("touchstart",N),m.removeEventListener("touchmove",R),m.removeEventListener("pointerdown",N),m.removeEventListener("keydown",W),m.removeEventListener("scroll",se);for(let v of["pointerup","pointercancel","touchend","touchcancel"])P.removeEventListener(v,E,!0);w?.disconnect(),b()}},[e,t]),{pinned:l,toLatest(){let m=e.current;m&&(b(),u(m,Fe(m)),h(!0))},toMessage(m){let P=e.current,C=P&&Ut(P).find(R=>Qe(R)===m);if(!P||!C)return;b();let L=Math.min(Fe(P),P.scrollTop+C.getBoundingClientRect().top-P.getBoundingClientRect().top);u(P,L);let E=Fe(P)-L<=tr;return h(E),E||p(P),C}}}import{useEffect as Wt,useRef as Kt,useState as ar}from"react";var so=1e3,io=e=>`\u2068${e}\u2069`,sr=()=>typeof requestAnimationFrame=="function",lo=e=>sr()?requestAnimationFrame(e):setTimeout(e,16),$t=e=>{sr()?cancelAnimationFrame(e):clearTimeout(e)};function or(e){if(e.role!=="assistant")return;let t=e.status;if(t==null)return"arrived";if(t==="completed")return"completed";if(t==="failed"||t==="unavailable")return"failed"}function ir(e,t,n,o,a){let[l,c]=ar(""),s=Kt({baselineFor:void 0,baseline:new Set,announced:new Map,writing:new Set,held:void 0,pending:new Map,batchFor:void 0,timer:void 0,frame:void 0,showing:0,batchShowing:0,client:void 0}).current,h=Kt({conversation:t,excerptOf:n,t:o});h.current={conversation:t,excerptOf:n,t:o};let b=(f,M)=>{let d=s.announced.get(f),m=!!d&&(d.has("completed")||d.has("failed"));return M==="arrived"?!m&&!d?.has("arrived")&&!s.writing.has(f):!m},u=()=>{s.timer=void 0;let f=[...s.pending],M=s.batchFor,d=s.batchShowing;s.pending.clear(),s.frame!==void 0&&$t(s.frame),c(""),s.frame=lo(()=>{s.frame=void 0,d===s.showing&&p(f,M)})},p=(f,M)=>{let d=a?.current;if(d?.closest("[inert]")){for(let[y,k]of f)s.pending.set(y,k);s.held??=new MutationObserver(()=>{d.closest("[inert]")||(s.held?.disconnect(),s.held=void 0,u())}),s.held.observe(d.ownerDocument.documentElement,{attributes:!0,attributeFilter:["inert"],subtree:!0});return}let{conversation:m,excerptOf:P,t:C}=h.current;if(!m||m.id!==M)return;let L=new Map(m.messages.map(y=>[y.id,y])),E=f.flatMap(([y])=>{let k=L.get(y),q=k&&or(k);return k&&q&&b(y,q)?[{id:y,stage:q,message:k}]:[]});if(!E.length)return;let R=new Map(m.messages.map((y,k)=>[y.id,k]));E.sort((y,k)=>R.get(y.id)-R.get(k.id));let N=E.length,W=E.filter(y=>y.stage==="failed").length,se=E.filter(y=>y.stage==="completed"),w=y=>{let k=P(y);return k===void 0?void 0:io(k)},v;if(N===1){let[y]=E,k=y.stage==="completed"?w(y.message):void 0;v=y.stage==="failed"?C("chat.arrivalFailed"):k!==void 0?C("chat.arrivalExcerpt",{excerpt:k}):C("chat.arrival")}else if(se.length===N){let y=w(se.at(-1).message);v=y!==void 0?C("chat.arrivalMany",{count:N,excerpt:y}):C("chat.arrivalManyPlain",{count:N})}else W===N?v=C("chat.arrivalAllFailed",{count:N}):W?v=C("chat.arrivalManyFailed",{count:N,failed:W}):v=C("chat.arrivalManyPlain",{count:N});for(let y of E){let k=s.announced.get(y.id)??new Set;k.add(y.stage),s.announced.set(y.id,k)}c(v)};return Wt(()=>{if(s.client!==e&&(s.client=e,s.baselineFor=void 0),!t){s.baselineFor=void 0;return}if(s.baselineFor!==t.id){s.baselineFor=t.id,s.showing++,s.baseline=new Set(t.messages.map(f=>f.id)),s.announced.clear(),s.writing.clear(),s.pending.clear(),clearTimeout(s.timer),s.timer=void 0,s.frame!==void 0&&$t(s.frame),s.frame=void 0;return}for(let f of t.messages){if(s.baseline.has(f.id))continue;f.status==="writing"&&s.writing.add(f.id);let M=or(f);!M||!b(f.id,M)||(s.pending.size||(s.batchFor=t.id,s.batchShowing=s.showing),s.pending.set(f.id,M))}s.pending.size&&s.timer===void 0&&(s.timer=setTimeout(u,so))},[e,t]),Wt(()=>()=>{clearTimeout(s.timer),s.frame!==void 0&&$t(s.frame),s.held?.disconnect()},[s]),l}function lr(e,t){let[n,o]=ar(!1),a=Kt(e);return Wt(()=>{let l=t.current;if(!l||typeof MutationObserver!="function")return;let c=()=>o(!!l.closest("[inert]"));c();let s=new MutationObserver(c);return s.observe(l.ownerDocument.documentElement,{attributes:!0,attributeFilter:["inert"],subtree:!0}),()=>s.disconnect()},[t]),n||(a.current=e),a.current}var co={"form.valid":"Valid","form.invalid":"Invalid","form.title":"Fill this form","form.closeHint":"Closing discards this fill; the reply stays in the conversation.","form.generate":"Generate draft","form.references":"Reference links","form.attachment":"Private attachment","form.regenerate":"Regenerate {field}","form.replace":"Replace your edit?","form.marker":"Form","form.filter":"Filter by topic","form.all":"All topics","form.threads":"Sub-threads","form.return":"Back to form or record","form.unlinked":"Saved, not linked","form.toolsLoading":"Draft tools are still loading.","form.toolsFailed":"Draft tools couldn't load. Retry first.","form.fixFirst":"Fix the highlighted fields first.","form.number":"Enter a number.","form.editInForm":"Edit this value in the form.","form.imagesNow":"Images can't be attached right now.","form.imagesHere":"Images can't be attached here.","chat.title":"Conversation","chat.empty":"Start a conversation","chat.message":"Message","chat.send":"Send","chat.sending":"Sending","chat.pendingSending":"Sending\u2026","chat.pendingFailed":"Not sent","chat.planUnavailable":"The plan's steps could not be loaded.","chat.arrival":"New reply","chat.arrivalExcerpt":"New reply: {excerpt}","chat.arrivalFailed":"A reply could not be completed.","chat.arrivalMany":"{count} new replies. Latest: {excerpt}","chat.arrivalManyPlain":"{count} new replies","chat.arrivalManyFailed":"{count} new replies; {failed} could not be completed.","chat.arrivalAllFailed":"{count} replies could not be completed.","chat.transcript":"Messages","chat.outlineItem":"{role}, message {position}: {excerpt}","chat.outlineItemPlain":"{role}, message {position}","chat.roleUser":"You","chat.roleAssistant":"Assistant","chat.messageLoading":"Loading message\u2026","chat.messageUnavailable":"This message cannot be shown right now.","chat.changesTo":"changes to","chat.stepName":"Change {index}","chat.stepNamed":"{name} {index}","chat.fieldName":"Value {index}","chat.scrollRegion":"Scrollable content","chat.conversationReadFailed":"This conversation could not be loaded.","chat.conversationsFailed":"Your conversations could not be loaded.","chat.messagesUnavailable":"Some messages cannot be shown right now.",unsupportedContent:"Some content cannot be shown here. Contact the site administrator.","chat.failure":"The request could not be completed.","chat.update":"This chat needs an update.","chat.conversationUnavailable":"This conversation is unavailable. Reload to continue; this does not stop a server turn.","chat.reload":"Reload conversation","chat.retry":"Retry","chat.withdraw":"Withdraw","chat.restored":"Withdrawn messages","chat.restoredEdit":"Edit","chat.restoredDiscard":"Discard","chat.dismiss":"Dismiss","chat.latest":"Back to latest","chat.latestNew":"{count, plural, one {Back to latest, # new reply} other {Back to latest, # new replies}}","chat.outline":"Message outline","chat.rail":"Conversations","chat.close":"Close","chat.quota":"Usage","chat.actions":"Actions","chat.panels":"Extra panels","chat.submit":"Submit","chat.confirm":"Confirm","chat.cancel":"Cancel","chat.stop":"Stop","chat.planChanged":"The plan changed; confirm again.","chat.stopped":"The plan was stopped. Start a new plan to continue.","chat.scheduleUnavailable":"Scheduling is unavailable in this chat.","chat.start":"Start time","chat.end":"End time","chat.view":"View change","chat.irreversible":"Cannot be undone","chat.stepUp":"{count, plural, one {# verification prompt} other {# verification prompts}}","chat.stepUpLabel":"Verification code","chat.plan":"Plan","chat.favourite":"Favourite","chat.run":"Run","chat.flows":"Saved requests","flow.favourites":"Favourites","flow.most-used":"Most used","flow.recent":"Recent","flow.presets":"Presets","reply.writing":"Writing","reply.stopped":"Stopped","chat.sources":"Sources ({count})","chat.source":"Source {index}: {title}","reply.unavailable":"Reply unavailable","reply.failed":"Reply failed","reply.overdue":"Reply overdue","chat.loading":"Loading","chat.before":"Before","chat.after":"After","chat.undo":"Undo","chat.verify":"Verification required","chat.startupLoading":"Loading this conversation\u2026"},et={en:{},zh:{}};function cr(e,t){Object.assign(et.en,e),Object.assign(et.zh,t)}var uo={"form.valid":"\u6709\u6548","form.invalid":"\u65E0\u6548","form.title":"\u586B\u5199\u6B64\u8868\u5355","form.closeHint":"\u5173\u95ED\u5C06\u4E22\u5F03\u672C\u6B21\u586B\u5145\uFF1B\u56DE\u590D\u4ECD\u4FDD\u7559\u5728\u5BF9\u8BDD\u4E2D\u3002","form.generate":"\u751F\u6210\u8349\u7A3F","form.references":"\u53C2\u8003\u94FE\u63A5","form.attachment":"\u79C1\u6709\u9644\u4EF6","form.regenerate":"\u91CD\u65B0\u751F\u6210{field}","form.replace":"\u66FF\u6362\u4F60\u7684\u4FEE\u6539\u5417\uFF1F","form.marker":"\u8868\u5355","form.filter":"\u6309\u4E3B\u9898\u7B5B\u9009","form.all":"\u6240\u6709\u4E3B\u9898","form.threads":"\u5B50\u5BF9\u8BDD","form.return":"\u8FD4\u56DE\u8868\u5355\u6216\u8BB0\u5F55","form.unlinked":"\u5DF2\u4FDD\u5B58\uFF0C\u672A\u5173\u8054","form.toolsLoading":"\u8349\u7A3F\u5DE5\u5177\u4ECD\u5728\u52A0\u8F7D\u3002","form.toolsFailed":"\u8349\u7A3F\u5DE5\u5177\u65E0\u6CD5\u52A0\u8F7D\uFF0C\u8BF7\u5148\u91CD\u8BD5\u3002","form.fixFirst":"\u8BF7\u5148\u4FEE\u6B63\u6807\u51FA\u7684\u5B57\u6BB5\u3002","form.number":"\u8BF7\u8F93\u5165\u6570\u5B57\u3002","form.editInForm":"\u8BF7\u5728\u8868\u5355\u4E2D\u7F16\u8F91\u6B64\u503C\u3002","form.imagesNow":"\u73B0\u5728\u65E0\u6CD5\u9644\u52A0\u56FE\u7247\u3002","form.imagesHere":"\u6B64\u5904\u65E0\u6CD5\u9644\u52A0\u56FE\u7247\u3002","chat.title":"\u5BF9\u8BDD","chat.empty":"\u5F00\u59CB\u5BF9\u8BDD","chat.message":"\u6D88\u606F","chat.send":"\u53D1\u9001","chat.sending":"\u6B63\u5728\u53D1\u9001","chat.pendingSending":"\u6B63\u5728\u53D1\u9001\u2026\u2026","chat.pendingFailed":"\u672A\u53D1\u9001","chat.planUnavailable":"\u65E0\u6CD5\u52A0\u8F7D\u6B64\u8BA1\u5212\u7684\u6B65\u9AA4\u3002","chat.arrival":"\u6536\u5230\u65B0\u56DE\u590D","chat.arrivalExcerpt":"\u6536\u5230\u65B0\u56DE\u590D\uFF1A{excerpt}","chat.arrivalFailed":"\u6709\u4E00\u6761\u56DE\u590D\u672A\u80FD\u5B8C\u6210\u3002","chat.arrivalMany":"\u6536\u5230 {count} \u6761\u65B0\u56DE\u590D\u3002\u6700\u65B0\u4E00\u6761\uFF1A{excerpt}","chat.arrivalManyPlain":"\u6536\u5230 {count} \u6761\u65B0\u56DE\u590D","chat.arrivalManyFailed":"\u6536\u5230 {count} \u6761\u65B0\u56DE\u590D\uFF0C\u5176\u4E2D {failed} \u6761\u672A\u80FD\u5B8C\u6210\u3002","chat.arrivalAllFailed":"{count} \u6761\u56DE\u590D\u672A\u80FD\u5B8C\u6210\u3002","chat.transcript":"\u6D88\u606F","chat.outlineItem":"{role}\uFF0C\u7B2C {position} \u6761\uFF1A{excerpt}","chat.outlineItemPlain":"{role}\uFF0C\u7B2C {position} \u6761","chat.roleUser":"\u4F60","chat.roleAssistant":"\u52A9\u624B","chat.messageLoading":"\u6B63\u5728\u52A0\u8F7D\u6D88\u606F\u2026\u2026","chat.messageUnavailable":"\u6682\u65F6\u65E0\u6CD5\u663E\u793A\u6B64\u6D88\u606F\u3002","chat.changesTo":"\u6539\u4E3A","chat.stepName":"\u66F4\u6539 {index}","chat.stepNamed":"{name} {index}","chat.fieldName":"\u503C {index}","chat.scrollRegion":"\u53EF\u6EDA\u52A8\u5185\u5BB9","chat.conversationReadFailed":"\u65E0\u6CD5\u52A0\u8F7D\u6B64\u5BF9\u8BDD\u3002","chat.conversationsFailed":"\u65E0\u6CD5\u52A0\u8F7D\u4F60\u7684\u5BF9\u8BDD\u5217\u8868\u3002","chat.messagesUnavailable":"\u90E8\u5206\u6D88\u606F\u6682\u65F6\u65E0\u6CD5\u663E\u793A\u3002",unsupportedContent:"\u6B64\u5904\u65E0\u6CD5\u663E\u793A\u90E8\u5206\u5185\u5BB9\u3002\u8BF7\u8054\u7CFB\u7AD9\u70B9\u7BA1\u7406\u5458\u3002","chat.failure":"\u65E0\u6CD5\u5B8C\u6210\u8BF7\u6C42\u3002","chat.update":"\u6B64\u5BF9\u8BDD\u9700\u8981\u66F4\u65B0\u540E\u624D\u80FD\u7EE7\u7EED\u4F7F\u7528\u3002","chat.conversationUnavailable":"\u6B64\u5BF9\u8BDD\u6682\u65F6\u65E0\u6CD5\u4F7F\u7528\u3002\u8BF7\u91CD\u65B0\u52A0\u8F7D\u540E\u7EE7\u7EED\uFF1B\u91CD\u65B0\u52A0\u8F7D\u4E0D\u4F1A\u505C\u6B62\u670D\u52A1\u5668\u6B63\u5728\u5904\u7406\u7684\u56DE\u590D\u3002","chat.reload":"\u91CD\u65B0\u52A0\u8F7D\u5BF9\u8BDD","chat.retry":"\u91CD\u8BD5","chat.withdraw":"\u64A4\u56DE","chat.restored":"\u5DF2\u64A4\u56DE\u7684\u6D88\u606F","chat.restoredEdit":"\u7F16\u8F91","chat.restoredDiscard":"\u4E22\u5F03","chat.dismiss":"\u5173\u95ED","chat.latest":"\u56DE\u5230\u6700\u65B0\u6D88\u606F","chat.latestNew":"{count, plural, other {\u56DE\u5230\u6700\u65B0\u6D88\u606F\uFF0C# \u6761\u65B0\u56DE\u590D}}","chat.outline":"\u6D88\u606F\u5927\u7EB2","chat.rail":"\u5BF9\u8BDD\u5217\u8868","chat.close":"\u5173\u95ED","chat.quota":"\u4F7F\u7528\u91CF","chat.actions":"\u64CD\u4F5C","chat.panels":"\u9644\u52A0\u9762\u677F","chat.submit":"\u63D0\u4EA4","chat.confirm":"\u786E\u8BA4","chat.cancel":"\u53D6\u6D88","chat.stop":"\u505C\u6B62","chat.planChanged":"\u8BA1\u5212\u5DF2\u66F4\u6539\uFF0C\u8BF7\u91CD\u65B0\u786E\u8BA4\u3002","chat.stopped":"\u8BA1\u5212\u5DF2\u505C\u6B62\u3002\u8BF7\u521B\u5EFA\u65B0\u8BA1\u5212\u4EE5\u7EE7\u7EED\u3002","chat.scheduleUnavailable":"\u6B64\u804A\u5929\u4E0D\u652F\u6301\u6392\u671F\u3002","chat.start":"\u5F00\u59CB\u65F6\u95F4","chat.end":"\u7ED3\u675F\u65F6\u95F4","chat.view":"\u67E5\u770B\u4FEE\u6539","chat.irreversible":"\u65E0\u6CD5\u64A4\u9500","chat.stepUp":"{count, plural, other {# \u6B21\u9A8C\u8BC1}}","chat.stepUpLabel":"\u9A8C\u8BC1\u7801","chat.plan":"\u8BA1\u5212","chat.favourite":"\u6536\u85CF","chat.run":"\u8FD0\u884C","chat.flows":"\u5DF2\u4FDD\u5B58\u7684\u8BF7\u6C42","flow.favourites":"\u6536\u85CF","flow.most-used":"\u6700\u5E38\u7528","flow.recent":"\u6700\u8FD1","flow.presets":"\u9884\u8BBE","reply.writing":"\u6B63\u5728\u56DE\u590D","reply.stopped":"\u5DF2\u505C\u6B62","chat.sources":"\u6765\u6E90\uFF08{count}\uFF09","chat.source":"\u6765\u6E90 {index}\uFF1A{title}","reply.unavailable":"\u65E0\u6CD5\u56DE\u590D","reply.failed":"\u56DE\u590D\u5931\u8D25","reply.overdue":"\u56DE\u590D\u5DF2\u8D85\u65F6","chat.loading":"\u52A0\u8F7D\u4E2D","chat.before":"\u4FEE\u6539\u524D","chat.after":"\u4FEE\u6539\u540E","chat.undo":"\u64A4\u9500","chat.verify":"\u9700\u8981\u9A8C\u8BC1","chat.startupLoading":"\u6B63\u5728\u52A0\u8F7D\u6B64\u5BF9\u8BDD\u2026"},fo=/^(tw|hk|mo)$/,po=/^(zh|cmn)$/,mo=/^([a-z]{2,3}(-[a-z]{3}){0,3}|[a-z]{4,8})(-[a-z]{4})?(-([a-z]{2}|\d{3}))?(-([a-z\d]{5,8}|\d[a-z\d]{3}))*(-[\da-wyz](-[a-z\d]{2,8})+)*(-x(-[a-z\d]{1,8})+)?$/,ho=/^zh-(hakka|min|xiang)\b/;function qt(e="en"){let t={catalogue:"en",lang:"en"},n=e.toLowerCase();if(!mo.test(n)||ho.test(n))return t;let o=n.split("-"),a=o[0],l=1;for(;/^[a-z]{3}$/.test(o[l]);)a=o[l++];if(po.test(a)){let c=o[l];return(/^[a-z]{4}$/.test(c)?c==="hans":!fo.test(c))?{catalogue:"zh",lang:e}:t}return a==="en"?{catalogue:"en",lang:e}:t}function Oe(e="en"){let t=qt(e),n=t.catalogue==="zh",o=n?uo:co,a=n?et.zh:et.en,l=Fn(t.lang,n),c=new Map;return(s,h)=>{let b=c.get(s);if(!b){let u=o[s]??a[s];if(u===void 0)return"";b=new Rn(u,l),c.set(s,b)}return String(b.format(h))}}import{useSyncExternalStore as go}from"react";var zt=new Set,bo=e=>(zt.add(e),()=>zt.delete(e));function we(e){let t=o=>{n.load=o;for(let a of zt)a()},n={load:{status:"idle"},request(o){let{status:a}=n.load;a!=="idle"&&!(o&&a==="failed")||(t({status:"loading",...a==="failed"&&{retrying:!0}}),e().then(l=>t({status:"ready",module:l}),()=>t({status:"failed"})))}};return n}function pe(e){return go(bo,()=>e.load,()=>e.load)}import{Fragment as tn,jsx as i,jsxs as x}from"react/jsx-runtime";var tt=we(()=>import("./markdown-ETLB66BK.js")),Qt=Zt(null),kr=Zt(void 0);function Co({id:e}){let t=_(Qt);return ae(()=>(t?.report(e,!0),()=>t?.report(e,!1)),[t,e]),null}function xo(){let e=pe(tt);return e.status==="ready"?e.module:void 0}var Be=e=>`wp${Ue().replace(/[^\w-]/g,"")}-${e}`,jt=we(()=>import("./recovery-panel-VOKVDDZD.js")),Po=yo(()=>import("./confirmation-view-CICNJJIO.js")),Gt=we(()=>import("./blocks-UJ7GUJHD.js")),dr=we(()=>import("./reply-controls-5CWIAKIG.js"));function Eo(e){let t=pe(dr);return ae(()=>dr.request(),[]),t.status==="ready"?i(t.module.ReplyControls,{...e}):null}var ur=we(()=>import("./message-actions-3HGE6VTS.js"));function So(e){let t=pe(ur);return ae(()=>ur.request(),[]),t.status==="ready"?i(t.module.MessageActions,{...e}):null}var Vt=we(()=>import("./flows-panel-YEJ36RTY.js"));function en(){let e=pe(Gt);return ae(()=>Gt.request(),[]),e}function To({block:e}){let t=en();return t.status==="ready"?i(t.module.Answered,{block:e}):null}function Mo(e){let{format:t}=U(),n=en(),o=i("p",{children:e.block.fallback});if(n.status==="failed")return o;if(n.status!=="ready")return i("p",{children:t("chat.messageLoading")});let a=n.module.default;return i(He,{resetKey:e.block.id,fallback:o,children:i(a,{...e})})}var te=Zt(null);function Ro({children:e,onPress:t,disabled:n,label:o,...a}){return i("button",{type:"button",onClick:t,disabled:n,"aria-label":o,...a,children:e})}function Fo({value:e,onChange:t,label:n,inputRef:o,onKeyDown:a,disabled:l,describedBy:c}){return i("textarea",{ref:o,disabled:l,value:e,onChange:s=>t?.(s.target.value),"aria-label":n,"aria-describedby":c,onKeyDown:a})}function fr({value:e,onChange:t,label:n,type:o="text",disabled:a,invalid:l,describedBy:c,required:s}){return x("label",{children:[n,i("input",{type:o,value:e,disabled:a,"aria-invalid":l,"aria-describedby":c,"aria-required":s||void 0,onChange:h=>t(h.target.value)})]})}function Lo({checked:e,onChange:t,label:n,disabled:o,invalid:a,describedBy:l}){return x("label",{className:"wp-check",children:[i("input",{type:"checkbox",checked:e,disabled:o,"aria-invalid":a,"aria-describedby":l,onChange:c=>t(c.target.checked)}),n]})}function Io({children:e,open:t,label:n,onClose:o,closeLabel:a,focusInto:l,restoreFocus:c}){let s=_(te)?.format??Oe(),h=S(null),b=S(l),u=S(c);b.current=l,u.current=c,ke(()=>{let f=h.current;if(!(!t||!f))return b.current?.(f),()=>u.current?.(f)},[t]);let p=Ue();return t?x("div",{ref:h,className:"wp-drawer",tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":p,onKeyDown:f=>{f.key==="Escape"&&o()},children:[x("div",{className:"wp-drawer-header",children:[i("h2",{id:p,children:n}),i("button",{type:"button",onClick:o,"aria-label":a??s("chat.close"),children:i("span",{"aria-hidden":"true",children:"\xD7"})})]}),i("div",{className:"wp-drawer-body",children:e})]}):null}var Cr={button:Ro,textarea:Fo,input:fr,checkbox:Lo,datePicker:e=>i(fr,{...e,type:"datetime-local"}),drawer:Io},pr="(prefers-color-scheme: dark)";function No(){return vo(e=>{let t=globalThis.matchMedia?.(pr);return t?.addEventListener("change",e),()=>t?.removeEventListener("change",e)},()=>globalThis.matchMedia?.(pr).matches?"dark":"light",()=>"light")}function Do(e){let t=e.useThemeTokens?.(),n=e.theme===void 0&&t&&(e.colorScheme===void 0||e.colorScheme===t.scheme)?"host":"waypoint",o=No(),a=e.colorScheme??t?.scheme??o,l=Jt(()=>({...e,colorScheme:a,format:e.format??Oe(e.locale),lang:e.format?e.locale??"en":qt(e.locale).lang,tokens:{...a==="dark"?Dn:Nn,...n==="host"?t.tokens:e.theme},primitives:{...Cr,...e.primitives}}),[e,a,n,t]),c=e.wrapper,s=i(On.Provider,{value:e.client,children:i(te.Provider,{value:l,children:e.children})});return c?i(c,{colorScheme:a,tokens:l.tokens,tokenSource:n,children:s}):s}function Ia(){return _(te)?.colorScheme??"light"}function U(){let e=_(te);if(!e)throw new Error("WaypointProvider is required");return e}function Na(){return U().client}function Da(e){let t=_(te),n=e??t?.client,o=Me(e);return{conversationId:o.conversationId,conversation:o.conversation,refresh:n.refresh,editMessage:n.editMessage,regenerate:n.regenerate,selectVersion:n.selectVersion,switchConversation:n.switchConversation}}function Aa(e){let t=_(te),n=e??t?.client,o=Me(e);return{draft:o.draft,sending:o.sending,hints:o.hints,setDraft:n.setDraft,send:n.send,retry:n.retry,withdraw:n.withdraw,dismiss:n.dismiss}}function Oa(e){let t=_(te),n=e??t?.client,o=Me(e),{view:a}=wt(e);return{plan:o.plan,setPlan:n.setPlan,reply:n.reply,view:a}}function Ba(e){let t=_(te),n=e??t?.client,o=Me(e);return{flows:o.flows,tab:o.flowTab,load:n.loadFlows,select:n.selectFlowTab,setFavourite:n.setFavourite,run:n.runFlow}}var Ha=["bubble","composer","transcript","replyRow","stepRow","planNode","widgetFrame","confirmBar","confirmation","topBar","rail","flowTabs","quotaStrip","failedSendControls","emptyState","messageActions","extraPanels","actionBar","stepUpPrompt","fieldAdornment","recoveryPanel","stepStatusRow","recoveryActions"];function xr({action:e,onPress:t,label:n}){let{format:o,primitives:a}=U(),l=a.button,c=Ue();return x(tn,{children:[i(l,{"data-action":e.id,"aria-disabled":e.available?void 0:!0,"aria-describedby":e.reasonKey?c:void 0,"aria-busy":e.busy?!0:void 0,onPress:e.available?()=>t(e.id):void 0,children:n??(e.countedLabelKey&&e.labelValues?o(e.countedLabelKey,e.labelValues):o(e.labelKey))}),e.reasonKey?i("span",{id:c,"data-reason":e.id,children:o(e.reasonKey,e.reasonValues)}):null]})}function mr(e){let t=S(!1),[n,o]=K(!1),a=()=>{t.current=!1,o(!1)};return{busy:n,press:()=>{t.current||(t.current=!0,o(!0),e().then(a,a))}}}function hr({problem:e,refresh:t}){let n=kt(e),o=Jt(()=>Date.now()+(e.retryAfter??0)*1e3,[e]),[a,l]=K(0),c=e.code==="rate-limited"&&Date.now()<o;return ae(()=>{if(!c)return;let s=setTimeout(()=>l(h=>h+1),Math.max(o-Date.now(),1));return()=>clearTimeout(s)},[c,o,a]),n?i(xr,{action:{id:"status",labelKey:n==="retry"?"chat.retry":"chat.problem.refresh",available:!c&&!t.busy,busy:t.busy,...c&&{reasonKey:"chat.problem.rateLimited"}},onPress:t.press}):null}function gr({problem:e}){let{format:t}=U();return t("chat.problem.details")?x("details",{"data-problem-details":"",children:[i("summary",{children:t("chat.problem.details")}),i("p",{children:t("chat.problem.code",{code:e.code})}),i("p",{children:t("chat.problem.reference",{id:e.id})})]}):null}var nt=e=>e.status==="loading"&&!!e.retrying;function Xt(e){let{format:t,primitives:n}=U(),o=e.retrying||void 0;return x(tn,{children:[x("p",{role:"alert",onFocus:e.onFocus,children:[t("chat.failure")," ",i(n.button,{"aria-disabled":o,"aria-busy":o,onPress:()=>{o||e.onRetry()},children:t("chat.retry")})]}),i("span",{role:"status",children:o?t("chat.loading"):""})]})}function Ao(e){let{format:t}=U(),n=pe(jt);ae(()=>jt.request(),[]);let o=S(null),a=Mt(()=>[o.current?.querySelector("h3")]),l=n.status==="ready"&&n.module.default;return i("div",{ref:o,tabIndex:-1,"data-recovery":"",children:l?i(l,{...e}):n.status==="failed"||nt(n)?i(Xt,{retrying:nt(n),onRetry:()=>jt.request(!0),onFocus:a}):i("p",{children:t("chat.loading")})})}function br(e){return{id:e.id,type:e.type,answered:!!e.answered}}function vr(e){return{id:e.id,content:e.content,failure:e.failure?{code:e.failure.code}:null}}function B({name:e,slots:t,children:n,...o}){let l=_(te)?.parts?.[e],c=t?.[e],s=c?c({...o,children:n}):l?i(l,{...o,children:n}):n;return i("div",{"data-part":e,children:s})}var He=class extends ko{state={};static getDerivedStateFromError(){return{failedKey:""}}componentDidCatch(){this.setState({failedKey:this.props.resetKey})}render(){let{failedKey:t}=this.state;return t===""||t===this.props.resetKey?this.props.fallback:this.props.children}};function Oo({text:e,writing:t,sources:n}){let o=U(),a=o.format,l=_(Qt),c=Ue(),s=_(kr)??c,h=l?i(Co,{id:s}):i("p",{children:a("chat.messageUnavailable")}),b=pe(tt);if(ae(()=>{tt.request(!0)},[e]),b.status==="failed")return h;if(b.status!=="ready")return i("p",{children:a("chat.messageLoading")});let u=b.module.default;return i(He,{resetKey:`${e}:${l?.retry??0}`,fallback:h,children:i(u,{text:e,writing:t,lang:o.lang,sources:n,sourceNames:{list:p=>a("chat.sources",{count:p}),item:(p,f)=>a("chat.source",{index:p,title:f})},images:o.markdownImages,extraSchemes:o.extraUrlSchemes,scrollLabel:a("chat.scrollRegion")})})}function Pr(e){let t=U().renderers?.markdown;return t?i(t,{text:e.text}):i(Oo,{...e})}function Bo(e,t){return{text:t(Un(e).key)||t("chat.failure")}}function Ho({block:e,onReply:t,disabled:n}){let{format:o,primitives:a,extraUrlSchemes:l}=U(),c=a.button,s=e.body;switch(e.type){case"form.fill":case"table":case"diff":case"form":case"choice":case"plan":return i(Mo,{block:e,onReply:t,disabled:n});case"markdown":return i(Pr,{text:String(s.text??"")});case"notice":return i("p",{children:String(s.text??"")});case"card":return x("section",{children:[i("h3",{children:String(s.title??"")}),(s.blocks??[]).map(h=>i(Yt,{block:h,disabled:n,onReply:t},h.id))]});case"details":return x("details",{children:[i("summary",{children:String(s.summary??"")}),(s.blocks??[]).map(h=>i(Yt,{block:h,disabled:n,onReply:t},h.id))]});case"list":return i("ul",{children:(s.items??[]).map((h,b)=>i("li",{children:h},b))});case"route-link":{let h=String(s.route??"");return Ge(h,l)?i("a",{href:h,children:String(s.label??o("chat.view"))}):i("span",{children:e.fallback})}case"buttons":return i("div",{children:(s.actions??[]).map(h=>i(c,{disabled:n,onPress:()=>t({kind:"action",blockId:e.id,actionId:h.id}),children:h.label},h.id))});default:return i("p",{children:e.fallback})}}var Uo=["markdown","form.fill","card","details","list","table","form","choice","buttons","diff","plan","route-link","notice"].map(e=>({type:e,render:Ho}));function Yt(e){let{widgets:t,format:n}=U(),o=t?.find(l=>l.type===e.block.type)??Uo.find(l=>l.type===e.block.type);if(!o)return i("div",{"data-fallback":"true",children:i("p",{children:e.block.fallback?.trim()?e.block.fallback:n("unsupportedContent")})});let a=o.render;return i(a,{...e})}function $o(e){let{format:t,primitives:n}=U(),o=en(),a=n.button,l=S(null),[c,s]=K(0),h=S(null);ke(()=>{let p=l.current;X(p,{root:p,owner:"",removed:h.current})});let b=x("p",{role:"alert",children:[t("chat.planUnavailable"),i(a,{onPress:()=>{h.current=document.activeElement,s(c+1),Gt.request(!0)},children:t("chat.retry")})]}),u=o.status==="ready"&&o.module.PlanSteps;return i("div",{ref:l,tabIndex:-1,children:u?i(He,{resetKey:`${e.record.id}:${c}`,fallback:b,children:i(u,{...e})}):o.status==="failed"?b:i("p",{children:t("chat.messageLoading")})})}function Ua(e){let t=_(te);return e.client?i(Do,{...e,client:e.client,children:i(wr,{...e})}):t?i(wr,{...e}):i("section",{className:"waypoint",dir:e.dir??"ltr",children:i("p",{children:Oe(e.locale)("chat.empty")})})}var yr="\uE000";function Wo({messages:e,excerpts:t,anchor:n,open:o,onToggle:a,onNavigate:l}){let{format:c,primitives:s}=U(),h=s.button,b=Be("outline");return x("nav",{"aria-label":c("chat.outline"),"data-outline":"",className:"wp-outline",children:[i(h,{"aria-expanded":o,"aria-controls":b,onPress:a,children:c("chat.outline")}),i("ol",{id:b,hidden:!o,role:"list",children:o?e.map((u,p)=>{let f={role:c(u.role==="user"?"chat.roleUser":"chat.roleAssistant"),position:p+1},M=t[p],d=M===void 0?void 0:c("chat.outlineItem",{...f,excerpt:yr}).split(yr);return i("li",{children:i("a",{href:`#${n(u.id)}`,"data-outline-link":u.id,onClick:m=>{m.preventDefault(),l(u.id)},children:d?d.length===2?x(tn,{children:[d[0],i("bdi",{children:M}),d[1]]}):i("bdi",{children:c("chat.outlineItem",{...f,excerpt:M})}):c("chat.outlineItemPlain",f)})},u.id)}):null})]})}function Ko({label:e,closeLabel:t,onClose:n,skipRestore:o,onFocusWithin:a,children:l}){let c=U().primitives.drawer,s=Ot("rail"),h=S(void 0),b=S(a);return b.current=a,i(At,{as:c,open:!0,label:e,closeLabel:t,onClose:n,focusInto:u=>{let p=f=>b.current(ve(f));u.addEventListener("focusin",p),h.current={element:u,listener:p},s.focusInto?.(u)},restoreFocus:u=>{let p=h.current;h.current=void 0,p?.element.removeEventListener("focusin",p.listener),o()?s.release?.():s.restoreFocus?.(u)},children:l})}function wr({slots:e,features:t,layout:n="panel",shortcuts:o,conversations:a=[],conversationSource:l,quota:c,onStop:s,suggestions:h=[]}){let b=Ue(),u=U(),{client:p,format:f,tokens:M}=u,d=Me(),m=S(null),P=S(null),C=S(null),L=S(null),E=S(new Set).current,[,R]=K(0),[N,W]=K(0),se=Jt(()=>({retry:N,report(r,g){E.has(r)!==g&&(g?E.add(r):E.delete(r),R(F=>F+1))}}),[N,E]),{isAnswered:w,reply:v}=Hn(p),y=S(null),k=S(null),q=S(new Set),[ie,D]=K(0),[le,he]=K(!1),[Ce,nn]=K(),rt=mr(()=>p.refresh()),rn=mr(()=>p.refresh()),ot=wt(p),G=u.primitives.button,Er=u.primitives.textarea,on=!!(e?.extraPanels||u.parts?.extraPanels),an=Be("hint"),We=Be("pending"),Ke=r=>(d.conversation?.mode!=="form-fill"||r==="form-fill"||r==="widgets")&&d.capabilities.includes(r)&&(!t||t.includes(r)),[Sr,at]=K("loading"),sn=()=>{at(r=>r==="failed"?"retrying":"loading"),p.loadFlows().then(()=>at("done"),()=>at("failed"))};ae(sn,[p]);let[,Tr]=K(!1);ae(()=>{import("./problem-messages-Z5QGO6RE.js").then(r=>{cr(r.problemEnglish,r.problemSimplifiedChinese),Tr(!0)})},[]);let T=Yn(m,Re(p,d.conversationId),P,C,r=>Re(p,r)),z=d.conversation?.messages??[],ge=d.conversation?.id,[st,ln]=K({open:!1});st.conversationId!==ge&&ln({conversationId:ge,open:!1});let it=st.conversationId===ge&&st.open,Mr=`wp${b.replace(/[^\w-]/g,"")}`,cn=r=>`${Mr}-${r.replace(/[^A-Za-z0-9-]/gu,g=>`_${g.codePointAt(0)}_`)}`,qe=rr(C,L,ge,z.length,d),lt=S(void 0),Rr=r=>{let g=r.target,F=z.map(Q=>Q.id),I={owner:T.value.owner(),shown:ge,order:F},A=g.closest("[data-outline-link]"),H=g.closest("[data-back-to-latest]"),$=g.closest("article[data-message-id]");lt.current=A?{...I,kind:"link",id:A.getAttribute("data-outline-link"),element:A}:H?{...I,kind:"latest",element:H}:$&&O(C.current,$)?{...I,kind:"message",id:$.getAttribute("data-message-id"),element:$}:void 0};ke(()=>{let r=lt.current;if(!r||r.element.isConnected)return;lt.current=void 0;let g=C.current,F=g?.parentElement,I=(H,$)=>{let Q=new Map;for(let re of $?.querySelectorAll(`[${H}]`)??[])Q.set(re.getAttribute(H),re);let fe=r.order.indexOf(r.id);for(let re=fe+1;re<r.order.length;re++){let De=Q.get(r.order[re]);if(De)return De}for(let re=fe-1;re>=0;re--){let De=Q.get(r.order[re]);if(De)return De}},A=r.kind==="message"?I("data-message-id",g)??g:r.kind==="link"?I("data-outline-link",F)??F?.querySelector("nav[data-outline] [aria-expanded]")??g:g;ee(T.value,A,{owner:r.owner,stillCurrent:()=>T.value.owner()===r.owner&&p.getSnapshot().conversation?.id===r.shown,removed:r.element,fallback:g})});let dn=a.length>0||!!l,[Z,Fr]=K(!1),[xe,Le]=K(!1),un=Be("rail"),Lr=It(xe,T.value.owner(),()=>Le(!1)),ct=S(void 0),dt=S(!1),ze=S(!1),Ir=()=>{let r=dt.current||ze.current;return dt.current=!1,r};ke(()=>{let r=m.current;if(!r||typeof ResizeObserver!="function")return;let g=()=>{let I=r.getBoundingClientRect().width,A=parseFloat(getComputedStyle(r).fontSize)||16;Fr(I>0&&I<40*A)},F=new ResizeObserver(g);return F.observe(r),g(),()=>F.disconnect()},[]);let fn=S(Z);ke(()=>{fn.current&&!Z&&xe&&(ze.current=!0,Le(!1)),fn.current=Z},[Z,xe]),ke(()=>{if(!ze.current||xe)return;ze.current=!1;let r=ct.current;if(ct.current=void 0,!r||r.element.isConnected)return;let g=m.current?.querySelector('[data-part="rail"] nav'),F=r.id?[...g?.querySelectorAll("[data-conversation-id]")??[]].find(I=>I.getAttribute("data-conversation-id")===r.id)?.querySelector("button"):void 0;ee(T.value,F??g??C.current,{owner:r.owner,stillCurrent:()=>T.value.owner()===r.owner,removed:r.element,fallback:C.current})});let je=S(void 0),pn=T.value.owner();qe.pinned||!z.length?je.current=void 0:je.current?.owner!==pn&&(je.current={owner:pn,ids:new Set(z.map(r=>r.id))});let mn=je.current,hn=mn?z.filter(r=>r.role==="assistant"&&!mn.ids.has(r.id)).length:0,ut=xo(),ft=!!(u.renderers?.markdown||u.parts?.bubble||u.parts?.transcript||e?.bubble||e?.transcript),pt=S(new Ze).current;pt.begin(Re(p,ge??""),[ft,u.messageExcerpt,ut,u.markdownImages?.origin,u.markdownImages?.allow,u.extraUrlSchemes?.join(" ")],z.map(r=>({id:r.id,source:ft?r:r.content})));let gn=r=>{if(ft)return pt.get(r.id,r,g=>{let F=u.messageExcerpt?.(g);return F===void 0?void 0:Bt(F)});if(ut)return pt.get(r.id,r.content,g=>Bt(ut.visibleText(g,{images:u.markdownImages,extraSchemes:u.extraUrlSchemes})))},Nr=it?z.map(gn):[],bn=S(null),Dr=ir(p,d.conversation,gn,f,bn),be=Be("flows"),vn=S(""),yn=Mt(()=>{let r=m.current?.querySelector(`[id="${be}-panel"]`);return[r?.querySelector(`[data-flow="${vn.current}"] button`),r]}),Ie=pe(Vt),wn=Ke("flows");ae(()=>{wn&&Vt.request()},[wn]);let[Ne,kn]=K(void 0),Cn=(r,g={})=>{let F=p,I=T.value.owner(),A=Re(F,`flow:${r}`),H=T.value.originFor("run-flow",A);kn(void 0),F.runFlow(r,g).then($=>{let Q=$&&Re(F,$);ee(T.value,P.current,{origin:H,owner:A,stillCurrent:()=>!!Q&&T.value.owner()===Q&&F.getSnapshot().conversation?.id===$})},()=>{ce(H),kn({id:r,owner:I,values:g})})},Pe=d.replyState,Ee=z.at(-1),Ve=Pe==="writing"&&Ee?.status==="writing"?Ee.id:void 0,Ar=Ee?.role==="assistant"&&(Ee.status==="failed"||Ee.status==="unavailable")&&Pe===Ee.status,xn=S(null),mt=lr(Pe,xn),Or=(r,g)=>F=>{let I=V(document),A=Bn(d.conversationId,g,r.id,F),H=!q.current.has(A);q.current.add(A),v(r,F,g).then($=>{H&&q.current.delete(A);let Q=p.getSnapshot();$?.accepted===!1&&$.problem?.code==="refused"&&Q.conversation?.messages.find(fe=>fe.id===g)?.blocks.find(fe=>fe.id===r.id)?.answered&&(k.current=Q.problem),y.current=I,D(fe=>fe+1)})};ke(()=>{let r=y.current,g=T.value.root();y.current=null,r&&g&&X(oe(r)?r:T.value.composer(),{root:g,owner:"",removed:r})},[ie]);let Pn=!!d.problem&&d.problem===k.current,de=d.problem&&!q.current.has(d.problem.id)?u.problemText?.(d.problem,{answeredElsewhere:Pn})??(Pn?{text:f("chat.problem.answered")||f("chat.failure")}:Bo(d.problem,f)):null,J=d.plan,j=ot.view,_e=de&&d.problem?.id!=="conversation-unavailable"&&!(d.problem?.code==="stopped"&&j?.status)&&!d.problem?.confirmation&&!(d.conversationUnavailable&&d.problem?.id==="conversation-read")?d.problem:void 0,Se=_e&&d.pending.some(r=>r.failure&&r.id===_e.id)?_e:void 0,ht=Se?void 0:_e,gt=j?.actions.find(r=>r.id==="confirm"),En=j?.actions.find(r=>r.id==="stop"),ue=yt(J,d.conversationId),Br=r=>{if(le)return;let g=p.getSnapshot();if(yt(g.plan,g.conversationId)?.token!==r){nn(r);return}nn(void 0),he(!0),p.confirmPlan().finally(()=>he(!1))},Sn=d.confirmationRefusal,Hr=Sn?.token===ue?.token&&Sn?.problemId===d.problem?.id?d.problem?.confirmation?.reason:void 0,Ur=Ce!==void 0&&Ce!==ue?.token,$r=Z?"section":"aside",Wr=J?.state==="awaiting-confirmation"&&!j?.readOnly&&ue!==void 0,bt=Ke("plans")&&J?x($r,{"aria-label":f("chat.plan"),"data-plan":"",children:[i($o,{record:J,slots:e,view:j,changesShown:Wr}),x(B,{name:"confirmBar",slots:e,data:j?{view:j,actions:j.actions.filter(r=>j.status?r.id==="confirm":r.id==="confirm"||r.id==="stop")}:void 0,children:[J.state==="awaiting-confirmation"&&!j?.readOnly?i(B,{name:"confirmation",slots:e,data:ue&&{confirmation:ue},children:i(wo,{fallback:null,children:i(Po,{record:ue,planId:J.id,entry:gt&&(le?{...gt,available:!1,busy:!0}:gt),onConfirm:()=>ue&&Br(ue.token),refusal:Hr,override:u.problemText&&de,replaced:Ur})})}):null,!j?.status&&En?i(xr,{action:En,onPress:s??(()=>p.stopPlan())}):null]}),j?.status?i(Ao,{view:j,onPress:ot.press,slots:e,sheet:ot.sheet,hide:["confirm"]}):null]}):null,Tn=z.at(-1),vt=Z&&bt&&!d.pending.length&&Tn?.blocks.some(r=>r.type==="plan"&&r.body?.planId===J?.id)?Tn:void 0,Mn=r=>i(B,{name:"messageActions",slots:e,data:{message:{id:r.id,role:r.role,status:r.status,versionIndex:r.versionIndex,versionCount:r.versionCount}},children:i(So,{client:p,message:r})});return i(Lt.Provider,{value:T.value,children:i("section",{ref:m,className:"waypoint",dir:u.dir??"ltr",lang:u.lang,"data-layout":n,"data-color-scheme":u.colorScheme??"light","data-custom-theme":u.theme?"":void 0,style:{...An(M),colorScheme:u.colorScheme??"light"},...T.captureProps,onKeyDown:r=>{o?.focusComposer===!1||r.key!==(o?.focusComposer??"/")||!O(r.currentTarget,ve(r.nativeEvent))||!Jn(r.currentTarget)||r.currentTarget.querySelector(Ln)||(r.preventDefault(),P.current?.focus())},children:x("div",{className:"wp-shell","data-has-aside":Ke("plans")&&J||on?"":void 0,"data-has-rail":dn||e?.rail||u.parts?.rail?"":void 0,children:[Z?null:i(B,{name:"rail",slots:e,children:i(_t,{conversations:a,source:l})}),x("main",{children:[x(B,{name:"topBar",slots:e,children:[Z&&dn?i("span",{"data-rail-toggle":"",children:i(G,{"aria-expanded":xe,"aria-controls":un,onPress:()=>Le(r=>!r),children:f("chat.rail")})}):null,i("h2",{children:d.conversation?.title||f("chat.title")})]}),Z&&xe&&!Lr?i(Ko,{label:f("chat.rail"),closeLabel:f("chat.close"),onClose:()=>Le(!1),skipRestore:Ir,onFocusWithin:r=>{let g=r.closest("[data-conversation-id]");ct.current={element:r,id:g?.getAttribute("data-conversation-id")??void 0,owner:T.value.owner()}},children:i("div",{id:un,children:i(_t,{conversations:a,source:l,onChoose:()=>{let r=T.value.originFor("rail-choice");dt.current=!0,ee(T.value,m.current?.querySelector("[data-rail-toggle] button"),{origin:r,owner:T.value.owner()}),Le(!1)}})})}):null,i(B,{name:"transcript",slots:e,children:x("div",{onFocusCapture:Rr,children:[z.length?i(Wo,{messages:z,excerpts:Nr,anchor:cn,open:it,onToggle:()=>ln({conversationId:ge,open:!it}),onNavigate:r=>{let g=T.value.originFor("outline");ee(T.value,qe.toMessage(r),{origin:g,owner:T.value.owner()})}}):null,i("div",{ref:C,className:"wp-transcript",role:"region","aria-label":f("chat.transcript"),tabIndex:-1,children:i(Qt.Provider,{value:se,children:x("div",{ref:L,children:[!d.conversation&&!d.conversationUnavailable&&!d.problem?i("p",{children:f("chat.startupLoading")}):z.length?null:i(B,{name:"emptyState",slots:e,children:i("p",{children:f("chat.empty")})}),z.map(r=>x("article",{id:cn(r.id),tabIndex:-1,"data-message-id":r.id,"data-role":r.role,"aria-busy":r.id===Ve?!0:void 0,"aria-label":f(r.role==="user"?"chat.roleUser":"chat.roleAssistant"),"data-body-unavailable":E.has(r.id)&&!r.blocks.length?"":void 0,children:[x(B,{name:"bubble",slots:e,data:{message:{id:r.id,role:r.role,content:r.content,status:r.status,versionIndex:r.versionIndex,versionCount:r.versionCount,blocks:r.blocks.map(br)}},children:[i("span",{"data-sender":"","aria-hidden":"true",children:f(r.role==="user"?"chat.roleUser":"chat.roleAssistant")}),i(kr.Provider,{value:r.id,children:i(Pr,{text:r.content,writing:r.id===Ve,sources:r.sources})}),r.id===Ve?i("span",{"data-writing":"","aria-hidden":"true",children:f("reply.writing")}):r.status==="stopped"?i("span",{"data-stopped":"",children:f("reply.stopped")}):r.status==="failed"||r.status==="unavailable"?i("span",{"data-reply-ended":r.status,children:f(`reply.${r.status}`)}):null,r.blocks.map(g=>i(B,{name:"widgetFrame",slots:e,data:{block:br(g)},children:x("div",{"data-open-card":g.type==="card"&&!w(g,r.id)?"true":void 0,children:[i(Yt,{block:g,disabled:d.conversationUnavailable||w(g,r.id),onReply:Or(g,r.id)}),g.answered?i(To,{block:g}):null]})},g.id))]}),r===vt?null:Mn(r)]},r.id)),d.pending.map(r=>x("article",{"data-role":"pending","aria-label":f("chat.roleUser"),children:[x(B,{name:"bubble",slots:e,data:{pending:vr(r)},children:[i("span",{"data-sender":"","aria-hidden":"true",children:f("chat.roleUser")}),i("p",{children:r.content})]}),i("p",{id:`${We}-${r.id}`,"data-pending-status":r.failure?"failed":"sending",children:f(r.failure?"chat.pendingFailed":"chat.pendingSending")}),Se?.id===r.id&&de?x("p",{role:"alert",children:[de.text,de.action??(!u.problemText&&kt(Se)==="refresh"?i(hr,{problem:Se,refresh:rn}):null)]},d.announcement):null,r.failure?x(B,{name:"failedSendControls",slots:e,data:{pending:vr(r)},children:[i(G,{"aria-describedby":`${We}-${r.id}`,disabled:d.conversationUnavailable||d.sending,onPress:()=>{p.retry(r.id)},children:f("chat.retry")}),i(G,{"aria-describedby":`${We}-${r.id}`,disabled:d.withdrawing.includes(r.id),onPress:()=>{p.withdraw(r.id)},children:f("chat.withdraw")}),i(G,{"aria-describedby":`${We}-${r.id}`,onPress:()=>{p.dismiss(r.id)},children:f("chat.dismiss")})]}):null,Se?.id===r.id?i(gr,{problem:Se},d.announcement):null]},r.id))]})})}),E.size?x("p",{role:"alert","data-render-failure":"",children:[f("chat.messagesUnavailable"),i(G,{onPress:()=>{tt.request(!0),W(r=>r+1)},children:f("chat.retry")})]}):null,qe.pinned?null:i("div",{"data-back-to-latest":"",children:i(G,{onPress:()=>{let r=T.value.originFor("latest");qe.toLatest(),ee(T.value,C.current,{origin:r,owner:T.value.owner()})},children:hn?f("chat.latestNew",{count:hn}):f("chat.latest")})})]})}),x(B,{name:"replyRow",slots:e,children:[i("div",{ref:xn,role:"status","data-reply-state":Pe,children:mt==="none"||Ar?null:i("p",{className:mt==="writing"&&Ve?"wp-sr-only":void 0,children:f(`reply.${mt}`)})}),Pe!=="none"||d.toolSteps.length?i(Eo,{client:p,row:Pe}):null]}),Z?bt:null,vt?Mn(vt):null,Ke("flows")?i(B,{name:"flowTabs",slots:e,children:x("nav",{"aria-label":f("chat.flows"),children:[i("div",{role:"tablist",onKeyDown:r=>{let g=d.flowTabs,F=g.findIndex(H=>Te(H)===d.flowTab),I;if(r.key==="Home")I=0;else if(r.key==="End")I=g.length-1;else if(r.key==="ArrowRight"||r.key==="ArrowLeft"){let H=getComputedStyle(r.currentTarget).direction,$=r.key==="ArrowRight"!=((H==="rtl"||H==="ltr"?H:u.dir)==="rtl");I=(F+($?1:g.length-1))%g.length}else return;let A=r.currentTarget;!O(A,ve(r.nativeEvent))||!O(A,V(A.ownerDocument))||(r.preventDefault(),p.selectFlowTab(g[I]),r.currentTarget.querySelectorAll('[role="tab"]')[I]?.focus())},children:d.flowTabs.map(r=>i(G,{id:`${be}-${Te(r)}`,"aria-controls":`${be}-panel`,role:"tab","aria-selected":d.flowTab===Te(r),tabIndex:d.flowTab===Te(r)?0:-1,label:typeof r=="string"?f(`flow.${r}`):u.flowTabLabel?.(r.labelKey)??r.labelKey,onPress:()=>p.selectFlowTab(r),children:typeof r=="string"?f(`flow.${r}`):u.flowTabLabel?.(r.labelKey)??r.labelKey},Te(r)))}),Ne&&Ne.owner===T.value.owner()?i(Xt,{onFocus:r=>{vn.current=Ne.id,yn(r)},onRetry:()=>Cn(Ne.id,Ne.values)}):null,Ie.status==="ready"?i(Ie.module.FlowPanel,{id:`${be}-panel`,labelledBy:`${be}-${d.flowTab}`,flows:d.flows[d.flowTab],all:d.flows,list:Sr,onRetryList:sn,onRunFlow:Cn}):i("div",{id:`${be}-panel`,role:"tabpanel","aria-labelledby":`${be}-${d.flowTab}`,tabIndex:-1,onFocus:yn,children:Ie.status==="failed"||nt(Ie)?i(Xt,{retrying:nt(Ie),onRetry:()=>Vt.request(!0)}):i("p",{children:f("chat.loading")})})]})}):null,d.restored.length?i("section",{"aria-label":f("chat.restored"),children:d.restored.map(r=>x("article",{children:[i("p",{children:r.content}),i(G,{onPress:()=>{p.editRestored(r.id)},children:f("chat.restoredEdit")}),i(G,{onPress:()=>{p.discardRestored(r.id)},children:f("chat.restoredDiscard")})]},r.id))}):null,x(B,{name:"composer",slots:e,data:{sending:d.sending},disabled:d.conversationUnavailable,value:d.draft,onChange:r=>{p.setDraft(r)},children:[i(Er,{inputRef:P,disabled:d.conversationUnavailable,value:d.draft,onChange:r=>{p.setDraft(r)},label:f("chat.message"),describedBy:d.hints.length?d.hints.map((r,g)=>`${an}-${g}`).join(" "):void 0,onKeyDown:r=>{o?.send!==!1&&r.key===(o?.send??"Enter")&&!r.shiftKey&&!r.nativeEvent.isComposing&&r.keyCode!==229&&(r.preventDefault(),p.send())}}),i(G,{disabled:d.conversationUnavailable||!d.draft.trim()||d.sending,onPress:()=>{p.send()},children:f(d.sending?"chat.sending":"chat.send")}),d.hints.map((r,g)=>i("p",{id:`${an}-${g}`,children:r},g))]}),i(B,{name:"actionBar",slots:e,children:h.map(r=>i(G,{onPress:()=>{p.setDraft(r)},children:r},r))}),i(B,{name:"stepUpPrompt",slots:e,data:J?.plan.kind==="immediate"&&J.plan.stage==="final"?{stepUpCount:J.plan.stepUpCount}:void 0}),i(B,{name:"quotaStrip",slots:e,children:c}),i("div",{ref:bn,className:"wp-sr",role:"status","data-announcements":"",children:Dr}),x("div",{role:"alert","data-announcement":d.announcement,children:[d.conversationUnavailable&&x("span",{children:[f("chat.conversationUnavailable"),i(G,{onPress:rt.press,"aria-busy":rt.busy||void 0,"aria-disabled":rt.busy||void 0,children:f("chat.reload")})]}),ht&&de?x("span",{children:[de.text,de.action??(d.problem&&!u.problemText?i(hr,{problem:d.problem,refresh:rn}):null)]},d.announcement):null]}),ht?i(gr,{problem:ht},d.announcement):null]}),Z?null:bt,on?i(B,{name:"extraPanels",slots:e}):null]})})})}function $a({title:e,body:t,busy:n=!1,onProceed:o,onCancel:a}){let l=_(te),c=l?.format??Oe(),s=l?.primitives??Cr,h=s.drawer,b=Ot("confirm-sheet"),u=It(!0,Ae()?.owner(),a),p=s.button;return u?null:x(At,{as:h,open:!0,label:e,onClose:a,closeLabel:c("chat.close"),...b,children:[i("p",{children:t}),i(p,{disabled:n,onPress:o,children:c("chat.confirm")}),i(p,{onPress:a,children:c("chat.cancel")})]})}import{Fragment as jo,jsx as ne,jsxs as me}from"react/jsx-runtime";function _t({conversations:e,source:t,onChoose:n}){let{client:o,format:a,primitives:l,extraUrlSchemes:c}=U(),{conversationId:s}=zo(o.subscribe,o.getSnapshot,o.getSnapshot),[h,b]=$e(""),[u,p]=$e([]),[f,M]=$e(!1),[d,m]=$e(0),[P,C]=$e(new Map);qo(()=>{if(!t)return;let w=!0;return M(!1),Promise.resolve().then(()=>t.list(h||void 0)).then(v=>{w&&(p(v),C(y=>new Map([...y,...v.filter(k=>k.subject).map(k=>[k.subject.key,k.subject])])))}).catch(()=>{w&&M(!0)}),()=>{w=!1}},[t,h,s,d]);let L=t?u:e,E=t?P:new Map(L.filter(w=>w.subject).map(w=>[w.subject.key,w.subject])),R=new Map;for(let w of L){let v=w.subject?.key??"";h&&v!==h||R.set(v,[...R.get(v)??[],w])}let N=l.button,W=Ae(),se=w=>me(jo,{children:[ne(N,{"aria-current":w.id===s?"page":void 0,onPress:()=>{n?.();let v=W?.ownerOf(w.id)??w.id,y=W?.originFor("switch",v);o.switchConversation(w.id).then(k=>ee(W,W?.composer(),{origin:y,owner:v,stillCurrent:()=>k.kind==="loaded"&&W?.owner()===v&&o.getSnapshot().conversation?.id===w.id}))},children:w.title}),w.mode==="form-fill"&&ne("span",{children:a("form.marker")}),w.subject?.state==="unlinked"&&ne("span",{children:a("form.unlinked")}),w.subject?.route&&Ge(w.subject.route,c)&&ne("a",{href:w.subject.route,children:a("form.return")})]});return me("nav",{className:"wp-rail","aria-label":a("chat.rail"),tabIndex:-1,children:[E.size>0&&me("label",{children:[a("form.filter"),me("select",{value:h,onChange:w=>b(w.target.value),children:[ne("option",{value:"",children:a("form.all")}),[...E].map(([w,v])=>ne("option",{value:w,children:v.label},w))]})]}),f&&me("p",{role:"alert",children:[a("chat.conversationsFailed")," ",ne(N,{onPress:()=>m(w=>w+1),children:a("chat.retry")})]}),[...R].map(([w,v])=>{let y=new Set,k=D=>{if(y.has(D.id))return null;y.add(D.id);let le=v.filter(he=>he.parentConversationId===D.id&&!y.has(he.id));return me("li",{"data-conversation-id":D.id,children:[se(D),le.length>0&&me("details",{children:[ne("summary",{children:a("form.threads")}),ne("ul",{children:le.map(k)})]})]},D.id)},ie=v.filter(D=>!D.parentConversationId||!v.some(le=>le.id===D.parentConversationId)).map(k);for(let D of v)y.has(D.id)||ie.push(k(D));return me("section",{children:[w&&ne("h3",{children:v[0].subject.label}),ne("ul",{children:ie})]},w)})]})}export{V as a,O as b,oe as c,ce as d,Mt as e,Lt as f,Ae as g,It as h,Yr as i,ee as j,At as k,Ot as l,Zo as m,Jo as n,_t as o,co as p,cr as q,uo as r,qt as s,Oe as t,we as u,pe as v,Do as w,Ia as x,U as y,Na as z,Da as A,Aa as B,Oa as C,Ba as D,Ha as E,xr as F,mr as G,Xt as H,Ao as I,B as J,Bo as K,Uo as L,Yt as M,$o as N,Ua as O,$a as P};
|
|
@@ -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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } 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 _class; var _class2;var _chunkFBADWFRRcjs = require('./chunk-FBADWFRR.cjs');var _chunkQS3MKZOYcjs = require('./chunk-QS3MKZOY.cjs');var _chunkM3UENQ6Lcjs = require('./chunk-M3UENQ6L.cjs');var _chunk4BWV3SELcjs = require('./chunk-4BWV3SEL.cjs');var _chunkGT6PI4CTcjs = require('./chunk-GT6PI4CT.cjs');var _chunk3KV7TDDRcjs = require('./chunk-3KV7TDDR.cjs');var _react = require('react');var Xe=new WeakMap;function V(e){let t=e.activeElement;for(;_optionalChain([t, 'optionalAccess', _2 => _2.shadowRoot, 'optionalAccess', _3 => _3.activeElement]);)t=t.shadowRoot.activeElement;return t}function O(e,t){let n=t;for(;n;){if(n===e)return!0;n=_nullishCoalesce(n.parentNode, () => ((n instanceof ShadowRoot?n.host:null)))}return!1}function ve(e){return _nullishCoalesce(_optionalChain([e, 'access', _4 => _4.composedPath, 'optionalCall', _5 => _5(), 'access', _6 => _6[0]]), () => (e.target))}var Ct=new WeakMap,Kr=0;function Kn(e){let t=new Set,n=[],o=a=>{t.has(a)||a.hasAttribute("inert")||(a.setAttribute("inert",e.mark),e.set.push(a))};for(let a=e.drawer;;){t.add(a);let l=a instanceof Element?a.assignedSlot:null;l&&a.parentNode&&n.push(a.parentNode);let c=_nullishCoalesce(l, () => (a.parentNode));if(!c||c.nodeType===Node.DOCUMENT_NODE)break;n.push(c),a=c instanceof ShadowRoot?c.host:c}for(let a of n)for(let l of a.children)o(l);if(typeof MutationObserver=="function"){e.watch=new MutationObserver(a=>{for(let l of a)for(let c of l.addedNodes)c instanceof Element&&o(c)});for(let a of n)e.watch.observe(a,{childList:!0})}}function qn(e){_optionalChain([e, 'access', _7 => _7.watch, 'optionalAccess', _8 => _8.disconnect, 'call', _9 => _9()]),e.watch=void 0;for(let t of e.set)t.getAttribute("inert")===e.mark&&t.removeAttribute("inert");e.set=[]}function Et(e){let t=e.ownerDocument,n=_nullishCoalesce(Ct.get(t), () => ([]));Ct.set(t,n);let o=n.at(-1);o&&qn(o);let a={drawer:_nullishCoalesce(e.closest("[data-wp-modal-root]"), () => (e)),mark:`waypoint-${++Kr}`,set:[]};return n.push(a),Kn(a),()=>{let l=n.indexOf(a);if(l<0)return;qn(a),n.splice(l,1);let c=n.at(-1);l===n.length&&c&&Kn(c)}}var qr='a[href], button, input, select, textarea, summary, iframe, [tabindex], [contenteditable]:not([contenteditable="false"])';function oe(e){return e instanceof HTMLElement&&e.isConnected&&e.matches(qr)&&!e.matches('input[type="hidden"], :disabled')&&!e.closest("[hidden], [inert]")&&(typeof e.checkVisibility!="function"||e.checkVisibility({visibilityProperty:!0}))}function zr(e,t){for(let n=e;n;){if(n instanceof Element&&oe(n))return n;if(n===t)return null;n=_nullishCoalesce(n.parentNode, () => ((n instanceof ShadowRoot?n.host:null)))}return null}function jr(e){return O(e,V(e.ownerDocument))}var xt=e=>{let t=V(e);return!t||t===e.body};function ye(e){let t=Xe.get(e);if(t)return t;let n={origins:new Set,last:null};return t=n,Xe.set(e,n),e.addEventListener("focusin",o=>{let a=ve(o);n.last=a,n.disabled=null;for(let l of n.origins)!O(l.root,a)&&!l.owned.some(c=>O(c,a))&&(l.valid=!1,n.origins.delete(l))},!0),e.addEventListener("focusout",o=>{let a=ve(o);o.relatedTarget||queueMicrotask(()=>{if(!_optionalChain([a, 'optionalAccess', _10 => _10.isConnected])||!xt(e))return;if(a.matches(":disabled"))return void(n.disabled=a);let l=_optionalChain([Ct, 'access', _11 => _11.get, 'call', _12 => _12(e), 'optionalAccess', _13 => _13.at, 'call', _14 => _14(-1), 'optionalAccess', _15 => _15.drawer]);if(!(l&&O(l,a))){n.last=null;for(let c of n.origins)c.valid=!1;n.origins.clear()}})},!0),e.addEventListener("pointerdown",()=>{n.last&&!n.last.isConnected&&xt(e)&&(n.last=null)},!0),n}function ce(e){e&&(e.valid=!1,_optionalChain([Xe, 'access', _16 => _16.get, 'call', _17 => _17(e.root.ownerDocument), 'optionalAccess', _18 => _18.origins, 'access', _19 => _19.delete, 'call', _20 => _20(e)]))}function Vn(e){let t=Xe.get(e.ownerDocument);if(t)for(let n of t.origins)O(e,n.root)&&ce(n)}function St(e){ye(e)}function Tt(e,t,n,o){let a="nativeEvent"in e?e.nativeEvent:e,l=ve(a);if(!O(t,l))return;let c={owner:n,action:o,root:t,control:_nullishCoalesce(zr(l,t), () => (l)),owned:[],valid:!0};return ye(t.ownerDocument).origins.add(c),c}var _n=new WeakMap;function Gn(e){let t=V(e.ownerDocument);t&&O(e,t)&&(ye(e.ownerDocument).last=t,_n.set(e,t))}function Pt(e,t){if(!e)return!1;let{last:n}=ye(t);return!!n&&(O(e,n)||_n.get(e)===n)&&(!n.isConnected||n===ye(t).disabled)&&xt(t)}function X(e,t){let{root:n,origin:o,removed:a}=t;if(!e||!e.isConnected)return!1;let l=n.ownerDocument;if(ye(l),t.stillCurrent&&!t.stillCurrent()||!(o?o.valid&&o.owner===t.owner&&(jr(n)||Pt(_nullishCoalesce(a, () => (o.control)),l)):Pt(a,l)||t.enterModal===!0&&e===n&&e.matches(_chunkGT6PI4CTcjs.c)))return!1;e.focus({preventScroll:_nullishCoalesce(t.preventScroll, () => (!1))});let s=V(l)===e;return s?ye(l).last=e:_optionalChain([t, 'access', _21 => _21.missed, 'optionalCall', _22 => _22()]),s}var zn=new WeakMap,jn=e=>{let t=zn.get(e);return t||zn.set(e,t=new Set),t};function Mt(e){let t=_react.useRef.call(void 0, null),n=_react.useRef.call(void 0, {});return _react.useLayoutEffect.call(void 0, ()=>{St(document);let o=jn(document),a=n.current;return()=>{o.delete(a)}},[]),_react.useLayoutEffect.call(void 0, ()=>{let o=jn(document),a=t.current;if(!a||a.isConnected)return void o.delete(n.current);if(!Pt(a,document))return t.current=null,void o.delete(n.current);let l=e().find(c=>_optionalChain([c, 'optionalAccess', _23 => _23.isConnected]));if(!(l instanceof HTMLElement))return void o.add(n.current);t.current=null,o.delete(n.current),X(l,{root:l,owner:"",removed:a})}),o=>{t.current=o.target}}var _jsxruntime = require('react/jsx-runtime');var Lt=_react.createContext.call(void 0, null),Ae= exports.g =()=>_react.useContext.call(void 0, Lt),Xn=new WeakMap,Xr=0;function Re(e,t){let n=Xn.get(e);return n===void 0&&Xn.set(e,n=++Xr),`${n}:${t}`}function Yn(e,t,n,o,a=l=>l){let l=_react.useRef.call(void 0, null),c=_react.useRef.call(void 0, t);c.current=t;let s=_react.useRef.call(void 0, a);s.current=a,_react.useEffect.call(void 0, ()=>{let u=e.current;if(u)return St(u.ownerDocument),()=>Vn(u)},[e]);let h=_react.useMemo.call(void 0, ()=>({root:()=>e.current,owner:()=>c.current,ownerOf:u=>s.current(u),originFor(u,p){let f=l.current,M=e.current;return f&&M?Tt(f,M,_nullishCoalesce(p, () => (c.current)),u):void 0},composer:()=>n.current,transcript:()=>o.current}),[e,n,o,t]),b=u=>{let p=u.nativeEvent;l.current=p,Zn(()=>{l.current===p&&(l.current=null)})};return{value:h,captureProps:{onClickCapture:b,onKeyDownCapture:b,onPointerDownCapture:b}}}function It(e,t,n){let[o,a]=_react.useState.call(void 0, {active:e,conversationId:t});o.active!==e&&a({active:e,conversationId:t});let l=e&&o.active&&o.conversationId!==t,c=_react.useRef.call(void 0, n);return c.current=n,_react.useEffect.call(void 0, ()=>{l&&c.current()},[l]),l}var Zn=e=>setTimeout(e,0);function Yr(e){return!!_optionalChain([e, 'optionalAccess', _24 => _24.closest, 'call', _25 => _25('textarea, select, [contenteditable]:not([contenteditable="false"]), input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="image"])')])}function Jn(e){if(!e)return!1;let t=V(e.ownerDocument);return O(e,t)&&!Yr(t)}function ee(e,t,n){let{origin:o,removed:a,fallback:l}=n,c=_optionalChain([e, 'optionalAccess', _26 => _26.root, 'call', _27 => _27()]),s=(u,p)=>!!c&&(!!o||!!a)&&X(u,{root:c,origin:o,removed:a,owner:n.owner,stillCurrent:n.stillCurrent,preventScroll:!0,missed:p}),h=!1,b=s(t,()=>h=!0);return!b&&h&&l&&l!==t&&(b=s(l)),(!n.keep||!b)&&ce(o),b}function Nt(e,t,n,o){_optionalChain([t, 'access', _28 => _28.current, 'optionalAccess', _29 => _29.element])!==e&&(t.current={element:e,opener:V(e.ownerDocument)}),_optionalChain([o, 'optionalCall', _30 => _30()]),X(e,{root:e,owner:"",enterModal:!0,stillCurrent:n})}function Dt(e,t,n){let o=e.current;o&&queueMicrotask(()=>{if(e.current!==o)return;let a=_optionalChain([n, 'optionalCall', _31 => _31()]),l=oe(o.opener)?o.opener:a,c={root:o.element,owner:"",removed:o.element,stillCurrent:t,preventScroll:!0};X(l,{...c,missed:()=>{a!==l&&X(a,c)}}),o.element.isConnected||(e.current=void 0)})}function At({as:e,focusInto:t,restoreFocus:n,...o}){let a=_react.useRef.call(void 0, void 0),l=_react.useRef.call(void 0, void 0);return _react.useEffect.call(void 0, ()=>()=>{_optionalChain([a, 'access', _32 => _32.current, 'optionalCall', _33 => _33()]),a.current=void 0},[]),_jsxruntime.jsx.call(void 0, e,{...o,focusInto:c=>{if(_optionalChain([a, 'access', _34 => _34.current, 'optionalCall', _35 => _35()]),t){let s=!1,h=()=>{a.current=Et(c),s=!0};t(c,h),s||h()}else Nt(c,l,void 0,()=>{a.current=Et(c)})},restoreFocus:c=>{Gn(c),_optionalChain([a, 'access', _36 => _36.current, 'optionalCall', _37 => _37()]),a.current=void 0,n?n(c):Dt(l)}})}function Ot(e,t,n){let o=Ae(),a=_react.useRef.call(void 0, void 0),l=_react.useRef.call(void 0, void 0),c=_react.useRef.call(void 0, t);c.current=t;let s=_react.useRef.call(void 0, n);return s.current=n,_react.useMemo.call(void 0, ()=>o?{focusInto(h,b){let u=o.owner(),p=o.originFor(`drawer:${e}`,u);if(a.current={origin:p,key:u},!p){Nt(h,l,()=>o.owner()===u&&(_nullishCoalesce(_optionalChain([c, 'access', _38 => _38.current, 'optionalCall', _39 => _39()]), () => (!0))),b);return}l.current=void 0,ee(o,h,{origin:p,owner:u,stillCurrent:()=>o.owner()===u&&(_nullishCoalesce(_optionalChain([c, 'access', _40 => _40.current, 'optionalCall', _41 => _41()]), () => (!0))),keep:!0})},restoreFocus(h){let b=a.current;if(a.current=void 0,!b)return;if(!b.origin){Dt(l,()=>o.owner()===b.key,()=>{let p=_optionalChain([s, 'access', _42 => _42.current, 'optionalCall', _43 => _43()]);return oe(_nullishCoalesce(p, () => (null)))?p:o.transcript()});return}let u={origin:b.origin,key:b.key};queueMicrotask(()=>Zr(o,h,u,_optionalChain([s, 'access', _44 => _44.current, 'optionalCall', _45 => _45()])))},release(){let h=a.current;a.current=void 0,ce(_optionalChain([h, 'optionalAccess', _46 => _46.origin]))}}:{},[o,e])}function Zr(e,t,n,o){let a=V(t.ownerDocument);if(!O(t,a)&&a&&a!==t.ownerDocument.body)return ce(n.origin);let l=n.origin.control,c=oe(_nullishCoalesce(o, () => (null)))?o:e.transcript(),s=oe(l)?l:c;ee(e,s,{origin:n.origin,owner:n.key,stillCurrent:()=>e.owner()===n.key,removed:t,fallback:c})}var Ye=null;function Zo(e,t,n){let o=Tt(e.nativeEvent,t,"form-field","open");if(!o)return _optionalChain([n, 'optionalCall', _47 => _47()]);let a={origin:o,claimed:!1,settled:n};Ye=a,Zn(()=>{Ye===a&&(Ye=null),a.claimed||(ce(o),_optionalChain([a, 'access', _48 => _48.settled, 'optionalCall', _49 => _49()]))})}function Jo(){let e=_react.useRef.call(void 0, void 0),t=_react.useRef.call(void 0, void 0);return _react.useMemo.call(void 0, ()=>({focusInto(n){let o=_nullishCoalesce(Ye, () => (void 0));if(e.current=o,!o){Nt(n,t);return}t.current=void 0;let a=o.origin;o.claimed=!0,a.owned.push(n),X(n,{root:a.root,origin:a,owner:a.owner,preventScroll:!0})},restoreFocus(n){let o=e.current;if(e.current=void 0,!o){Dt(t);return}queueMicrotask(()=>{Jr(n,o.origin),_optionalChain([o, 'access', _50 => _50.settled, 'optionalCall', _51 => _51()])})}}),[])}function Jr(e,t){let n=[...t.root.querySelectorAll("*")].find(oe),o={root:e,origin:t,removed:e,owner:t.owner,preventScroll:!0},a=!oe(t.control);a||X(t.control,{...o,missed:()=>a=!0}),a&&n&&n!==t.control&&X(n,o),ce(t)}var eo=/[--]/g;function Bt(e,t=120){let n=e.replace(eo,"").replace(/\s+/g," ").trim();if(!n||typeof Intl.Segmenter!="function")return;let o=[];for(let a of new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(n)){if(o.length===t)return`${o.join("")}\u2026`;o.push(a.segment)}return n}var Ze= (_class =class{constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }__init() {this.policy=[]}__init2() {this.byId=new Map}begin(t,n,o){if(t!==this.owner||n.length!==this.policy.length||n.some((l,c)=>l!==this.policy[c])){this.owner=t,this.policy=n,this.byId=new Map;return}if(!this.byId.size)return;let a=new Map(o.map(l=>[l.id,l.source]));for(let[l,c]of this.byId)(!a.has(l)||a.get(l)!==c.source)&&this.byId.delete(l)}get(t,n,o){let a=this.byId.get(t);if(a&&a.source===n)return a.value;let l=o(n);return this.byId.set(t,{source:n,value:l}),l}entries(){return[...this.byId].map(([t,n])=>({id:t,source:n.source}))}}, _class);var tr=24,Ht=150,no=100,ro=new Set(["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "]),oo="[data-message-id]",Fe=e=>Math.max(0,e.scrollHeight-e.clientHeight),nr=e=>e.scrollHeight-e.clientHeight-e.scrollTop,Je=()=>performance.now(),ao=e=>typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16),Ut=e=>[...e.querySelectorAll(oo)].filter(t=>t.closest(".wp-transcript")===e),Qe=e=>e.getAttribute("data-message-id");function rr(e,t,n,o,a){let[l,c]=_react.useState.call(void 0, !0),s=_react.useRef.call(void 0, {pinned:!0,token:void 0,expected:[],lastTop:0,sizeFrame:!1,anchor:void 0,shown:void 0}).current,h=m=>{s.pinned=m,c(m)},b=()=>{clearTimeout(_optionalChain([s, 'access', _52 => _52.token, 'optionalAccess', _53 => _53.timer])),s.token=void 0},u=(m,P)=>{let C=Math.min(Math.max(0,P),Fe(m));s.expected.push({top:C,at:Je()}),typeof m.scrollTo=="function"?m.scrollTo({top:C,behavior:"instant"}):m.scrollTop=C,s.lastTop=m.scrollTop},p=m=>{let P=m.getBoundingClientRect().top,C=Ut(m),L=C.find(E=>E.getBoundingClientRect().bottom>P+.5);s.anchor=L&&{id:Qe(L),offset:L.getBoundingClientRect().top-P,order:C.map(Qe)}},f=m=>{let P=s.anchor;if(!P)return p(m);let C=new Map(Ut(m).map(R=>[Qe(R),R])),L=P.order.indexOf(P.id),E=_nullishCoalesce(_nullishCoalesce(C.get(P.id), () => (P.order.slice(L+1).map(R=>C.get(R)).find(Boolean))), () => (P.order.slice(0,Math.max(0,L)).reverse().map(R=>C.get(R)).find(Boolean)));if(!E)u(m,0);else{let R=E.getBoundingClientRect().top-m.getBoundingClientRect().top-P.offset;Math.abs(R)>.5&&u(m,m.scrollTop+R)}p(m)},M=()=>{let m=e.current;m&&(s.token&&!s.token.used&&!s.token.held&&b(),s.pinned?nr(m)>.5&&u(m,Fe(m)):f(m))},d=_react.useRef.call(void 0, M);return d.current=M,_react.useLayoutEffect.call(void 0, ()=>{let m=o===0;(n!==s.shown||m)&&(s.shown=n,s.anchor=void 0,b(),s.pinned||h(!0)),M()},[a,n,o]),_react.useLayoutEffect.call(void 0, ()=>{let m=e.current;if(!m)return;let P=m.ownerDocument,C=v=>{clearTimeout(v.timer);let y=()=>{if(s.token!==v||v.held)return;let k=Je()-Math.max(v.lastInput,v.lastScroll);k>=Ht?s.token=void 0:v.timer=setTimeout(y,Ht-k)};v.timer=setTimeout(y,Ht)},L=v=>{let y=s.token??={used:!1,held:!1,lastInput:0,lastScroll:0};y.lastInput=Je(),v&&(y.held=!0),C(y)},E=()=>{let v=s.token;_optionalChain([v, 'optionalAccess', _54 => _54.held])&&(v.held=!1,C(v))},R=()=>L(),N=()=>L(!0),W=v=>{ro.has(v.key)&&O(m,V(P))&&L()},se=()=>{let v=m.scrollTop,y=s.lastTop;s.lastTop=v;let k=Je();s.expected=s.expected.filter(Ce=>k-Ce.at<no);let q=s.expected.findIndex(Ce=>Math.abs(Ce.top-v)<=1),ie=s.token,D=Fe(m),le=Math.abs(v-D)<=1&&y>D+.5,he=q>=0||!ie||le||s.sizeFrame&&Math.abs(v-D)<=1;q>=0&&s.expected.splice(0,q+1),he||(ie.used=!0,ie.lastScroll=k,C(ie),v<y-.5?h(!1):v>y+.5&&nr(m)<=tr&&!s.pinned&&h(!0)),s.pinned||p(m)};m.addEventListener("wheel",R,{passive:!0}),m.addEventListener("touchstart",N,{passive:!0}),m.addEventListener("touchmove",R,{passive:!0}),m.addEventListener("pointerdown",N),m.addEventListener("keydown",W),m.addEventListener("scroll",se,{passive:!0});for(let v of["pointerup","pointercancel","touchend","touchcancel"])P.addEventListener(v,E,!0);let w=typeof ResizeObserver=="function"?new ResizeObserver(()=>{s.sizeFrame=!0,ao(()=>s.sizeFrame=!1),d.current()}):void 0;return _optionalChain([w, 'optionalAccess', _55 => _55.observe, 'call', _56 => _56(m)]),t.current&&_optionalChain([w, 'optionalAccess', _57 => _57.observe, 'call', _58 => _58(t.current)]),()=>{m.removeEventListener("wheel",R),m.removeEventListener("touchstart",N),m.removeEventListener("touchmove",R),m.removeEventListener("pointerdown",N),m.removeEventListener("keydown",W),m.removeEventListener("scroll",se);for(let v of["pointerup","pointercancel","touchend","touchcancel"])P.removeEventListener(v,E,!0);_optionalChain([w, 'optionalAccess', _59 => _59.disconnect, 'call', _60 => _60()]),b()}},[e,t]),{pinned:l,toLatest(){let m=e.current;m&&(b(),u(m,Fe(m)),h(!0))},toMessage(m){let P=e.current,C=P&&Ut(P).find(R=>Qe(R)===m);if(!P||!C)return;b();let L=Math.min(Fe(P),P.scrollTop+C.getBoundingClientRect().top-P.getBoundingClientRect().top);u(P,L);let E=Fe(P)-L<=tr;return h(E),E||p(P),C}}}var so=1e3,io=e=>`\u2068${e}\u2069`,sr=()=>typeof requestAnimationFrame=="function",lo=e=>sr()?requestAnimationFrame(e):setTimeout(e,16),$t=e=>{sr()?cancelAnimationFrame(e):clearTimeout(e)};function or(e){if(e.role!=="assistant")return;let t=e.status;if(t==null)return"arrived";if(t==="completed")return"completed";if(t==="failed"||t==="unavailable")return"failed"}function ir(e,t,n,o,a){let[l,c]=_react.useState.call(void 0, ""),s=_react.useRef.call(void 0, {baselineFor:void 0,baseline:new Set,announced:new Map,writing:new Set,held:void 0,pending:new Map,batchFor:void 0,timer:void 0,frame:void 0,showing:0,batchShowing:0,client:void 0}).current,h=_react.useRef.call(void 0, {conversation:t,excerptOf:n,t:o});h.current={conversation:t,excerptOf:n,t:o};let b=(f,M)=>{let d=s.announced.get(f),m=!!d&&(d.has("completed")||d.has("failed"));return M==="arrived"?!m&&!_optionalChain([d, 'optionalAccess', _61 => _61.has, 'call', _62 => _62("arrived")])&&!s.writing.has(f):!m},u=()=>{s.timer=void 0;let f=[...s.pending],M=s.batchFor,d=s.batchShowing;s.pending.clear(),s.frame!==void 0&&$t(s.frame),c(""),s.frame=lo(()=>{s.frame=void 0,d===s.showing&&p(f,M)})},p=(f,M)=>{let d=_optionalChain([a, 'optionalAccess', _63 => _63.current]);if(_optionalChain([d, 'optionalAccess', _64 => _64.closest, 'call', _65 => _65("[inert]")])){for(let[y,k]of f)s.pending.set(y,k);s.held??=new MutationObserver(()=>{d.closest("[inert]")||(_optionalChain([s, 'access', _66 => _66.held, 'optionalAccess', _67 => _67.disconnect, 'call', _68 => _68()]),s.held=void 0,u())}),s.held.observe(d.ownerDocument.documentElement,{attributes:!0,attributeFilter:["inert"],subtree:!0});return}let{conversation:m,excerptOf:P,t:C}=h.current;if(!m||m.id!==M)return;let L=new Map(m.messages.map(y=>[y.id,y])),E=f.flatMap(([y])=>{let k=L.get(y),q=k&&or(k);return k&&q&&b(y,q)?[{id:y,stage:q,message:k}]:[]});if(!E.length)return;let R=new Map(m.messages.map((y,k)=>[y.id,k]));E.sort((y,k)=>R.get(y.id)-R.get(k.id));let N=E.length,W=E.filter(y=>y.stage==="failed").length,se=E.filter(y=>y.stage==="completed"),w=y=>{let k=P(y);return k===void 0?void 0:io(k)},v;if(N===1){let[y]=E,k=y.stage==="completed"?w(y.message):void 0;v=y.stage==="failed"?C("chat.arrivalFailed"):k!==void 0?C("chat.arrivalExcerpt",{excerpt:k}):C("chat.arrival")}else if(se.length===N){let y=w(se.at(-1).message);v=y!==void 0?C("chat.arrivalMany",{count:N,excerpt:y}):C("chat.arrivalManyPlain",{count:N})}else W===N?v=C("chat.arrivalAllFailed",{count:N}):W?v=C("chat.arrivalManyFailed",{count:N,failed:W}):v=C("chat.arrivalManyPlain",{count:N});for(let y of E){let k=_nullishCoalesce(s.announced.get(y.id), () => (new Set));k.add(y.stage),s.announced.set(y.id,k)}c(v)};return _react.useEffect.call(void 0, ()=>{if(s.client!==e&&(s.client=e,s.baselineFor=void 0),!t){s.baselineFor=void 0;return}if(s.baselineFor!==t.id){s.baselineFor=t.id,s.showing++,s.baseline=new Set(t.messages.map(f=>f.id)),s.announced.clear(),s.writing.clear(),s.pending.clear(),clearTimeout(s.timer),s.timer=void 0,s.frame!==void 0&&$t(s.frame),s.frame=void 0;return}for(let f of t.messages){if(s.baseline.has(f.id))continue;f.status==="writing"&&s.writing.add(f.id);let M=or(f);!M||!b(f.id,M)||(s.pending.size||(s.batchFor=t.id,s.batchShowing=s.showing),s.pending.set(f.id,M))}s.pending.size&&s.timer===void 0&&(s.timer=setTimeout(u,so))},[e,t]),_react.useEffect.call(void 0, ()=>()=>{clearTimeout(s.timer),s.frame!==void 0&&$t(s.frame),_optionalChain([s, 'access', _69 => _69.held, 'optionalAccess', _70 => _70.disconnect, 'call', _71 => _71()])},[s]),l}function lr(e,t){let[n,o]=_react.useState.call(void 0, !1),a=_react.useRef.call(void 0, e);return _react.useEffect.call(void 0, ()=>{let l=t.current;if(!l||typeof MutationObserver!="function")return;let c=()=>o(!!l.closest("[inert]"));c();let s=new MutationObserver(c);return s.observe(l.ownerDocument.documentElement,{attributes:!0,attributeFilter:["inert"],subtree:!0}),()=>s.disconnect()},[t]),n||(a.current=e),a.current}var co={"form.valid":"Valid","form.invalid":"Invalid","form.title":"Fill this form","form.closeHint":"Closing discards this fill; the reply stays in the conversation.","form.generate":"Generate draft","form.references":"Reference links","form.attachment":"Private attachment","form.regenerate":"Regenerate {field}","form.replace":"Replace your edit?","form.marker":"Form","form.filter":"Filter by topic","form.all":"All topics","form.threads":"Sub-threads","form.return":"Back to form or record","form.unlinked":"Saved, not linked","form.toolsLoading":"Draft tools are still loading.","form.toolsFailed":"Draft tools couldn't load. Retry first.","form.fixFirst":"Fix the highlighted fields first.","form.number":"Enter a number.","form.editInForm":"Edit this value in the form.","form.imagesNow":"Images can't be attached right now.","form.imagesHere":"Images can't be attached here.","chat.title":"Conversation","chat.empty":"Start a conversation","chat.message":"Message","chat.send":"Send","chat.sending":"Sending","chat.pendingSending":"Sending\u2026","chat.pendingFailed":"Not sent","chat.planUnavailable":"The plan's steps could not be loaded.","chat.arrival":"New reply","chat.arrivalExcerpt":"New reply: {excerpt}","chat.arrivalFailed":"A reply could not be completed.","chat.arrivalMany":"{count} new replies. Latest: {excerpt}","chat.arrivalManyPlain":"{count} new replies","chat.arrivalManyFailed":"{count} new replies; {failed} could not be completed.","chat.arrivalAllFailed":"{count} replies could not be completed.","chat.transcript":"Messages","chat.outlineItem":"{role}, message {position}: {excerpt}","chat.outlineItemPlain":"{role}, message {position}","chat.roleUser":"You","chat.roleAssistant":"Assistant","chat.messageLoading":"Loading message\u2026","chat.messageUnavailable":"This message cannot be shown right now.","chat.changesTo":"changes to","chat.stepName":"Change {index}","chat.stepNamed":"{name} {index}","chat.fieldName":"Value {index}","chat.scrollRegion":"Scrollable content","chat.conversationReadFailed":"This conversation could not be loaded.","chat.conversationsFailed":"Your conversations could not be loaded.","chat.messagesUnavailable":"Some messages cannot be shown right now.",unsupportedContent:"Some content cannot be shown here. Contact the site administrator.","chat.failure":"The request could not be completed.","chat.update":"This chat needs an update.","chat.conversationUnavailable":"This conversation is unavailable. Reload to continue; this does not stop a server turn.","chat.reload":"Reload conversation","chat.retry":"Retry","chat.withdraw":"Withdraw","chat.restored":"Withdrawn messages","chat.restoredEdit":"Edit","chat.restoredDiscard":"Discard","chat.dismiss":"Dismiss","chat.latest":"Back to latest","chat.latestNew":"{count, plural, one {Back to latest, # new reply} other {Back to latest, # new replies}}","chat.outline":"Message outline","chat.rail":"Conversations","chat.close":"Close","chat.quota":"Usage","chat.actions":"Actions","chat.panels":"Extra panels","chat.submit":"Submit","chat.confirm":"Confirm","chat.cancel":"Cancel","chat.stop":"Stop","chat.planChanged":"The plan changed; confirm again.","chat.stopped":"The plan was stopped. Start a new plan to continue.","chat.scheduleUnavailable":"Scheduling is unavailable in this chat.","chat.start":"Start time","chat.end":"End time","chat.view":"View change","chat.irreversible":"Cannot be undone","chat.stepUp":"{count, plural, one {# verification prompt} other {# verification prompts}}","chat.stepUpLabel":"Verification code","chat.plan":"Plan","chat.favourite":"Favourite","chat.run":"Run","chat.flows":"Saved requests","flow.favourites":"Favourites","flow.most-used":"Most used","flow.recent":"Recent","flow.presets":"Presets","reply.writing":"Writing","reply.stopped":"Stopped","chat.sources":"Sources ({count})","chat.source":"Source {index}: {title}","reply.unavailable":"Reply unavailable","reply.failed":"Reply failed","reply.overdue":"Reply overdue","chat.loading":"Loading","chat.before":"Before","chat.after":"After","chat.undo":"Undo","chat.verify":"Verification required","chat.startupLoading":"Loading this conversation\u2026"},et={en:{},zh:{}};function cr(e,t){Object.assign(et.en,e),Object.assign(et.zh,t)}var uo={"form.valid":"\u6709\u6548","form.invalid":"\u65E0\u6548","form.title":"\u586B\u5199\u6B64\u8868\u5355","form.closeHint":"\u5173\u95ED\u5C06\u4E22\u5F03\u672C\u6B21\u586B\u5145\uFF1B\u56DE\u590D\u4ECD\u4FDD\u7559\u5728\u5BF9\u8BDD\u4E2D\u3002","form.generate":"\u751F\u6210\u8349\u7A3F","form.references":"\u53C2\u8003\u94FE\u63A5","form.attachment":"\u79C1\u6709\u9644\u4EF6","form.regenerate":"\u91CD\u65B0\u751F\u6210{field}","form.replace":"\u66FF\u6362\u4F60\u7684\u4FEE\u6539\u5417\uFF1F","form.marker":"\u8868\u5355","form.filter":"\u6309\u4E3B\u9898\u7B5B\u9009","form.all":"\u6240\u6709\u4E3B\u9898","form.threads":"\u5B50\u5BF9\u8BDD","form.return":"\u8FD4\u56DE\u8868\u5355\u6216\u8BB0\u5F55","form.unlinked":"\u5DF2\u4FDD\u5B58\uFF0C\u672A\u5173\u8054","form.toolsLoading":"\u8349\u7A3F\u5DE5\u5177\u4ECD\u5728\u52A0\u8F7D\u3002","form.toolsFailed":"\u8349\u7A3F\u5DE5\u5177\u65E0\u6CD5\u52A0\u8F7D\uFF0C\u8BF7\u5148\u91CD\u8BD5\u3002","form.fixFirst":"\u8BF7\u5148\u4FEE\u6B63\u6807\u51FA\u7684\u5B57\u6BB5\u3002","form.number":"\u8BF7\u8F93\u5165\u6570\u5B57\u3002","form.editInForm":"\u8BF7\u5728\u8868\u5355\u4E2D\u7F16\u8F91\u6B64\u503C\u3002","form.imagesNow":"\u73B0\u5728\u65E0\u6CD5\u9644\u52A0\u56FE\u7247\u3002","form.imagesHere":"\u6B64\u5904\u65E0\u6CD5\u9644\u52A0\u56FE\u7247\u3002","chat.title":"\u5BF9\u8BDD","chat.empty":"\u5F00\u59CB\u5BF9\u8BDD","chat.message":"\u6D88\u606F","chat.send":"\u53D1\u9001","chat.sending":"\u6B63\u5728\u53D1\u9001","chat.pendingSending":"\u6B63\u5728\u53D1\u9001\u2026\u2026","chat.pendingFailed":"\u672A\u53D1\u9001","chat.planUnavailable":"\u65E0\u6CD5\u52A0\u8F7D\u6B64\u8BA1\u5212\u7684\u6B65\u9AA4\u3002","chat.arrival":"\u6536\u5230\u65B0\u56DE\u590D","chat.arrivalExcerpt":"\u6536\u5230\u65B0\u56DE\u590D\uFF1A{excerpt}","chat.arrivalFailed":"\u6709\u4E00\u6761\u56DE\u590D\u672A\u80FD\u5B8C\u6210\u3002","chat.arrivalMany":"\u6536\u5230 {count} \u6761\u65B0\u56DE\u590D\u3002\u6700\u65B0\u4E00\u6761\uFF1A{excerpt}","chat.arrivalManyPlain":"\u6536\u5230 {count} \u6761\u65B0\u56DE\u590D","chat.arrivalManyFailed":"\u6536\u5230 {count} \u6761\u65B0\u56DE\u590D\uFF0C\u5176\u4E2D {failed} \u6761\u672A\u80FD\u5B8C\u6210\u3002","chat.arrivalAllFailed":"{count} \u6761\u56DE\u590D\u672A\u80FD\u5B8C\u6210\u3002","chat.transcript":"\u6D88\u606F","chat.outlineItem":"{role}\uFF0C\u7B2C {position} \u6761\uFF1A{excerpt}","chat.outlineItemPlain":"{role}\uFF0C\u7B2C {position} \u6761","chat.roleUser":"\u4F60","chat.roleAssistant":"\u52A9\u624B","chat.messageLoading":"\u6B63\u5728\u52A0\u8F7D\u6D88\u606F\u2026\u2026","chat.messageUnavailable":"\u6682\u65F6\u65E0\u6CD5\u663E\u793A\u6B64\u6D88\u606F\u3002","chat.changesTo":"\u6539\u4E3A","chat.stepName":"\u66F4\u6539 {index}","chat.stepNamed":"{name} {index}","chat.fieldName":"\u503C {index}","chat.scrollRegion":"\u53EF\u6EDA\u52A8\u5185\u5BB9","chat.conversationReadFailed":"\u65E0\u6CD5\u52A0\u8F7D\u6B64\u5BF9\u8BDD\u3002","chat.conversationsFailed":"\u65E0\u6CD5\u52A0\u8F7D\u4F60\u7684\u5BF9\u8BDD\u5217\u8868\u3002","chat.messagesUnavailable":"\u90E8\u5206\u6D88\u606F\u6682\u65F6\u65E0\u6CD5\u663E\u793A\u3002",unsupportedContent:"\u6B64\u5904\u65E0\u6CD5\u663E\u793A\u90E8\u5206\u5185\u5BB9\u3002\u8BF7\u8054\u7CFB\u7AD9\u70B9\u7BA1\u7406\u5458\u3002","chat.failure":"\u65E0\u6CD5\u5B8C\u6210\u8BF7\u6C42\u3002","chat.update":"\u6B64\u5BF9\u8BDD\u9700\u8981\u66F4\u65B0\u540E\u624D\u80FD\u7EE7\u7EED\u4F7F\u7528\u3002","chat.conversationUnavailable":"\u6B64\u5BF9\u8BDD\u6682\u65F6\u65E0\u6CD5\u4F7F\u7528\u3002\u8BF7\u91CD\u65B0\u52A0\u8F7D\u540E\u7EE7\u7EED\uFF1B\u91CD\u65B0\u52A0\u8F7D\u4E0D\u4F1A\u505C\u6B62\u670D\u52A1\u5668\u6B63\u5728\u5904\u7406\u7684\u56DE\u590D\u3002","chat.reload":"\u91CD\u65B0\u52A0\u8F7D\u5BF9\u8BDD","chat.retry":"\u91CD\u8BD5","chat.withdraw":"\u64A4\u56DE","chat.restored":"\u5DF2\u64A4\u56DE\u7684\u6D88\u606F","chat.restoredEdit":"\u7F16\u8F91","chat.restoredDiscard":"\u4E22\u5F03","chat.dismiss":"\u5173\u95ED","chat.latest":"\u56DE\u5230\u6700\u65B0\u6D88\u606F","chat.latestNew":"{count, plural, other {\u56DE\u5230\u6700\u65B0\u6D88\u606F\uFF0C# \u6761\u65B0\u56DE\u590D}}","chat.outline":"\u6D88\u606F\u5927\u7EB2","chat.rail":"\u5BF9\u8BDD\u5217\u8868","chat.close":"\u5173\u95ED","chat.quota":"\u4F7F\u7528\u91CF","chat.actions":"\u64CD\u4F5C","chat.panels":"\u9644\u52A0\u9762\u677F","chat.submit":"\u63D0\u4EA4","chat.confirm":"\u786E\u8BA4","chat.cancel":"\u53D6\u6D88","chat.stop":"\u505C\u6B62","chat.planChanged":"\u8BA1\u5212\u5DF2\u66F4\u6539\uFF0C\u8BF7\u91CD\u65B0\u786E\u8BA4\u3002","chat.stopped":"\u8BA1\u5212\u5DF2\u505C\u6B62\u3002\u8BF7\u521B\u5EFA\u65B0\u8BA1\u5212\u4EE5\u7EE7\u7EED\u3002","chat.scheduleUnavailable":"\u6B64\u804A\u5929\u4E0D\u652F\u6301\u6392\u671F\u3002","chat.start":"\u5F00\u59CB\u65F6\u95F4","chat.end":"\u7ED3\u675F\u65F6\u95F4","chat.view":"\u67E5\u770B\u4FEE\u6539","chat.irreversible":"\u65E0\u6CD5\u64A4\u9500","chat.stepUp":"{count, plural, other {# \u6B21\u9A8C\u8BC1}}","chat.stepUpLabel":"\u9A8C\u8BC1\u7801","chat.plan":"\u8BA1\u5212","chat.favourite":"\u6536\u85CF","chat.run":"\u8FD0\u884C","chat.flows":"\u5DF2\u4FDD\u5B58\u7684\u8BF7\u6C42","flow.favourites":"\u6536\u85CF","flow.most-used":"\u6700\u5E38\u7528","flow.recent":"\u6700\u8FD1","flow.presets":"\u9884\u8BBE","reply.writing":"\u6B63\u5728\u56DE\u590D","reply.stopped":"\u5DF2\u505C\u6B62","chat.sources":"\u6765\u6E90\uFF08{count}\uFF09","chat.source":"\u6765\u6E90 {index}\uFF1A{title}","reply.unavailable":"\u65E0\u6CD5\u56DE\u590D","reply.failed":"\u56DE\u590D\u5931\u8D25","reply.overdue":"\u56DE\u590D\u5DF2\u8D85\u65F6","chat.loading":"\u52A0\u8F7D\u4E2D","chat.before":"\u4FEE\u6539\u524D","chat.after":"\u4FEE\u6539\u540E","chat.undo":"\u64A4\u9500","chat.verify":"\u9700\u8981\u9A8C\u8BC1","chat.startupLoading":"\u6B63\u5728\u52A0\u8F7D\u6B64\u5BF9\u8BDD\u2026"},fo=/^(tw|hk|mo)$/,po=/^(zh|cmn)$/,mo=/^([a-z]{2,3}(-[a-z]{3}){0,3}|[a-z]{4,8})(-[a-z]{4})?(-([a-z]{2}|\d{3}))?(-([a-z\d]{5,8}|\d[a-z\d]{3}))*(-[\da-wyz](-[a-z\d]{2,8})+)*(-x(-[a-z\d]{1,8})+)?$/,ho=/^zh-(hakka|min|xiang)\b/;function qt(e="en"){let t={catalogue:"en",lang:"en"},n=e.toLowerCase();if(!mo.test(n)||ho.test(n))return t;let o=n.split("-"),a=o[0],l=1;for(;/^[a-z]{3}$/.test(o[l]);)a=o[l++];if(po.test(a)){let c=o[l];return(/^[a-z]{4}$/.test(c)?c==="hans":!fo.test(c))?{catalogue:"zh",lang:e}:t}return a==="en"?{catalogue:"en",lang:e}:t}function Oe(e="en"){let t=qt(e),n=t.catalogue==="zh",o=n?uo:co,a=n?et.zh:et.en,l=_chunkQS3MKZOYcjs.b.call(void 0, t.lang,n),c=new Map;return(s,h)=>{let b=c.get(s);if(!b){let u=_nullishCoalesce(o[s], () => (a[s]));if(u===void 0)return"";b=new (0, _chunkQS3MKZOYcjs.a)(u,l),c.set(s,b)}return String(b.format(h))}}var zt=new Set,bo=e=>(zt.add(e),()=>zt.delete(e));function we(e){let t=o=>{n.load=o;for(let a of zt)a()},n={load:{status:"idle"},request(o){let{status:a}=n.load;a!=="idle"&&!(o&&a==="failed")||(t({status:"loading",...a==="failed"&&{retrying:!0}}),e().then(l=>t({status:"ready",module:l}),()=>t({status:"failed"})))}};return n}function pe(e){return _react.useSyncExternalStore.call(void 0, bo,()=>e.load,()=>e.load)}var tt=we(()=>Promise.resolve().then(() => _interopRequireWildcard(require("./markdown-BSRKJFFE.cjs")))),Qt=_react.createContext.call(void 0, null),kr=_react.createContext.call(void 0, void 0);function Co({id:e}){let t=_react.useContext.call(void 0, Qt);return _react.useEffect.call(void 0, ()=>(_optionalChain([t, 'optionalAccess', _72 => _72.report, 'call', _73 => _73(e,!0)]),()=>_optionalChain([t, 'optionalAccess', _74 => _74.report, 'call', _75 => _75(e,!1)])),[t,e]),null}function xo(){let e=pe(tt);return e.status==="ready"?e.module:void 0}var Be=e=>`wp${_react.useId.call(void 0, ).replace(/[^\w-]/g,"")}-${e}`,jt=we(()=>Promise.resolve().then(() => _interopRequireWildcard(require("./recovery-panel-OWY2CWOH.cjs")))),Po=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./confirmation-view-OMWHUYVC.cjs")))),Gt=we(()=>Promise.resolve().then(() => _interopRequireWildcard(require("./blocks-25YOJ5SS.cjs")))),dr=we(()=>Promise.resolve().then(() => _interopRequireWildcard(require("./reply-controls-CPWB4VBK.cjs"))));function Eo(e){let t=pe(dr);return _react.useEffect.call(void 0, ()=>dr.request(),[]),t.status==="ready"?_jsxruntime.jsx.call(void 0, t.module.ReplyControls,{...e}):null}var ur=we(()=>Promise.resolve().then(() => _interopRequireWildcard(require("./message-actions-F6SPLTT7.cjs"))));function So(e){let t=pe(ur);return _react.useEffect.call(void 0, ()=>ur.request(),[]),t.status==="ready"?_jsxruntime.jsx.call(void 0, t.module.MessageActions,{...e}):null}var Vt=we(()=>Promise.resolve().then(() => _interopRequireWildcard(require("./flows-panel-AIULKYOS.cjs"))));function en(){let e=pe(Gt);return _react.useEffect.call(void 0, ()=>Gt.request(),[]),e}function To({block:e}){let t=en();return t.status==="ready"?_jsxruntime.jsx.call(void 0, t.module.Answered,{block:e}):null}function Mo(e){let{format:t}=U(),n=en(),o=_jsxruntime.jsx.call(void 0, "p",{children:e.block.fallback});if(n.status==="failed")return o;if(n.status!=="ready")return _jsxruntime.jsx.call(void 0, "p",{children:t("chat.messageLoading")});let a=n.module.default;return _jsxruntime.jsx.call(void 0, He,{resetKey:e.block.id,fallback:o,children:_jsxruntime.jsx.call(void 0, a,{...e})})}var te=_react.createContext.call(void 0, null);function Ro({children:e,onPress:t,disabled:n,label:o,...a}){return _jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:t,disabled:n,"aria-label":o,...a,children:e})}function Fo({value:e,onChange:t,label:n,inputRef:o,onKeyDown:a,disabled:l,describedBy:c}){return _jsxruntime.jsx.call(void 0, "textarea",{ref:o,disabled:l,value:e,onChange:s=>_optionalChain([t, 'optionalCall', _76 => _76(s.target.value)]),"aria-label":n,"aria-describedby":c,onKeyDown:a})}function fr({value:e,onChange:t,label:n,type:o="text",disabled:a,invalid:l,describedBy:c,required:s}){return _jsxruntime.jsxs.call(void 0, "label",{children:[n,_jsxruntime.jsx.call(void 0, "input",{type:o,value:e,disabled:a,"aria-invalid":l,"aria-describedby":c,"aria-required":s||void 0,onChange:h=>t(h.target.value)})]})}function Lo({checked:e,onChange:t,label:n,disabled:o,invalid:a,describedBy:l}){return _jsxruntime.jsxs.call(void 0, "label",{className:"wp-check",children:[_jsxruntime.jsx.call(void 0, "input",{type:"checkbox",checked:e,disabled:o,"aria-invalid":a,"aria-describedby":l,onChange:c=>t(c.target.checked)}),n]})}function Io({children:e,open:t,label:n,onClose:o,closeLabel:a,focusInto:l,restoreFocus:c}){let s=_nullishCoalesce(_optionalChain([_react.useContext.call(void 0, te), 'optionalAccess', _77 => _77.format]), () => (Oe())),h=_react.useRef.call(void 0, null),b=_react.useRef.call(void 0, l),u=_react.useRef.call(void 0, c);b.current=l,u.current=c,_react.useLayoutEffect.call(void 0, ()=>{let f=h.current;if(!(!t||!f))return _optionalChain([b, 'access', _78 => _78.current, 'optionalCall', _79 => _79(f)]),()=>_optionalChain([u, 'access', _80 => _80.current, 'optionalCall', _81 => _81(f)])},[t]);let p=_react.useId.call(void 0, );return t?_jsxruntime.jsxs.call(void 0, "div",{ref:h,className:"wp-drawer",tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":p,onKeyDown:f=>{f.key==="Escape"&&o()},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"wp-drawer-header",children:[_jsxruntime.jsx.call(void 0, "h2",{id:p,children:n}),_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:o,"aria-label":_nullishCoalesce(a, () => (s("chat.close"))),children:_jsxruntime.jsx.call(void 0, "span",{"aria-hidden":"true",children:"\xD7"})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"wp-drawer-body",children:e})]}):null}var Cr={button:Ro,textarea:Fo,input:fr,checkbox:Lo,datePicker:e=>_jsxruntime.jsx.call(void 0, fr,{...e,type:"datetime-local"}),drawer:Io},pr="(prefers-color-scheme: dark)";function No(){return _react.useSyncExternalStore.call(void 0, e=>{let t=_optionalChain([globalThis, 'access', _82 => _82.matchMedia, 'optionalCall', _83 => _83(pr)]);return _optionalChain([t, 'optionalAccess', _84 => _84.addEventListener, 'call', _85 => _85("change",e)]),()=>_optionalChain([t, 'optionalAccess', _86 => _86.removeEventListener, 'call', _87 => _87("change",e)])},()=>_optionalChain([globalThis, 'access', _88 => _88.matchMedia, 'optionalCall', _89 => _89(pr), 'access', _90 => _90.matches])?"dark":"light",()=>"light")}function Do(e){let t=_optionalChain([e, 'access', _91 => _91.useThemeTokens, 'optionalCall', _92 => _92()]),n=e.theme===void 0&&t&&(e.colorScheme===void 0||e.colorScheme===t.scheme)?"host":"waypoint",o=No(),a=_nullishCoalesce(_nullishCoalesce(e.colorScheme, () => (_optionalChain([t, 'optionalAccess', _93 => _93.scheme]))), () => (o)),l=_react.useMemo.call(void 0, ()=>({...e,colorScheme:a,format:_nullishCoalesce(e.format, () => (Oe(e.locale))),lang:e.format?_nullishCoalesce(e.locale, () => ("en")):qt(e.locale).lang,tokens:{...a==="dark"?_chunk4BWV3SELcjs.b:_chunk4BWV3SELcjs.a,...n==="host"?t.tokens:e.theme},primitives:{...Cr,...e.primitives}}),[e,a,n,t]),c=e.wrapper,s=_jsxruntime.jsx.call(void 0, _chunkM3UENQ6Lcjs.d.Provider,{value:e.client,children:_jsxruntime.jsx.call(void 0, te.Provider,{value:l,children:e.children})});return c?_jsxruntime.jsx.call(void 0, c,{colorScheme:a,tokens:l.tokens,tokenSource:n,children:s}):s}function Ia(){return _nullishCoalesce(_optionalChain([_react.useContext.call(void 0, te), 'optionalAccess', _94 => _94.colorScheme]), () => ("light"))}function U(){let e=_react.useContext.call(void 0, te);if(!e)throw new Error("WaypointProvider is required");return e}function Na(){return U().client}function Da(e){let t=_react.useContext.call(void 0, te),n=_nullishCoalesce(e, () => (_optionalChain([t, 'optionalAccess', _95 => _95.client]))),o=_chunkM3UENQ6Lcjs.e.call(void 0, e);return{conversationId:o.conversationId,conversation:o.conversation,refresh:n.refresh,editMessage:n.editMessage,regenerate:n.regenerate,selectVersion:n.selectVersion,switchConversation:n.switchConversation}}function Aa(e){let t=_react.useContext.call(void 0, te),n=_nullishCoalesce(e, () => (_optionalChain([t, 'optionalAccess', _96 => _96.client]))),o=_chunkM3UENQ6Lcjs.e.call(void 0, e);return{draft:o.draft,sending:o.sending,hints:o.hints,setDraft:n.setDraft,send:n.send,retry:n.retry,withdraw:n.withdraw,dismiss:n.dismiss}}function Oa(e){let t=_react.useContext.call(void 0, te),n=_nullishCoalesce(e, () => (_optionalChain([t, 'optionalAccess', _97 => _97.client]))),o=_chunkM3UENQ6Lcjs.e.call(void 0, e),{view:a}=_chunkM3UENQ6Lcjs.f.call(void 0, e);return{plan:o.plan,setPlan:n.setPlan,reply:n.reply,view:a}}function Ba(e){let t=_react.useContext.call(void 0, te),n=_nullishCoalesce(e, () => (_optionalChain([t, 'optionalAccess', _98 => _98.client]))),o=_chunkM3UENQ6Lcjs.e.call(void 0, e);return{flows:o.flows,tab:o.flowTab,load:n.loadFlows,select:n.selectFlowTab,setFavourite:n.setFavourite,run:n.runFlow}}var Ha=["bubble","composer","transcript","replyRow","stepRow","planNode","widgetFrame","confirmBar","confirmation","topBar","rail","flowTabs","quotaStrip","failedSendControls","emptyState","messageActions","extraPanels","actionBar","stepUpPrompt","fieldAdornment","recoveryPanel","stepStatusRow","recoveryActions"];function xr({action:e,onPress:t,label:n}){let{format:o,primitives:a}=U(),l=a.button,c=_react.useId.call(void 0, );return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, l,{"data-action":e.id,"aria-disabled":e.available?void 0:!0,"aria-describedby":e.reasonKey?c:void 0,"aria-busy":e.busy?!0:void 0,onPress:e.available?()=>t(e.id):void 0,children:_nullishCoalesce(n, () => ((e.countedLabelKey&&e.labelValues?o(e.countedLabelKey,e.labelValues):o(e.labelKey))))}),e.reasonKey?_jsxruntime.jsx.call(void 0, "span",{id:c,"data-reason":e.id,children:o(e.reasonKey,e.reasonValues)}):null]})}function mr(e){let t=_react.useRef.call(void 0, !1),[n,o]=_react.useState.call(void 0, !1),a=()=>{t.current=!1,o(!1)};return{busy:n,press:()=>{t.current||(t.current=!0,o(!0),e().then(a,a))}}}function hr({problem:e,refresh:t}){let n=_chunkM3UENQ6Lcjs.i.call(void 0, e),o=_react.useMemo.call(void 0, ()=>Date.now()+(_nullishCoalesce(e.retryAfter, () => (0)))*1e3,[e]),[a,l]=_react.useState.call(void 0, 0),c=e.code==="rate-limited"&&Date.now()<o;return _react.useEffect.call(void 0, ()=>{if(!c)return;let s=setTimeout(()=>l(h=>h+1),Math.max(o-Date.now(),1));return()=>clearTimeout(s)},[c,o,a]),n?_jsxruntime.jsx.call(void 0, xr,{action:{id:"status",labelKey:n==="retry"?"chat.retry":"chat.problem.refresh",available:!c&&!t.busy,busy:t.busy,...c&&{reasonKey:"chat.problem.rateLimited"}},onPress:t.press}):null}function gr({problem:e}){let{format:t}=U();return t("chat.problem.details")?_jsxruntime.jsxs.call(void 0, "details",{"data-problem-details":"",children:[_jsxruntime.jsx.call(void 0, "summary",{children:t("chat.problem.details")}),_jsxruntime.jsx.call(void 0, "p",{children:t("chat.problem.code",{code:e.code})}),_jsxruntime.jsx.call(void 0, "p",{children:t("chat.problem.reference",{id:e.id})})]}):null}var nt=e=>e.status==="loading"&&!!e.retrying;function Xt(e){let{format:t,primitives:n}=U(),o=e.retrying||void 0;return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "p",{role:"alert",onFocus:e.onFocus,children:[t("chat.failure")," ",_jsxruntime.jsx.call(void 0, n.button,{"aria-disabled":o,"aria-busy":o,onPress:()=>{o||e.onRetry()},children:t("chat.retry")})]}),_jsxruntime.jsx.call(void 0, "span",{role:"status",children:o?t("chat.loading"):""})]})}function Ao(e){let{format:t}=U(),n=pe(jt);_react.useEffect.call(void 0, ()=>jt.request(),[]);let o=_react.useRef.call(void 0, null),a=Mt(()=>[_optionalChain([o, 'access', _99 => _99.current, 'optionalAccess', _100 => _100.querySelector, 'call', _101 => _101("h3")])]),l=n.status==="ready"&&n.module.default;return _jsxruntime.jsx.call(void 0, "div",{ref:o,tabIndex:-1,"data-recovery":"",children:l?_jsxruntime.jsx.call(void 0, l,{...e}):n.status==="failed"||nt(n)?_jsxruntime.jsx.call(void 0, Xt,{retrying:nt(n),onRetry:()=>jt.request(!0),onFocus:a}):_jsxruntime.jsx.call(void 0, "p",{children:t("chat.loading")})})}function br(e){return{id:e.id,type:e.type,answered:!!e.answered}}function vr(e){return{id:e.id,content:e.content,failure:e.failure?{code:e.failure.code}:null}}function B({name:e,slots:t,children:n,...o}){let l=_optionalChain([_react.useContext.call(void 0, te), 'optionalAccess', _102 => _102.parts, 'optionalAccess', _103 => _103[e]]),c=_optionalChain([t, 'optionalAccess', _104 => _104[e]]),s=c?c({...o,children:n}):l?_jsxruntime.jsx.call(void 0, l,{...o,children:n}):n;return _jsxruntime.jsx.call(void 0, "div",{"data-part":e,children:s})}var He= (_class2 =class extends _react.Component{constructor(...args) { super(...args); _class2.prototype.__init3.call(this); }__init3() {this.state={}}static getDerivedStateFromError(){return{failedKey:""}}componentDidCatch(){this.setState({failedKey:this.props.resetKey})}render(){let{failedKey:t}=this.state;return t===""||t===this.props.resetKey?this.props.fallback:this.props.children}}, _class2);function Oo({text:e,writing:t,sources:n}){let o=U(),a=o.format,l=_react.useContext.call(void 0, Qt),c=_react.useId.call(void 0, ),s=_nullishCoalesce(_react.useContext.call(void 0, kr), () => (c)),h=l?_jsxruntime.jsx.call(void 0, Co,{id:s}):_jsxruntime.jsx.call(void 0, "p",{children:a("chat.messageUnavailable")}),b=pe(tt);if(_react.useEffect.call(void 0, ()=>{tt.request(!0)},[e]),b.status==="failed")return h;if(b.status!=="ready")return _jsxruntime.jsx.call(void 0, "p",{children:a("chat.messageLoading")});let u=b.module.default;return _jsxruntime.jsx.call(void 0, He,{resetKey:`${e}:${_nullishCoalesce(_optionalChain([l, 'optionalAccess', _105 => _105.retry]), () => (0))}`,fallback:h,children:_jsxruntime.jsx.call(void 0, u,{text:e,writing:t,lang:o.lang,sources:n,sourceNames:{list:p=>a("chat.sources",{count:p}),item:(p,f)=>a("chat.source",{index:p,title:f})},images:o.markdownImages,extraSchemes:o.extraUrlSchemes,scrollLabel:a("chat.scrollRegion")})})}function Pr(e){let t=_optionalChain([U, 'call', _106 => _106(), 'access', _107 => _107.renderers, 'optionalAccess', _108 => _108.markdown]);return t?_jsxruntime.jsx.call(void 0, t,{text:e.text}):_jsxruntime.jsx.call(void 0, Oo,{...e})}function Bo(e,t){return{text:t(_chunkM3UENQ6Lcjs.j.call(void 0, e).key)||t("chat.failure")}}function Ho({block:e,onReply:t,disabled:n}){let{format:o,primitives:a,extraUrlSchemes:l}=U(),c=a.button,s=e.body;switch(e.type){case"form.fill":case"table":case"diff":case"form":case"choice":case"plan":return _jsxruntime.jsx.call(void 0, Mo,{block:e,onReply:t,disabled:n});case"markdown":return _jsxruntime.jsx.call(void 0, Pr,{text:String(_nullishCoalesce(s.text, () => ("")))});case"notice":return _jsxruntime.jsx.call(void 0, "p",{children:String(_nullishCoalesce(s.text, () => ("")))});case"card":return _jsxruntime.jsxs.call(void 0, "section",{children:[_jsxruntime.jsx.call(void 0, "h3",{children:String(_nullishCoalesce(s.title, () => ("")))}),(_nullishCoalesce(s.blocks, () => ([]))).map(h=>_jsxruntime.jsx.call(void 0, Yt,{block:h,disabled:n,onReply:t},h.id))]});case"details":return _jsxruntime.jsxs.call(void 0, "details",{children:[_jsxruntime.jsx.call(void 0, "summary",{children:String(_nullishCoalesce(s.summary, () => ("")))}),(_nullishCoalesce(s.blocks, () => ([]))).map(h=>_jsxruntime.jsx.call(void 0, Yt,{block:h,disabled:n,onReply:t},h.id))]});case"list":return _jsxruntime.jsx.call(void 0, "ul",{children:(_nullishCoalesce(s.items, () => ([]))).map((h,b)=>_jsxruntime.jsx.call(void 0, "li",{children:h},b))});case"route-link":{let h=String(_nullishCoalesce(s.route, () => ("")));return _chunkFBADWFRRcjs.a.call(void 0, h,l)?_jsxruntime.jsx.call(void 0, "a",{href:h,children:String(_nullishCoalesce(s.label, () => (o("chat.view"))))}):_jsxruntime.jsx.call(void 0, "span",{children:e.fallback})}case"buttons":return _jsxruntime.jsx.call(void 0, "div",{children:(_nullishCoalesce(s.actions, () => ([]))).map(h=>_jsxruntime.jsx.call(void 0, c,{disabled:n,onPress:()=>t({kind:"action",blockId:e.id,actionId:h.id}),children:h.label},h.id))});default:return _jsxruntime.jsx.call(void 0, "p",{children:e.fallback})}}var Uo=["markdown","form.fill","card","details","list","table","form","choice","buttons","diff","plan","route-link","notice"].map(e=>({type:e,render:Ho}));function Yt(e){let{widgets:t,format:n}=U(),o=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _109 => _109.find, 'call', _110 => _110(l=>l.type===e.block.type)]), () => (Uo.find(l=>l.type===e.block.type)));if(!o)return _jsxruntime.jsx.call(void 0, "div",{"data-fallback":"true",children:_jsxruntime.jsx.call(void 0, "p",{children:_optionalChain([e, 'access', _111 => _111.block, 'access', _112 => _112.fallback, 'optionalAccess', _113 => _113.trim, 'call', _114 => _114()])?e.block.fallback:n("unsupportedContent")})});let a=o.render;return _jsxruntime.jsx.call(void 0, a,{...e})}function $o(e){let{format:t,primitives:n}=U(),o=en(),a=n.button,l=_react.useRef.call(void 0, null),[c,s]=_react.useState.call(void 0, 0),h=_react.useRef.call(void 0, null);_react.useLayoutEffect.call(void 0, ()=>{let p=l.current;X(p,{root:p,owner:"",removed:h.current})});let b=_jsxruntime.jsxs.call(void 0, "p",{role:"alert",children:[t("chat.planUnavailable"),_jsxruntime.jsx.call(void 0, a,{onPress:()=>{h.current=document.activeElement,s(c+1),Gt.request(!0)},children:t("chat.retry")})]}),u=o.status==="ready"&&o.module.PlanSteps;return _jsxruntime.jsx.call(void 0, "div",{ref:l,tabIndex:-1,children:u?_jsxruntime.jsx.call(void 0, He,{resetKey:`${e.record.id}:${c}`,fallback:b,children:_jsxruntime.jsx.call(void 0, u,{...e})}):o.status==="failed"?b:_jsxruntime.jsx.call(void 0, "p",{children:t("chat.messageLoading")})})}function Ua(e){let t=_react.useContext.call(void 0, te);return e.client?_jsxruntime.jsx.call(void 0, Do,{...e,client:e.client,children:_jsxruntime.jsx.call(void 0, wr,{...e})}):t?_jsxruntime.jsx.call(void 0, wr,{...e}):_jsxruntime.jsx.call(void 0, "section",{className:"waypoint",dir:_nullishCoalesce(e.dir, () => ("ltr")),children:_jsxruntime.jsx.call(void 0, "p",{children:Oe(e.locale)("chat.empty")})})}var yr="\uE000";function Wo({messages:e,excerpts:t,anchor:n,open:o,onToggle:a,onNavigate:l}){let{format:c,primitives:s}=U(),h=s.button,b=Be("outline");return _jsxruntime.jsxs.call(void 0, "nav",{"aria-label":c("chat.outline"),"data-outline":"",className:"wp-outline",children:[_jsxruntime.jsx.call(void 0, h,{"aria-expanded":o,"aria-controls":b,onPress:a,children:c("chat.outline")}),_jsxruntime.jsx.call(void 0, "ol",{id:b,hidden:!o,role:"list",children:o?e.map((u,p)=>{let f={role:c(u.role==="user"?"chat.roleUser":"chat.roleAssistant"),position:p+1},M=t[p],d=M===void 0?void 0:c("chat.outlineItem",{...f,excerpt:yr}).split(yr);return _jsxruntime.jsx.call(void 0, "li",{children:_jsxruntime.jsx.call(void 0, "a",{href:`#${n(u.id)}`,"data-outline-link":u.id,onClick:m=>{m.preventDefault(),l(u.id)},children:d?d.length===2?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[d[0],_jsxruntime.jsx.call(void 0, "bdi",{children:M}),d[1]]}):_jsxruntime.jsx.call(void 0, "bdi",{children:c("chat.outlineItem",{...f,excerpt:M})}):c("chat.outlineItemPlain",f)})},u.id)}):null})]})}function Ko({label:e,closeLabel:t,onClose:n,skipRestore:o,onFocusWithin:a,children:l}){let c=U().primitives.drawer,s=Ot("rail"),h=_react.useRef.call(void 0, void 0),b=_react.useRef.call(void 0, a);return b.current=a,_jsxruntime.jsx.call(void 0, At,{as:c,open:!0,label:e,closeLabel:t,onClose:n,focusInto:u=>{let p=f=>b.current(ve(f));u.addEventListener("focusin",p),h.current={element:u,listener:p},_optionalChain([s, 'access', _115 => _115.focusInto, 'optionalCall', _116 => _116(u)])},restoreFocus:u=>{let p=h.current;h.current=void 0,_optionalChain([p, 'optionalAccess', _117 => _117.element, 'access', _118 => _118.removeEventListener, 'call', _119 => _119("focusin",p.listener)]),o()?_optionalChain([s, 'access', _120 => _120.release, 'optionalCall', _121 => _121()]):_optionalChain([s, 'access', _122 => _122.restoreFocus, 'optionalCall', _123 => _123(u)])},children:l})}function wr({slots:e,features:t,layout:n="panel",shortcuts:o,conversations:a=[],conversationSource:l,quota:c,onStop:s,suggestions:h=[]}){let b=_react.useId.call(void 0, ),u=U(),{client:p,format:f,tokens:M}=u,d=_chunkM3UENQ6Lcjs.e.call(void 0, ),m=_react.useRef.call(void 0, null),P=_react.useRef.call(void 0, null),C=_react.useRef.call(void 0, null),L=_react.useRef.call(void 0, null),E=_react.useRef.call(void 0, new Set).current,[,R]=_react.useState.call(void 0, 0),[N,W]=_react.useState.call(void 0, 0),se=_react.useMemo.call(void 0, ()=>({retry:N,report(r,g){E.has(r)!==g&&(g?E.add(r):E.delete(r),R(F=>F+1))}}),[N,E]),{isAnswered:w,reply:v}=_chunkM3UENQ6Lcjs.h.call(void 0, p),y=_react.useRef.call(void 0, null),k=_react.useRef.call(void 0, null),q=_react.useRef.call(void 0, new Set),[ie,D]=_react.useState.call(void 0, 0),[le,he]=_react.useState.call(void 0, !1),[Ce,nn]=_react.useState.call(void 0, ),rt=mr(()=>p.refresh()),rn=mr(()=>p.refresh()),ot=_chunkM3UENQ6Lcjs.f.call(void 0, p),G=u.primitives.button,Er=u.primitives.textarea,on=!!(_optionalChain([e, 'optionalAccess', _124 => _124.extraPanels])||_optionalChain([u, 'access', _125 => _125.parts, 'optionalAccess', _126 => _126.extraPanels])),an=Be("hint"),We=Be("pending"),Ke=r=>(_optionalChain([d, 'access', _127 => _127.conversation, 'optionalAccess', _128 => _128.mode])!=="form-fill"||r==="form-fill"||r==="widgets")&&d.capabilities.includes(r)&&(!t||t.includes(r)),[Sr,at]=_react.useState.call(void 0, "loading"),sn=()=>{at(r=>r==="failed"?"retrying":"loading"),p.loadFlows().then(()=>at("done"),()=>at("failed"))};_react.useEffect.call(void 0, sn,[p]);let[,Tr]=_react.useState.call(void 0, !1);_react.useEffect.call(void 0, ()=>{Promise.resolve().then(() => _interopRequireWildcard(require("./problem-messages-THONMXFZ.cjs"))).then(r=>{cr(r.problemEnglish,r.problemSimplifiedChinese),Tr(!0)})},[]);let T=Yn(m,Re(p,d.conversationId),P,C,r=>Re(p,r)),z=_nullishCoalesce(_optionalChain([d, 'access', _129 => _129.conversation, 'optionalAccess', _130 => _130.messages]), () => ([])),ge=_optionalChain([d, 'access', _131 => _131.conversation, 'optionalAccess', _132 => _132.id]),[st,ln]=_react.useState.call(void 0, {open:!1});st.conversationId!==ge&&ln({conversationId:ge,open:!1});let it=st.conversationId===ge&&st.open,Mr=`wp${b.replace(/[^\w-]/g,"")}`,cn=r=>`${Mr}-${r.replace(/[^A-Za-z0-9-]/gu,g=>`_${g.codePointAt(0)}_`)}`,qe=rr(C,L,ge,z.length,d),lt=_react.useRef.call(void 0, void 0),Rr=r=>{let g=r.target,F=z.map(Q=>Q.id),I={owner:T.value.owner(),shown:ge,order:F},A=g.closest("[data-outline-link]"),H=g.closest("[data-back-to-latest]"),$=g.closest("article[data-message-id]");lt.current=A?{...I,kind:"link",id:A.getAttribute("data-outline-link"),element:A}:H?{...I,kind:"latest",element:H}:$&&O(C.current,$)?{...I,kind:"message",id:$.getAttribute("data-message-id"),element:$}:void 0};_react.useLayoutEffect.call(void 0, ()=>{let r=lt.current;if(!r||r.element.isConnected)return;lt.current=void 0;let g=C.current,F=_optionalChain([g, 'optionalAccess', _133 => _133.parentElement]),I=(H,$)=>{let Q=new Map;for(let re of _nullishCoalesce(_optionalChain([$, 'optionalAccess', _134 => _134.querySelectorAll, 'call', _135 => _135(`[${H}]`)]), () => ([])))Q.set(re.getAttribute(H),re);let fe=r.order.indexOf(r.id);for(let re=fe+1;re<r.order.length;re++){let De=Q.get(r.order[re]);if(De)return De}for(let re=fe-1;re>=0;re--){let De=Q.get(r.order[re]);if(De)return De}},A=r.kind==="message"?_nullishCoalesce(I("data-message-id",g), () => (g)):r.kind==="link"?_nullishCoalesce(_nullishCoalesce(I("data-outline-link",F), () => (_optionalChain([F, 'optionalAccess', _136 => _136.querySelector, 'call', _137 => _137("nav[data-outline] [aria-expanded]")]))), () => (g)):g;ee(T.value,A,{owner:r.owner,stillCurrent:()=>T.value.owner()===r.owner&&_optionalChain([p, 'access', _138 => _138.getSnapshot, 'call', _139 => _139(), 'access', _140 => _140.conversation, 'optionalAccess', _141 => _141.id])===r.shown,removed:r.element,fallback:g})});let dn=a.length>0||!!l,[Z,Fr]=_react.useState.call(void 0, !1),[xe,Le]=_react.useState.call(void 0, !1),un=Be("rail"),Lr=It(xe,T.value.owner(),()=>Le(!1)),ct=_react.useRef.call(void 0, void 0),dt=_react.useRef.call(void 0, !1),ze=_react.useRef.call(void 0, !1),Ir=()=>{let r=dt.current||ze.current;return dt.current=!1,r};_react.useLayoutEffect.call(void 0, ()=>{let r=m.current;if(!r||typeof ResizeObserver!="function")return;let g=()=>{let I=r.getBoundingClientRect().width,A=parseFloat(getComputedStyle(r).fontSize)||16;Fr(I>0&&I<40*A)},F=new ResizeObserver(g);return F.observe(r),g(),()=>F.disconnect()},[]);let fn=_react.useRef.call(void 0, Z);_react.useLayoutEffect.call(void 0, ()=>{fn.current&&!Z&&xe&&(ze.current=!0,Le(!1)),fn.current=Z},[Z,xe]),_react.useLayoutEffect.call(void 0, ()=>{if(!ze.current||xe)return;ze.current=!1;let r=ct.current;if(ct.current=void 0,!r||r.element.isConnected)return;let g=_optionalChain([m, 'access', _142 => _142.current, 'optionalAccess', _143 => _143.querySelector, 'call', _144 => _144('[data-part="rail"] nav')]),F=r.id?_optionalChain([[..._nullishCoalesce(_optionalChain([g, 'optionalAccess', _145 => _145.querySelectorAll, 'call', _146 => _146("[data-conversation-id]")]), () => ([]))], 'access', _147 => _147.find, 'call', _148 => _148(I=>I.getAttribute("data-conversation-id")===r.id), 'optionalAccess', _149 => _149.querySelector, 'call', _150 => _150("button")]):void 0;ee(T.value,_nullishCoalesce(_nullishCoalesce(F, () => (g)), () => (C.current)),{owner:r.owner,stillCurrent:()=>T.value.owner()===r.owner,removed:r.element,fallback:C.current})});let je=_react.useRef.call(void 0, void 0),pn=T.value.owner();qe.pinned||!z.length?je.current=void 0:_optionalChain([je, 'access', _151 => _151.current, 'optionalAccess', _152 => _152.owner])!==pn&&(je.current={owner:pn,ids:new Set(z.map(r=>r.id))});let mn=je.current,hn=mn?z.filter(r=>r.role==="assistant"&&!mn.ids.has(r.id)).length:0,ut=xo(),ft=!!(_optionalChain([u, 'access', _153 => _153.renderers, 'optionalAccess', _154 => _154.markdown])||_optionalChain([u, 'access', _155 => _155.parts, 'optionalAccess', _156 => _156.bubble])||_optionalChain([u, 'access', _157 => _157.parts, 'optionalAccess', _158 => _158.transcript])||_optionalChain([e, 'optionalAccess', _159 => _159.bubble])||_optionalChain([e, 'optionalAccess', _160 => _160.transcript])),pt=_react.useRef.call(void 0, new Ze).current;pt.begin(Re(p,_nullishCoalesce(ge, () => (""))),[ft,u.messageExcerpt,ut,_optionalChain([u, 'access', _161 => _161.markdownImages, 'optionalAccess', _162 => _162.origin]),_optionalChain([u, 'access', _163 => _163.markdownImages, 'optionalAccess', _164 => _164.allow]),_optionalChain([u, 'access', _165 => _165.extraUrlSchemes, 'optionalAccess', _166 => _166.join, 'call', _167 => _167(" ")])],z.map(r=>({id:r.id,source:ft?r:r.content})));let gn=r=>{if(ft)return pt.get(r.id,r,g=>{let F=_optionalChain([u, 'access', _168 => _168.messageExcerpt, 'optionalCall', _169 => _169(g)]);return F===void 0?void 0:Bt(F)});if(ut)return pt.get(r.id,r.content,g=>Bt(ut.visibleText(g,{images:u.markdownImages,extraSchemes:u.extraUrlSchemes})))},Nr=it?z.map(gn):[],bn=_react.useRef.call(void 0, null),Dr=ir(p,d.conversation,gn,f,bn),be=Be("flows"),vn=_react.useRef.call(void 0, ""),yn=Mt(()=>{let r=_optionalChain([m, 'access', _170 => _170.current, 'optionalAccess', _171 => _171.querySelector, 'call', _172 => _172(`[id="${be}-panel"]`)]);return[_optionalChain([r, 'optionalAccess', _173 => _173.querySelector, 'call', _174 => _174(`[data-flow="${vn.current}"] button`)]),r]}),Ie=pe(Vt),wn=Ke("flows");_react.useEffect.call(void 0, ()=>{wn&&Vt.request()},[wn]);let[Ne,kn]=_react.useState.call(void 0, void 0),Cn=(r,g={})=>{let F=p,I=T.value.owner(),A=Re(F,`flow:${r}`),H=T.value.originFor("run-flow",A);kn(void 0),F.runFlow(r,g).then($=>{let Q=$&&Re(F,$);ee(T.value,P.current,{origin:H,owner:A,stillCurrent:()=>!!Q&&T.value.owner()===Q&&_optionalChain([F, 'access', _175 => _175.getSnapshot, 'call', _176 => _176(), 'access', _177 => _177.conversation, 'optionalAccess', _178 => _178.id])===$})},()=>{ce(H),kn({id:r,owner:I,values:g})})},Pe=d.replyState,Ee=z.at(-1),Ve=Pe==="writing"&&_optionalChain([Ee, 'optionalAccess', _179 => _179.status])==="writing"?Ee.id:void 0,Ar=_optionalChain([Ee, 'optionalAccess', _180 => _180.role])==="assistant"&&(Ee.status==="failed"||Ee.status==="unavailable")&&Pe===Ee.status,xn=_react.useRef.call(void 0, null),mt=lr(Pe,xn),Or=(r,g)=>F=>{let I=V(document),A=_chunkM3UENQ6Lcjs.g.call(void 0, d.conversationId,g,r.id,F),H=!q.current.has(A);q.current.add(A),v(r,F,g).then($=>{H&&q.current.delete(A);let Q=p.getSnapshot();_optionalChain([$, 'optionalAccess', _181 => _181.accepted])===!1&&_optionalChain([$, 'access', _182 => _182.problem, 'optionalAccess', _183 => _183.code])==="refused"&&_optionalChain([Q, 'access', _184 => _184.conversation, 'optionalAccess', _185 => _185.messages, 'access', _186 => _186.find, 'call', _187 => _187(fe=>fe.id===g), 'optionalAccess', _188 => _188.blocks, 'access', _189 => _189.find, 'call', _190 => _190(fe=>fe.id===r.id), 'optionalAccess', _191 => _191.answered])&&(k.current=Q.problem),y.current=I,D(fe=>fe+1)})};_react.useLayoutEffect.call(void 0, ()=>{let r=y.current,g=T.value.root();y.current=null,r&&g&&X(oe(r)?r:T.value.composer(),{root:g,owner:"",removed:r})},[ie]);let Pn=!!d.problem&&d.problem===k.current,de=d.problem&&!q.current.has(d.problem.id)?_nullishCoalesce(_optionalChain([u, 'access', _192 => _192.problemText, 'optionalCall', _193 => _193(d.problem,{answeredElsewhere:Pn})]), () => ((Pn?{text:f("chat.problem.answered")||f("chat.failure")}:Bo(d.problem,f)))):null,J=d.plan,j=ot.view,_e=de&&_optionalChain([d, 'access', _194 => _194.problem, 'optionalAccess', _195 => _195.id])!=="conversation-unavailable"&&!(_optionalChain([d, 'access', _196 => _196.problem, 'optionalAccess', _197 => _197.code])==="stopped"&&_optionalChain([j, 'optionalAccess', _198 => _198.status]))&&!_optionalChain([d, 'access', _199 => _199.problem, 'optionalAccess', _200 => _200.confirmation])&&!(d.conversationUnavailable&&_optionalChain([d, 'access', _201 => _201.problem, 'optionalAccess', _202 => _202.id])==="conversation-read")?d.problem:void 0,Se=_e&&d.pending.some(r=>r.failure&&r.id===_e.id)?_e:void 0,ht=Se?void 0:_e,gt=_optionalChain([j, 'optionalAccess', _203 => _203.actions, 'access', _204 => _204.find, 'call', _205 => _205(r=>r.id==="confirm")]),En=_optionalChain([j, 'optionalAccess', _206 => _206.actions, 'access', _207 => _207.find, 'call', _208 => _208(r=>r.id==="stop")]),ue=_chunk3KV7TDDRcjs.l.call(void 0, J,d.conversationId),Br=r=>{if(le)return;let g=p.getSnapshot();if(_optionalChain([_chunk3KV7TDDRcjs.l.call(void 0, g.plan,g.conversationId), 'optionalAccess', _209 => _209.token])!==r){nn(r);return}nn(void 0),he(!0),p.confirmPlan().finally(()=>he(!1))},Sn=d.confirmationRefusal,Hr=_optionalChain([Sn, 'optionalAccess', _210 => _210.token])===_optionalChain([ue, 'optionalAccess', _211 => _211.token])&&_optionalChain([Sn, 'optionalAccess', _212 => _212.problemId])===_optionalChain([d, 'access', _213 => _213.problem, 'optionalAccess', _214 => _214.id])?_optionalChain([d, 'access', _215 => _215.problem, 'optionalAccess', _216 => _216.confirmation, 'optionalAccess', _217 => _217.reason]):void 0,Ur=Ce!==void 0&&Ce!==_optionalChain([ue, 'optionalAccess', _218 => _218.token]),$r=Z?"section":"aside",Wr=_optionalChain([J, 'optionalAccess', _219 => _219.state])==="awaiting-confirmation"&&!_optionalChain([j, 'optionalAccess', _220 => _220.readOnly])&&ue!==void 0,bt=Ke("plans")&&J?_jsxruntime.jsxs.call(void 0, $r,{"aria-label":f("chat.plan"),"data-plan":"",children:[_jsxruntime.jsx.call(void 0, $o,{record:J,slots:e,view:j,changesShown:Wr}),_jsxruntime.jsxs.call(void 0, B,{name:"confirmBar",slots:e,data:j?{view:j,actions:j.actions.filter(r=>j.status?r.id==="confirm":r.id==="confirm"||r.id==="stop")}:void 0,children:[J.state==="awaiting-confirmation"&&!_optionalChain([j, 'optionalAccess', _221 => _221.readOnly])?_jsxruntime.jsx.call(void 0, B,{name:"confirmation",slots:e,data:ue&&{confirmation:ue},children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, Po,{record:ue,planId:J.id,entry:gt&&(le?{...gt,available:!1,busy:!0}:gt),onConfirm:()=>ue&&Br(ue.token),refusal:Hr,override:u.problemText&&de,replaced:Ur})})}):null,!_optionalChain([j, 'optionalAccess', _222 => _222.status])&&En?_jsxruntime.jsx.call(void 0, xr,{action:En,onPress:_nullishCoalesce(s, () => ((()=>p.stopPlan())))}):null]}),_optionalChain([j, 'optionalAccess', _223 => _223.status])?_jsxruntime.jsx.call(void 0, Ao,{view:j,onPress:ot.press,slots:e,sheet:ot.sheet,hide:["confirm"]}):null]}):null,Tn=z.at(-1),vt=Z&&bt&&!d.pending.length&&_optionalChain([Tn, 'optionalAccess', _224 => _224.blocks, 'access', _225 => _225.some, 'call', _226 => _226(r=>r.type==="plan"&&_optionalChain([r, 'access', _227 => _227.body, 'optionalAccess', _228 => _228.planId])===_optionalChain([J, 'optionalAccess', _229 => _229.id]))])?Tn:void 0,Mn=r=>_jsxruntime.jsx.call(void 0, B,{name:"messageActions",slots:e,data:{message:{id:r.id,role:r.role,status:r.status,versionIndex:r.versionIndex,versionCount:r.versionCount}},children:_jsxruntime.jsx.call(void 0, So,{client:p,message:r})});return _jsxruntime.jsx.call(void 0, Lt.Provider,{value:T.value,children:_jsxruntime.jsx.call(void 0, "section",{ref:m,className:"waypoint",dir:_nullishCoalesce(u.dir, () => ("ltr")),lang:u.lang,"data-layout":n,"data-color-scheme":_nullishCoalesce(u.colorScheme, () => ("light")),"data-custom-theme":u.theme?"":void 0,style:{..._chunk4BWV3SELcjs.c.call(void 0, M),colorScheme:_nullishCoalesce(u.colorScheme, () => ("light"))},...T.captureProps,onKeyDown:r=>{_optionalChain([o, 'optionalAccess', _230 => _230.focusComposer])===!1||r.key!==(_nullishCoalesce(_optionalChain([o, 'optionalAccess', _231 => _231.focusComposer]), () => ("/")))||!O(r.currentTarget,ve(r.nativeEvent))||!Jn(r.currentTarget)||r.currentTarget.querySelector(_chunkGT6PI4CTcjs.b)||(r.preventDefault(),_optionalChain([P, 'access', _232 => _232.current, 'optionalAccess', _233 => _233.focus, 'call', _234 => _234()]))},children:_jsxruntime.jsxs.call(void 0, "div",{className:"wp-shell","data-has-aside":Ke("plans")&&J||on?"":void 0,"data-has-rail":dn||_optionalChain([e, 'optionalAccess', _235 => _235.rail])||_optionalChain([u, 'access', _236 => _236.parts, 'optionalAccess', _237 => _237.rail])?"":void 0,children:[Z?null:_jsxruntime.jsx.call(void 0, B,{name:"rail",slots:e,children:_jsxruntime.jsx.call(void 0, _t,{conversations:a,source:l})}),_jsxruntime.jsxs.call(void 0, "main",{children:[_jsxruntime.jsxs.call(void 0, B,{name:"topBar",slots:e,children:[Z&&dn?_jsxruntime.jsx.call(void 0, "span",{"data-rail-toggle":"",children:_jsxruntime.jsx.call(void 0, G,{"aria-expanded":xe,"aria-controls":un,onPress:()=>Le(r=>!r),children:f("chat.rail")})}):null,_jsxruntime.jsx.call(void 0, "h2",{children:_optionalChain([d, 'access', _238 => _238.conversation, 'optionalAccess', _239 => _239.title])||f("chat.title")})]}),Z&&xe&&!Lr?_jsxruntime.jsx.call(void 0, Ko,{label:f("chat.rail"),closeLabel:f("chat.close"),onClose:()=>Le(!1),skipRestore:Ir,onFocusWithin:r=>{let g=r.closest("[data-conversation-id]");ct.current={element:r,id:_nullishCoalesce(_optionalChain([g, 'optionalAccess', _240 => _240.getAttribute, 'call', _241 => _241("data-conversation-id")]), () => (void 0)),owner:T.value.owner()}},children:_jsxruntime.jsx.call(void 0, "div",{id:un,children:_jsxruntime.jsx.call(void 0, _t,{conversations:a,source:l,onChoose:()=>{let r=T.value.originFor("rail-choice");dt.current=!0,ee(T.value,_optionalChain([m, 'access', _242 => _242.current, 'optionalAccess', _243 => _243.querySelector, 'call', _244 => _244("[data-rail-toggle] button")]),{origin:r,owner:T.value.owner()}),Le(!1)}})})}):null,_jsxruntime.jsx.call(void 0, B,{name:"transcript",slots:e,children:_jsxruntime.jsxs.call(void 0, "div",{onFocusCapture:Rr,children:[z.length?_jsxruntime.jsx.call(void 0, Wo,{messages:z,excerpts:Nr,anchor:cn,open:it,onToggle:()=>ln({conversationId:ge,open:!it}),onNavigate:r=>{let g=T.value.originFor("outline");ee(T.value,qe.toMessage(r),{origin:g,owner:T.value.owner()})}}):null,_jsxruntime.jsx.call(void 0, "div",{ref:C,className:"wp-transcript",role:"region","aria-label":f("chat.transcript"),tabIndex:-1,children:_jsxruntime.jsx.call(void 0, Qt.Provider,{value:se,children:_jsxruntime.jsxs.call(void 0, "div",{ref:L,children:[!d.conversation&&!d.conversationUnavailable&&!d.problem?_jsxruntime.jsx.call(void 0, "p",{children:f("chat.startupLoading")}):z.length?null:_jsxruntime.jsx.call(void 0, B,{name:"emptyState",slots:e,children:_jsxruntime.jsx.call(void 0, "p",{children:f("chat.empty")})}),z.map(r=>_jsxruntime.jsxs.call(void 0, "article",{id:cn(r.id),tabIndex:-1,"data-message-id":r.id,"data-role":r.role,"aria-busy":r.id===Ve?!0:void 0,"aria-label":f(r.role==="user"?"chat.roleUser":"chat.roleAssistant"),"data-body-unavailable":E.has(r.id)&&!r.blocks.length?"":void 0,children:[_jsxruntime.jsxs.call(void 0, B,{name:"bubble",slots:e,data:{message:{id:r.id,role:r.role,content:r.content,status:r.status,versionIndex:r.versionIndex,versionCount:r.versionCount,blocks:r.blocks.map(br)}},children:[_jsxruntime.jsx.call(void 0, "span",{"data-sender":"","aria-hidden":"true",children:f(r.role==="user"?"chat.roleUser":"chat.roleAssistant")}),_jsxruntime.jsx.call(void 0, kr.Provider,{value:r.id,children:_jsxruntime.jsx.call(void 0, Pr,{text:r.content,writing:r.id===Ve,sources:r.sources})}),r.id===Ve?_jsxruntime.jsx.call(void 0, "span",{"data-writing":"","aria-hidden":"true",children:f("reply.writing")}):r.status==="stopped"?_jsxruntime.jsx.call(void 0, "span",{"data-stopped":"",children:f("reply.stopped")}):r.status==="failed"||r.status==="unavailable"?_jsxruntime.jsx.call(void 0, "span",{"data-reply-ended":r.status,children:f(`reply.${r.status}`)}):null,r.blocks.map(g=>_jsxruntime.jsx.call(void 0, B,{name:"widgetFrame",slots:e,data:{block:br(g)},children:_jsxruntime.jsxs.call(void 0, "div",{"data-open-card":g.type==="card"&&!w(g,r.id)?"true":void 0,children:[_jsxruntime.jsx.call(void 0, Yt,{block:g,disabled:d.conversationUnavailable||w(g,r.id),onReply:Or(g,r.id)}),g.answered?_jsxruntime.jsx.call(void 0, To,{block:g}):null]})},g.id))]}),r===vt?null:Mn(r)]},r.id)),d.pending.map(r=>_jsxruntime.jsxs.call(void 0, "article",{"data-role":"pending","aria-label":f("chat.roleUser"),children:[_jsxruntime.jsxs.call(void 0, B,{name:"bubble",slots:e,data:{pending:vr(r)},children:[_jsxruntime.jsx.call(void 0, "span",{"data-sender":"","aria-hidden":"true",children:f("chat.roleUser")}),_jsxruntime.jsx.call(void 0, "p",{children:r.content})]}),_jsxruntime.jsx.call(void 0, "p",{id:`${We}-${r.id}`,"data-pending-status":r.failure?"failed":"sending",children:f(r.failure?"chat.pendingFailed":"chat.pendingSending")}),_optionalChain([Se, 'optionalAccess', _245 => _245.id])===r.id&&de?_jsxruntime.jsxs.call(void 0, "p",{role:"alert",children:[de.text,_nullishCoalesce(de.action, () => ((!u.problemText&&_chunkM3UENQ6Lcjs.i.call(void 0, Se)==="refresh"?_jsxruntime.jsx.call(void 0, hr,{problem:Se,refresh:rn}):null)))]},d.announcement):null,r.failure?_jsxruntime.jsxs.call(void 0, B,{name:"failedSendControls",slots:e,data:{pending:vr(r)},children:[_jsxruntime.jsx.call(void 0, G,{"aria-describedby":`${We}-${r.id}`,disabled:d.conversationUnavailable||d.sending,onPress:()=>{p.retry(r.id)},children:f("chat.retry")}),_jsxruntime.jsx.call(void 0, G,{"aria-describedby":`${We}-${r.id}`,disabled:d.withdrawing.includes(r.id),onPress:()=>{p.withdraw(r.id)},children:f("chat.withdraw")}),_jsxruntime.jsx.call(void 0, G,{"aria-describedby":`${We}-${r.id}`,onPress:()=>{p.dismiss(r.id)},children:f("chat.dismiss")})]}):null,_optionalChain([Se, 'optionalAccess', _246 => _246.id])===r.id?_jsxruntime.jsx.call(void 0, gr,{problem:Se},d.announcement):null]},r.id))]})})}),E.size?_jsxruntime.jsxs.call(void 0, "p",{role:"alert","data-render-failure":"",children:[f("chat.messagesUnavailable"),_jsxruntime.jsx.call(void 0, G,{onPress:()=>{tt.request(!0),W(r=>r+1)},children:f("chat.retry")})]}):null,qe.pinned?null:_jsxruntime.jsx.call(void 0, "div",{"data-back-to-latest":"",children:_jsxruntime.jsx.call(void 0, G,{onPress:()=>{let r=T.value.originFor("latest");qe.toLatest(),ee(T.value,C.current,{origin:r,owner:T.value.owner()})},children:hn?f("chat.latestNew",{count:hn}):f("chat.latest")})})]})}),_jsxruntime.jsxs.call(void 0, B,{name:"replyRow",slots:e,children:[_jsxruntime.jsx.call(void 0, "div",{ref:xn,role:"status","data-reply-state":Pe,children:mt==="none"||Ar?null:_jsxruntime.jsx.call(void 0, "p",{className:mt==="writing"&&Ve?"wp-sr-only":void 0,children:f(`reply.${mt}`)})}),Pe!=="none"||d.toolSteps.length?_jsxruntime.jsx.call(void 0, Eo,{client:p,row:Pe}):null]}),Z?bt:null,vt?Mn(vt):null,Ke("flows")?_jsxruntime.jsx.call(void 0, B,{name:"flowTabs",slots:e,children:_jsxruntime.jsxs.call(void 0, "nav",{"aria-label":f("chat.flows"),children:[_jsxruntime.jsx.call(void 0, "div",{role:"tablist",onKeyDown:r=>{let g=d.flowTabs,F=g.findIndex(H=>_chunk3KV7TDDRcjs.f.call(void 0, H)===d.flowTab),I;if(r.key==="Home")I=0;else if(r.key==="End")I=g.length-1;else if(r.key==="ArrowRight"||r.key==="ArrowLeft"){let H=getComputedStyle(r.currentTarget).direction,$=r.key==="ArrowRight"!=((H==="rtl"||H==="ltr"?H:u.dir)==="rtl");I=(F+($?1:g.length-1))%g.length}else return;let A=r.currentTarget;!O(A,ve(r.nativeEvent))||!O(A,V(A.ownerDocument))||(r.preventDefault(),p.selectFlowTab(g[I]),_optionalChain([r, 'access', _247 => _247.currentTarget, 'access', _248 => _248.querySelectorAll, 'call', _249 => _249('[role="tab"]'), 'access', _250 => _250[I], 'optionalAccess', _251 => _251.focus, 'call', _252 => _252()]))},children:d.flowTabs.map(r=>_jsxruntime.jsx.call(void 0, G,{id:`${be}-${_chunk3KV7TDDRcjs.f.call(void 0, r)}`,"aria-controls":`${be}-panel`,role:"tab","aria-selected":d.flowTab===_chunk3KV7TDDRcjs.f.call(void 0, r),tabIndex:d.flowTab===_chunk3KV7TDDRcjs.f.call(void 0, r)?0:-1,label:typeof r=="string"?f(`flow.${r}`):_nullishCoalesce(_optionalChain([u, 'access', _253 => _253.flowTabLabel, 'optionalCall', _254 => _254(r.labelKey)]), () => (r.labelKey)),onPress:()=>p.selectFlowTab(r),children:typeof r=="string"?f(`flow.${r}`):_nullishCoalesce(_optionalChain([u, 'access', _255 => _255.flowTabLabel, 'optionalCall', _256 => _256(r.labelKey)]), () => (r.labelKey))},_chunk3KV7TDDRcjs.f.call(void 0, r)))}),Ne&&Ne.owner===T.value.owner()?_jsxruntime.jsx.call(void 0, Xt,{onFocus:r=>{vn.current=Ne.id,yn(r)},onRetry:()=>Cn(Ne.id,Ne.values)}):null,Ie.status==="ready"?_jsxruntime.jsx.call(void 0, Ie.module.FlowPanel,{id:`${be}-panel`,labelledBy:`${be}-${d.flowTab}`,flows:d.flows[d.flowTab],all:d.flows,list:Sr,onRetryList:sn,onRunFlow:Cn}):_jsxruntime.jsx.call(void 0, "div",{id:`${be}-panel`,role:"tabpanel","aria-labelledby":`${be}-${d.flowTab}`,tabIndex:-1,onFocus:yn,children:Ie.status==="failed"||nt(Ie)?_jsxruntime.jsx.call(void 0, Xt,{retrying:nt(Ie),onRetry:()=>Vt.request(!0)}):_jsxruntime.jsx.call(void 0, "p",{children:f("chat.loading")})})]})}):null,d.restored.length?_jsxruntime.jsx.call(void 0, "section",{"aria-label":f("chat.restored"),children:d.restored.map(r=>_jsxruntime.jsxs.call(void 0, "article",{children:[_jsxruntime.jsx.call(void 0, "p",{children:r.content}),_jsxruntime.jsx.call(void 0, G,{onPress:()=>{p.editRestored(r.id)},children:f("chat.restoredEdit")}),_jsxruntime.jsx.call(void 0, G,{onPress:()=>{p.discardRestored(r.id)},children:f("chat.restoredDiscard")})]},r.id))}):null,_jsxruntime.jsxs.call(void 0, B,{name:"composer",slots:e,data:{sending:d.sending},disabled:d.conversationUnavailable,value:d.draft,onChange:r=>{p.setDraft(r)},children:[_jsxruntime.jsx.call(void 0, Er,{inputRef:P,disabled:d.conversationUnavailable,value:d.draft,onChange:r=>{p.setDraft(r)},label:f("chat.message"),describedBy:d.hints.length?d.hints.map((r,g)=>`${an}-${g}`).join(" "):void 0,onKeyDown:r=>{_optionalChain([o, 'optionalAccess', _257 => _257.send])!==!1&&r.key===(_nullishCoalesce(_optionalChain([o, 'optionalAccess', _258 => _258.send]), () => ("Enter")))&&!r.shiftKey&&!r.nativeEvent.isComposing&&r.keyCode!==229&&(r.preventDefault(),p.send())}}),_jsxruntime.jsx.call(void 0, G,{disabled:d.conversationUnavailable||!d.draft.trim()||d.sending,onPress:()=>{p.send()},children:f(d.sending?"chat.sending":"chat.send")}),d.hints.map((r,g)=>_jsxruntime.jsx.call(void 0, "p",{id:`${an}-${g}`,children:r},g))]}),_jsxruntime.jsx.call(void 0, B,{name:"actionBar",slots:e,children:h.map(r=>_jsxruntime.jsx.call(void 0, G,{onPress:()=>{p.setDraft(r)},children:r},r))}),_jsxruntime.jsx.call(void 0, B,{name:"stepUpPrompt",slots:e,data:_optionalChain([J, 'optionalAccess', _259 => _259.plan, 'access', _260 => _260.kind])==="immediate"&&J.plan.stage==="final"?{stepUpCount:J.plan.stepUpCount}:void 0}),_jsxruntime.jsx.call(void 0, B,{name:"quotaStrip",slots:e,children:c}),_jsxruntime.jsx.call(void 0, "div",{ref:bn,className:"wp-sr",role:"status","data-announcements":"",children:Dr}),_jsxruntime.jsxs.call(void 0, "div",{role:"alert","data-announcement":d.announcement,children:[d.conversationUnavailable&&_jsxruntime.jsxs.call(void 0, "span",{children:[f("chat.conversationUnavailable"),_jsxruntime.jsx.call(void 0, G,{onPress:rt.press,"aria-busy":rt.busy||void 0,"aria-disabled":rt.busy||void 0,children:f("chat.reload")})]}),ht&&de?_jsxruntime.jsxs.call(void 0, "span",{children:[de.text,_nullishCoalesce(de.action, () => ((d.problem&&!u.problemText?_jsxruntime.jsx.call(void 0, hr,{problem:d.problem,refresh:rn}):null)))]},d.announcement):null]}),ht?_jsxruntime.jsx.call(void 0, gr,{problem:ht},d.announcement):null]}),Z?null:bt,on?_jsxruntime.jsx.call(void 0, B,{name:"extraPanels",slots:e}):null]})})})}function $a({title:e,body:t,busy:n=!1,onProceed:o,onCancel:a}){let l=_react.useContext.call(void 0, te),c=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _261 => _261.format]), () => (Oe())),s=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _262 => _262.primitives]), () => (Cr)),h=s.drawer,b=Ot("confirm-sheet"),u=It(!0,_optionalChain([Ae, 'call', _263 => _263(), 'optionalAccess', _264 => _264.owner, 'call', _265 => _265()]),a),p=s.button;return u?null:_jsxruntime.jsxs.call(void 0, At,{as:h,open:!0,label:e,onClose:a,closeLabel:c("chat.close"),...b,children:[_jsxruntime.jsx.call(void 0, "p",{children:t}),_jsxruntime.jsx.call(void 0, p,{disabled:n,onPress:o,children:c("chat.confirm")}),_jsxruntime.jsx.call(void 0, p,{onPress:a,children:c("chat.cancel")})]})}function _t({conversations:e,source:t,onChoose:n}){let{client:o,format:a,primitives:l,extraUrlSchemes:c}=U(),{conversationId:s}=_react.useSyncExternalStore.call(void 0, o.subscribe,o.getSnapshot,o.getSnapshot),[h,b]=_react.useState.call(void 0, ""),[u,p]=_react.useState.call(void 0, []),[f,M]=_react.useState.call(void 0, !1),[d,m]=_react.useState.call(void 0, 0),[P,C]=_react.useState.call(void 0, new Map);_react.useEffect.call(void 0, ()=>{if(!t)return;let w=!0;return M(!1),Promise.resolve().then(()=>t.list(h||void 0)).then(v=>{w&&(p(v),C(y=>new Map([...y,...v.filter(k=>k.subject).map(k=>[k.subject.key,k.subject])])))}).catch(()=>{w&&M(!0)}),()=>{w=!1}},[t,h,s,d]);let L=t?u:e,E=t?P:new Map(L.filter(w=>w.subject).map(w=>[w.subject.key,w.subject])),R=new Map;for(let w of L){let v=_nullishCoalesce(_optionalChain([w, 'access', _266 => _266.subject, 'optionalAccess', _267 => _267.key]), () => (""));h&&v!==h||R.set(v,[..._nullishCoalesce(R.get(v), () => ([])),w])}let N=l.button,W=Ae(),se=w=>_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, N,{"aria-current":w.id===s?"page":void 0,onPress:()=>{_optionalChain([n, 'optionalCall', _268 => _268()]);let v=_nullishCoalesce(_optionalChain([W, 'optionalAccess', _269 => _269.ownerOf, 'call', _270 => _270(w.id)]), () => (w.id)),y=_optionalChain([W, 'optionalAccess', _271 => _271.originFor, 'call', _272 => _272("switch",v)]);o.switchConversation(w.id).then(k=>ee(W,_optionalChain([W, 'optionalAccess', _273 => _273.composer, 'call', _274 => _274()]),{origin:y,owner:v,stillCurrent:()=>k.kind==="loaded"&&_optionalChain([W, 'optionalAccess', _275 => _275.owner, 'call', _276 => _276()])===v&&_optionalChain([o, 'access', _277 => _277.getSnapshot, 'call', _278 => _278(), 'access', _279 => _279.conversation, 'optionalAccess', _280 => _280.id])===w.id}))},children:w.title}),w.mode==="form-fill"&&_jsxruntime.jsx.call(void 0, "span",{children:a("form.marker")}),_optionalChain([w, 'access', _281 => _281.subject, 'optionalAccess', _282 => _282.state])==="unlinked"&&_jsxruntime.jsx.call(void 0, "span",{children:a("form.unlinked")}),_optionalChain([w, 'access', _283 => _283.subject, 'optionalAccess', _284 => _284.route])&&_chunkFBADWFRRcjs.a.call(void 0, w.subject.route,c)&&_jsxruntime.jsx.call(void 0, "a",{href:w.subject.route,children:a("form.return")})]});return _jsxruntime.jsxs.call(void 0, "nav",{className:"wp-rail","aria-label":a("chat.rail"),tabIndex:-1,children:[E.size>0&&_jsxruntime.jsxs.call(void 0, "label",{children:[a("form.filter"),_jsxruntime.jsxs.call(void 0, "select",{value:h,onChange:w=>b(w.target.value),children:[_jsxruntime.jsx.call(void 0, "option",{value:"",children:a("form.all")}),[...E].map(([w,v])=>_jsxruntime.jsx.call(void 0, "option",{value:w,children:v.label},w))]})]}),f&&_jsxruntime.jsxs.call(void 0, "p",{role:"alert",children:[a("chat.conversationsFailed")," ",_jsxruntime.jsx.call(void 0, N,{onPress:()=>m(w=>w+1),children:a("chat.retry")})]}),[...R].map(([w,v])=>{let y=new Set,k=D=>{if(y.has(D.id))return null;y.add(D.id);let le=v.filter(he=>he.parentConversationId===D.id&&!y.has(he.id));return _jsxruntime.jsxs.call(void 0, "li",{"data-conversation-id":D.id,children:[se(D),le.length>0&&_jsxruntime.jsxs.call(void 0, "details",{children:[_jsxruntime.jsx.call(void 0, "summary",{children:a("form.threads")}),_jsxruntime.jsx.call(void 0, "ul",{children:le.map(k)})]})]},D.id)},ie=v.filter(D=>!D.parentConversationId||!v.some(le=>le.id===D.parentConversationId)).map(k);for(let D of v)y.has(D.id)||ie.push(k(D));return _jsxruntime.jsxs.call(void 0, "section",{children:[w&&_jsxruntime.jsx.call(void 0, "h3",{children:v[0].subject.label}),_jsxruntime.jsx.call(void 0, "ul",{children:ie})]},w)})]})}exports.a = V; exports.b = O; exports.c = oe; exports.d = ce; exports.e = Mt; exports.f = Lt; exports.g = Ae; exports.h = It; exports.i = Yr; exports.j = ee; exports.k = At; exports.l = Ot; exports.m = Zo; exports.n = Jo; exports.o = _t; exports.p = co; exports.q = cr; exports.r = uo; exports.s = qt; exports.t = Oe; exports.u = we; exports.v = pe; exports.w = Do; exports.x = Ia; exports.y = U; exports.z = Na; exports.A = Da; exports.B = Aa; exports.C = Oa; exports.D = Ba; exports.E = Ha; exports.F = xr; exports.G = mr; exports.H = Xt; exports.I = Ao; exports.J = B; exports.K = Bo; exports.L = Uo; exports.M = Yt; exports.N = $o; exports.O = Ua; exports.P = $a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});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= exports.b ={"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}"};exports.a = t; exports.b = e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{H as G,J,b as H,e as q,k as X,m as $,n as z,u as V,v as j,x as L,y as O}from"./chunk-TGL3DR2K.js";import{useEffect as te,useId as re,useRef as R,useState as K}from"react";import{jsx as B,jsxs as Q}from"react/jsx-runtime";function U({children:e,label:u,onRegenerate:w,disabled:y,reason:d,slots:h,wrapper:c}){let r=re(),S=L(),[N,p]=K(!1),[f,P]=K(!1),x=R(!1),l=R(!1),m=R(!1),F=R(null),v=R(void 0),i=()=>{clearTimeout(v.current),v.current=void 0};return te(()=>i,[]),Q("div",{ref:c,className:"wp-field-parent",style:{colorScheme:S},onClickCapture:b=>{let n=!!F.current&&H(F.current,b.target);n&&(m.current=!0),$(b,b.currentTarget,()=>{n&&(m.current=!1,!l.current&&!x.current&&(i(),p(!1)))})},onPointerEnter:()=>{x.current=!0,i(),p(!0)},onPointerLeave:()=>{x.current=!1,i(),v.current=setTimeout(()=>{!l.current&&!m.current&&p(!1)},400)},onFocus:()=>{l.current=!0,m.current=!1,i(),p(!0),P(!0)},onBlur:b=>{H(b.currentTarget,b.relatedTarget)||(l.current=!1,P(!1),!x.current&&!m.current&&(i(),p(!1)))},children:[e,Q("span",{ref:F,className:"wp-field-adornment",hidden:!N,children:[B(J,{name:"fieldAdornment",slots:h,label:u,onPress:d?void 0:w,disabled:y,"aria-disabled":d?!0:void 0,describedBy:d?r:void 0,children:B("button",{type:"button","aria-label":u,disabled:y,"aria-disabled":d?!0:void 0,"aria-describedby":d?r:void 0,onClick:()=>{d||w()},children:u})}),d?B("span",{id:r,className:"wp-sr-only",children:d}):null]}),B("span",{role:"status",className:"wp-sr-only",children:N&&f?u:""})]})}import{useEffect as Y,useId as Z,useRef as D,useState as I,useSyncExternalStore as ne}from"react";import{Fragment as ee,jsx as t,jsxs as C}from"react/jsx-runtime";var W=V(()=>import("./form-extras-SBBOMJS2.js"));function _(){let e=j(W);return Y(()=>W.request(),[]),e}var oe=e=>{let u=e.trim()===""?NaN:Number(e);return Number.isFinite(u)?u:void 0};function se(e){return ne(e.subscribe,e.getSnapshot,e.getSnapshot)}function Fe({session:e,onRegenerate:u,slots:w,renderField:y}){let d=se(e),{fields:h,pending:c}=d,{format:r,primitives:S}=O(),N=Z(),p=_(),f=p.status==="ready"?p.module:void 0,P=S.input,x=S.checkbox,l=Object.values(h).some(n=>n.localInvalid),[m,F]=I(""),v=D(new Map),i=D(""),b=q(()=>[v.current.get(i.current)?.querySelector("input,textarea,select,button,[tabindex]")]);return C(ee,{children:[Object.entries(h).map(([n,o],M)=>{let T=`${N}-${M}`,k=o.validation?.status==="invalid"||!!o.localInvalid,g=o.value,A={label:o.label,invalid:k,describedBy:T};return C(U,{reason:f?l?r("form.fixFirst"):c?r("form.revertWait"):void 0:r(p.status==="failed"?"form.toolsFailed":"form.toolsLoading"),label:r("form.regenerate",{field:o.label}),slots:w,onRegenerate:()=>u(n),wrapper:a=>v.current.set(n,a),children:[y?y({name:n,label:o.label,value:g,onChange:a=>e.edit(n,a),invalid:k,describedBy:T}):typeof g=="string"?t(P,{...A,value:g,onChange:a=>e.edit(n,a)}):typeof g=="number"?t(P,{...A,type:"number",value:o.localText??String(g),onChange:a=>{let s=oe(a);s===void 0?e.markEdited(n,a):e.edit(n,s)}}):typeof g=="boolean"?t(x,{...A,checked:g,onChange:a=>e.edit(n,a)}):C("div",{children:[o.label,": ",f?t(f.Value,{value:g,t:r}):null," ",r("form.editInForm")]}),C("div",{id:T,className:k?"wp-invalid":void 0,children:[k?t("strong",{children:r("form.invalid")}):null,o.localInvalid?t("p",{children:r("form.number")}):null,o.validation?.messages.map((a,s)=>t("p",{children:a},s)),o.validation?.guidance&&t("p",{children:o.validation.guidance})]}),t("div",{onFocus:a=>{i.current=n,b(a)},children:o.replacement&&f?t(f.Suggestion,{name:n,draft:o,session:e,t:r,primitives:S,onReplace:()=>F(f.attentionText(e.getSnapshot(),r))}):null})]},n)}),f?t(f.FieldsStatus,{text:m}):null]})}function ye({session:e,open:u,onClose:w,field:y,source:d,attachments:h}){let{format:c,primitives:r}=O(),[S,N]=I(""),[p,f]=I(""),[P,x]=I(""),l=_(),m=l.status==="ready"?l.module:void 0,F=D(null),v=D(0),i=D(void 0),b=r.button,n=r.drawer,o=r.textarea,M=z(),T=Z();Y(()=>(v.current++,()=>{v.current++,e.cancel()}),[u,e,y]);let k=()=>{v.current++,e.cancel(),w()},g=s=>s.some(E=>E.type.startsWith("image/"))?(i.current?i.current([...s]):x(c(h?"form.imagesNow":"form.imagesHere")),!0):!1,A=q(()=>[F.current?.querySelector("textarea")]),a=L();return C(X,{as:n,open:u,label:c("form.title"),onClose:k,closeLabel:c("chat.close"),...M,children:[C("div",{ref:F,style:{colorScheme:a},onPasteCapture:s=>{g(Array.from(s.clipboardData.files))&&h&&i.current&&s.preventDefault()},onDragOver:s=>{s.dataTransfer.types.includes("Files")&&s.preventDefault()},onDrop:s=>{if(!s.dataTransfer.files.length)return;s.preventDefault();let E=Array.from(s.dataTransfer.files);g(E)||i.current?.(E)},children:[t("p",{children:c("chat.message")}),t(o,{label:c("chat.message"),value:S,onChange:N}),t("p",{children:c("form.references")}),t(o,{label:c("form.references"),value:p,onChange:f})]}),m?null:t("p",{role:"status",children:P}),m?t(m.PopupBody,{session:e,open:u,field:y,source:d,attachments:h,text:S,references:p,scope:v,upload:i,messageField:()=>F.current?.querySelector("textarea")??null}):C(ee,{children:[l.status==="failed"||l.status==="loading"&&l.retrying?t(G,{retrying:l.status==="loading",onRetry:()=>W.request(!0),onFocus:A}):null,t(b,{"aria-disabled":!0,"aria-describedby":T,children:c("form.generate")}),t("span",{id:T,children:c(l.status==="failed"?"form.toolsFailed":"form.toolsLoading")})]})]})}export{U as a,se as b,Fe as c,ye as d};
|
|
@@ -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 r(n){let e=_optionalChain([n, 'optionalAccess', _ => _.revision]);return typeof e=="number"&&Number.isSafeInteger(e)?e:0}exports.a = r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _react = require('react');var _jsxruntime = require('react/jsx-runtime');function d({value:t,t:r}){return t==null||t===""?r("chat.block.empty"):Array.isArray(t)?t.length?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:t.map((n,o)=>_jsxruntime.jsxs.call(void 0, _react.Fragment,{children:[o?", ":null,_jsxruntime.jsx.call(void 0, d,{value:n,t:r})]},o))}):r("chat.block.empty"):typeof t=="object"?_jsxruntime.jsx.call(void 0, "dl",{children:Object.entries(t).map(([n,o])=>_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "dt",{children:n}),_jsxruntime.jsx.call(void 0, "dd",{children:_jsxruntime.jsx.call(void 0, d,{value:o,t:r})})]},n))}):String(t)}exports.a = d;
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var a={code:"retryable",id:"conformance-load"},i=async()=>{try{return await import("./run-XBABOEXK.js")}catch{throw{...a}}};async function r(t){return(await i()).runConformance(t)}var e=process.argv[2];if(!e)throw new Error("Provide a test base URL");var n=await r({baseUrl:e,profile:process.argv.includes("--app-host")?"app-host":"admin-host",request:async(t,s)=>{let o=await fetch(e+t,s);return{status:o.status,body:await o.json()}}});process.stdout.write(JSON.stringify(n)+`
|
|
3
|
+
`);n.passed||(process.exitCode=1);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as P,G as H,g as x,j as I,q as K,s as N,y as B}from"./chunk-TGL3DR2K.js";import"./chunk-FQSWQLRW.js";import{b as F}from"./chunk-OWT55N6J.js";import"./chunk-RHBDQGD4.js";import"./chunk-RZZDQWC2.js";import"./chunk-M63QOANE.js";import"./chunk-L4PFFRDE.js";import"./chunk-T5XF2R74.js";import"./chunk-K73VV7KA.js";import"./chunk-5TBO732O.js";import{useId as Y,useLayoutEffect as Z,useRef as w,useState as C}from"react";var V={"chat.confirmation.heading":"Review these changes","chat.confirmation.apply":"Apply these changes","chat.confirmation.schedule":"Schedule these changes","chat.confirmation.applyCount":"{count, plural, =0 {Apply these changes} one {Apply # change} other {Apply # changes}}","chat.confirmation.scheduleCount":"{count, plural, =0 {Schedule these changes} one {Schedule # change} other {Schedule # changes}}","chat.confirmation.unavailable":"This plan can't be confirmed in this app. Ask the site administrator to update it.","chat.confirmation.expired":"This confirmation has expired. Ask for the plan again to review it.","chat.confirmation.used":"This confirmation was already used. Check the plan's status below before doing anything else.","chat.confirmation.changed":"This plan changed. Review it again before you confirm.","chat.confirmation.mismatch":"This confirmation belongs to a different plan. Open the current plan and review it.","chat.confirmation.irreversible":"This change cannot be undone.","chat.confirmation.before":"Before","chat.confirmation.after":"After","chat.confirmation.refresh":"Refresh","chat.confirmation.verifications":"{count, plural, one {# verification is needed} other {# verifications are needed}}.","chat.confirmation.expires":"Valid until {time}","chat.confirmation.showAll":"Show all {count} items"},z={"chat.confirmation.heading":"\u8BF7\u6838\u5BF9\u4EE5\u4E0B\u4FEE\u6539","chat.confirmation.apply":"\u5E94\u7528\u8FD9\u4E9B\u4FEE\u6539","chat.confirmation.schedule":"\u5B89\u6392\u6267\u884C\u8FD9\u4E9B\u4FEE\u6539","chat.confirmation.applyCount":"{count, plural, =0 {\u5E94\u7528\u8FD9\u4E9B\u4FEE\u6539} other {\u5E94\u7528 # \u9879\u4FEE\u6539}}","chat.confirmation.scheduleCount":"{count, plural, =0 {\u5B89\u6392\u6267\u884C\u8FD9\u4E9B\u4FEE\u6539} other {\u5B89\u6392\u6267\u884C # \u9879\u4FEE\u6539}}","chat.confirmation.unavailable":"\u6B64\u5E94\u7528\u65E0\u6CD5\u786E\u8BA4\u8FD9\u4E2A\u8BA1\u5212\u3002\u8BF7\u8054\u7CFB\u7F51\u7AD9\u7BA1\u7406\u5458\u66F4\u65B0\u5E94\u7528\u3002","chat.confirmation.expired":"\u6B64\u786E\u8BA4\u5DF2\u8FC7\u671F\u3002\u8BF7\u91CD\u65B0\u83B7\u53D6\u8BA1\u5212\u540E\u518D\u6838\u5BF9\u3002","chat.confirmation.used":"\u6B64\u786E\u8BA4\u5DF2\u7ECF\u4F7F\u7528\u8FC7\u3002\u8BF7\u5148\u68C0\u67E5\u4E0B\u65B9\u7684\u8BA1\u5212\u72B6\u6001\uFF0C\u518D\u8FDB\u884C\u5176\u4ED6\u64CD\u4F5C\u3002","chat.confirmation.changed":"\u8BA1\u5212\u5DF2\u6709\u53D8\u5316\u3002\u8BF7\u91CD\u65B0\u6838\u5BF9\u540E\u518D\u786E\u8BA4\u3002","chat.confirmation.mismatch":"\u6B64\u786E\u8BA4\u5C5E\u4E8E\u53E6\u4E00\u4E2A\u8BA1\u5212\u3002\u8BF7\u6253\u5F00\u5F53\u524D\u8BA1\u5212\u5E76\u91CD\u65B0\u6838\u5BF9\u3002","chat.confirmation.irreversible":"\u6B64\u4FEE\u6539\u65E0\u6CD5\u64A4\u9500\u3002","chat.confirmation.before":"\u4FEE\u6539\u524D","chat.confirmation.after":"\u4FEE\u6539\u540E","chat.confirmation.refresh":"\u5237\u65B0","chat.confirmation.verifications":"\u9700\u8981\u5B8C\u6210 {count} \u6B21\u9A8C\u8BC1\u3002","chat.confirmation.expires":"\u6709\u6548\u671F\u81F3 {time}","chat.confirmation.showAll":"\u663E\u793A\u5168\u90E8 {count} \u9879"};import{Fragment as r,jsx as n,jsxs as o}from"react/jsx-runtime";K(V,z);var v=10,j={expired:"chat.confirmation.expired",used:"chat.confirmation.used",stale:"chat.confirmation.changed",mismatch:"chat.confirmation.mismatch"};function nn({record:e,planId:l,entry:m,onConfirm:D,refusal:s,override:d,replaced:A}){let{format:i,primitives:O,locale:R,client:S}=B(),p=H(()=>Promise.all([S.refresh(),S.readPlan()])),U=O.button,a=Y(),[k,_]=C(!1),T=w(null),u=e?.token,h=x()?.owner(),[g,q]=C({token:u,owner:h}),[$,E]=C(!1);(g.token!==u||g.owner!==h)&&(q({token:u,owner:h}),E(g.owner===h));let f=x(),b=w(void 0),L=w(l);L.current=l,Z(()=>{let t=b.current;!t||t.element.isConnected||!f||(b.current=void 0,I(f,T.current,{owner:t.key,stillCurrent:()=>f.owner()===t.key&&L.current===t.planId,removed:t.element}))});let G=n("h3",{id:`${a}-heading`,ref:T,tabIndex:-1,children:i("chat.confirmation.heading")}),M=(t,y)=>o("section",{"data-confirmation":"","aria-labelledby":`${a}-heading`,"aria-describedby":y,onFocus:X=>{b.current={element:X.target,planId:l,key:f?.owner()??""}},children:[G,t]}),J=t=>n("p",{role:"status",children:t});if(!e)return M(o(r,{children:[n("p",{children:i("chat.confirmation.unavailable")}),J($?i("chat.confirmation.changed"):null)]}));let Q=k||e.items.length<=v?e.items:e.items.slice(0,v),c=A||$&&!s?"chat.confirmation.changed":s?j[s]??"chat.problem.refused":void 0,W=!c&&m?.reasonKey==="chat.confirmation.expired";return M(o(r,{children:[n("p",{id:`${a}-summary`,children:e.heading}),n("ol",{id:`${a}-items`,children:Q.map((t,y)=>o("li",{children:[n("p",{children:t.label}),o("dl",{children:[t.before!==void 0?o(r,{children:[n("dt",{children:i("chat.confirmation.before")}),n("dd",{children:t.before})]}):null,t.after!==void 0?o(r,{children:[n("dt",{children:i("chat.confirmation.after")}),n("dd",{children:t.after})]}):null]}),t.note?n("p",{children:t.note}):null]},y))}),e.items.length>v?n("button",{type:"button","aria-expanded":k,"aria-controls":`${a}-items`,onClick:()=>_(t=>!t),children:i("chat.confirmation.showAll",{count:e.items.length})}):null,n("p",{id:`${a}-dates`,children:e.schedule?`${e.schedule.startText} \u2013 ${e.schedule.endText}`:""}),e.irreversible?n("p",{children:n("strong",{children:i("chat.confirmation.irreversible")})}):null,n("p",{children:e.undo}),e.verificationCount>0?n("p",{children:i("chat.confirmation.verifications",{count:e.verificationCount})}):null,n("p",{children:n("time",{"data-expires":"",dateTime:e.expiresAt,children:i("chat.confirmation.expires",{time:new Date(e.expiresAt).toLocaleString(F(R??"en",N(R).catalogue==="zh"))})})}),m?n(P,{action:m,label:e.actionLabel,onPress:()=>{E(!1),D()}}):null,n("p",{role:"status",children:c&&s&&!A&&d?o(r,{children:[d.text,d.action]}):c?o(r,{children:[i(c),c!=="chat.confirmation.expired"&&c!=="chat.problem.refused"?n(U,{onPress:p.press,"aria-busy":p.busy||void 0,"aria-disabled":p.busy||void 0,children:i("chat.confirmation.refresh")}):null]}):W?n("span",{className:"wp-sr",children:i("chat.confirmation.expired")}):null})]}),`${a}-summary ${a}-dates`)}export{nn as default};
|
|
@@ -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 _chunkUYR3UEIWcjs = require('./chunk-UYR3UEIW.cjs');require('./chunk-FBADWFRR.cjs');var _chunkQS3MKZOYcjs = require('./chunk-QS3MKZOY.cjs');require('./chunk-M3UENQ6L.cjs');require('./chunk-4BWV3SEL.cjs');require('./chunk-GT6PI4CT.cjs');require('./chunk-3KV7TDDR.cjs');require('./chunk-Q7BULGQG.cjs');require('./chunk-XSHOLIC7.cjs');require('./chunk-II26UWZM.cjs');var _react = require('react');var V={"chat.confirmation.heading":"Review these changes","chat.confirmation.apply":"Apply these changes","chat.confirmation.schedule":"Schedule these changes","chat.confirmation.applyCount":"{count, plural, =0 {Apply these changes} one {Apply # change} other {Apply # changes}}","chat.confirmation.scheduleCount":"{count, plural, =0 {Schedule these changes} one {Schedule # change} other {Schedule # changes}}","chat.confirmation.unavailable":"This plan can't be confirmed in this app. Ask the site administrator to update it.","chat.confirmation.expired":"This confirmation has expired. Ask for the plan again to review it.","chat.confirmation.used":"This confirmation was already used. Check the plan's status below before doing anything else.","chat.confirmation.changed":"This plan changed. Review it again before you confirm.","chat.confirmation.mismatch":"This confirmation belongs to a different plan. Open the current plan and review it.","chat.confirmation.irreversible":"This change cannot be undone.","chat.confirmation.before":"Before","chat.confirmation.after":"After","chat.confirmation.refresh":"Refresh","chat.confirmation.verifications":"{count, plural, one {# verification is needed} other {# verifications are needed}}.","chat.confirmation.expires":"Valid until {time}","chat.confirmation.showAll":"Show all {count} items"},z={"chat.confirmation.heading":"\u8BF7\u6838\u5BF9\u4EE5\u4E0B\u4FEE\u6539","chat.confirmation.apply":"\u5E94\u7528\u8FD9\u4E9B\u4FEE\u6539","chat.confirmation.schedule":"\u5B89\u6392\u6267\u884C\u8FD9\u4E9B\u4FEE\u6539","chat.confirmation.applyCount":"{count, plural, =0 {\u5E94\u7528\u8FD9\u4E9B\u4FEE\u6539} other {\u5E94\u7528 # \u9879\u4FEE\u6539}}","chat.confirmation.scheduleCount":"{count, plural, =0 {\u5B89\u6392\u6267\u884C\u8FD9\u4E9B\u4FEE\u6539} other {\u5B89\u6392\u6267\u884C # \u9879\u4FEE\u6539}}","chat.confirmation.unavailable":"\u6B64\u5E94\u7528\u65E0\u6CD5\u786E\u8BA4\u8FD9\u4E2A\u8BA1\u5212\u3002\u8BF7\u8054\u7CFB\u7F51\u7AD9\u7BA1\u7406\u5458\u66F4\u65B0\u5E94\u7528\u3002","chat.confirmation.expired":"\u6B64\u786E\u8BA4\u5DF2\u8FC7\u671F\u3002\u8BF7\u91CD\u65B0\u83B7\u53D6\u8BA1\u5212\u540E\u518D\u6838\u5BF9\u3002","chat.confirmation.used":"\u6B64\u786E\u8BA4\u5DF2\u7ECF\u4F7F\u7528\u8FC7\u3002\u8BF7\u5148\u68C0\u67E5\u4E0B\u65B9\u7684\u8BA1\u5212\u72B6\u6001\uFF0C\u518D\u8FDB\u884C\u5176\u4ED6\u64CD\u4F5C\u3002","chat.confirmation.changed":"\u8BA1\u5212\u5DF2\u6709\u53D8\u5316\u3002\u8BF7\u91CD\u65B0\u6838\u5BF9\u540E\u518D\u786E\u8BA4\u3002","chat.confirmation.mismatch":"\u6B64\u786E\u8BA4\u5C5E\u4E8E\u53E6\u4E00\u4E2A\u8BA1\u5212\u3002\u8BF7\u6253\u5F00\u5F53\u524D\u8BA1\u5212\u5E76\u91CD\u65B0\u6838\u5BF9\u3002","chat.confirmation.irreversible":"\u6B64\u4FEE\u6539\u65E0\u6CD5\u64A4\u9500\u3002","chat.confirmation.before":"\u4FEE\u6539\u524D","chat.confirmation.after":"\u4FEE\u6539\u540E","chat.confirmation.refresh":"\u5237\u65B0","chat.confirmation.verifications":"\u9700\u8981\u5B8C\u6210 {count} \u6B21\u9A8C\u8BC1\u3002","chat.confirmation.expires":"\u6709\u6548\u671F\u81F3 {time}","chat.confirmation.showAll":"\u663E\u793A\u5168\u90E8 {count} \u9879"};var _jsxruntime = require('react/jsx-runtime');_chunkUYR3UEIWcjs.q.call(void 0, V,z);var v=10,j={expired:"chat.confirmation.expired",used:"chat.confirmation.used",stale:"chat.confirmation.changed",mismatch:"chat.confirmation.mismatch"};function nn({record:e,planId:l,entry:m,onConfirm:D,refusal:s,override:d,replaced:A}){let{format:i,primitives:O,locale:R,client:S}=_chunkUYR3UEIWcjs.y.call(void 0, ),p=_chunkUYR3UEIWcjs.G.call(void 0, ()=>Promise.all([S.refresh(),S.readPlan()])),U=O.button,a=_react.useId.call(void 0, ),[k,_]=_react.useState.call(void 0, !1),T=_react.useRef.call(void 0, null),u=_optionalChain([e, 'optionalAccess', _2 => _2.token]),h=_optionalChain([_chunkUYR3UEIWcjs.g.call(void 0, ), 'optionalAccess', _3 => _3.owner, 'call', _4 => _4()]),[g,q]=_react.useState.call(void 0, {token:u,owner:h}),[$,E]=_react.useState.call(void 0, !1);(g.token!==u||g.owner!==h)&&(q({token:u,owner:h}),E(g.owner===h));let f=_chunkUYR3UEIWcjs.g.call(void 0, ),b=_react.useRef.call(void 0, void 0),L=_react.useRef.call(void 0, l);L.current=l,_react.useLayoutEffect.call(void 0, ()=>{let t=b.current;!t||t.element.isConnected||!f||(b.current=void 0,_chunkUYR3UEIWcjs.j.call(void 0, f,T.current,{owner:t.key,stillCurrent:()=>f.owner()===t.key&&L.current===t.planId,removed:t.element}))});let G=_jsxruntime.jsx.call(void 0, "h3",{id:`${a}-heading`,ref:T,tabIndex:-1,children:i("chat.confirmation.heading")}),M=(t,y)=>_jsxruntime.jsxs.call(void 0, "section",{"data-confirmation":"","aria-labelledby":`${a}-heading`,"aria-describedby":y,onFocus:X=>{b.current={element:X.target,planId:l,key:_nullishCoalesce(_optionalChain([f, 'optionalAccess', _5 => _5.owner, 'call', _6 => _6()]), () => (""))}},children:[G,t]}),J=t=>_jsxruntime.jsx.call(void 0, "p",{role:"status",children:t});if(!e)return M(_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "p",{children:i("chat.confirmation.unavailable")}),J($?i("chat.confirmation.changed"):null)]}));let Q=k||e.items.length<=v?e.items:e.items.slice(0,v),c=A||$&&!s?"chat.confirmation.changed":s?_nullishCoalesce(j[s], () => ("chat.problem.refused")):void 0,W=!c&&_optionalChain([m, 'optionalAccess', _7 => _7.reasonKey])==="chat.confirmation.expired";return M(_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "p",{id:`${a}-summary`,children:e.heading}),_jsxruntime.jsx.call(void 0, "ol",{id:`${a}-items`,children:Q.map((t,y)=>_jsxruntime.jsxs.call(void 0, "li",{children:[_jsxruntime.jsx.call(void 0, "p",{children:t.label}),_jsxruntime.jsxs.call(void 0, "dl",{children:[t.before!==void 0?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "dt",{children:i("chat.confirmation.before")}),_jsxruntime.jsx.call(void 0, "dd",{children:t.before})]}):null,t.after!==void 0?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "dt",{children:i("chat.confirmation.after")}),_jsxruntime.jsx.call(void 0, "dd",{children:t.after})]}):null]}),t.note?_jsxruntime.jsx.call(void 0, "p",{children:t.note}):null]},y))}),e.items.length>v?_jsxruntime.jsx.call(void 0, "button",{type:"button","aria-expanded":k,"aria-controls":`${a}-items`,onClick:()=>_(t=>!t),children:i("chat.confirmation.showAll",{count:e.items.length})}):null,_jsxruntime.jsx.call(void 0, "p",{id:`${a}-dates`,children:e.schedule?`${e.schedule.startText} \u2013 ${e.schedule.endText}`:""}),e.irreversible?_jsxruntime.jsx.call(void 0, "p",{children:_jsxruntime.jsx.call(void 0, "strong",{children:i("chat.confirmation.irreversible")})}):null,_jsxruntime.jsx.call(void 0, "p",{children:e.undo}),e.verificationCount>0?_jsxruntime.jsx.call(void 0, "p",{children:i("chat.confirmation.verifications",{count:e.verificationCount})}):null,_jsxruntime.jsx.call(void 0, "p",{children:_jsxruntime.jsx.call(void 0, "time",{"data-expires":"",dateTime:e.expiresAt,children:i("chat.confirmation.expires",{time:new Date(e.expiresAt).toLocaleString(_chunkQS3MKZOYcjs.b.call(void 0, _nullishCoalesce(R, () => ("en")),_chunkUYR3UEIWcjs.s.call(void 0, R).catalogue==="zh"))})})}),m?_jsxruntime.jsx.call(void 0, _chunkUYR3UEIWcjs.F,{action:m,label:e.actionLabel,onPress:()=>{E(!1),D()}}):null,_jsxruntime.jsx.call(void 0, "p",{role:"status",children:c&&s&&!A&&d?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[d.text,d.action]}):c?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[i(c),c!=="chat.confirmation.expired"&&c!=="chat.problem.refused"?_jsxruntime.jsx.call(void 0, U,{onPress:p.press,"aria-busy":p.busy||void 0,"aria-disabled":p.busy||void 0,children:i("chat.confirmation.refresh")}):null]}):W?_jsxruntime.jsx.call(void 0, "span",{className:"wp-sr",children:i("chat.confirmation.expired")}):null})]}),`${a}-summary ${a}-dates`)}exports.default = nn;
|
|
@@ -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 _chunkQ7BULGQGcjs = require('./chunk-Q7BULGQG.cjs');require('./chunk-II26UWZM.cjs');async function j(o){let u=[],w=[],h=(await o("/__conformance/session",{method:"POST"})).body,d={"Content-Type":"application/json",Cookie:`waypoint=${h.session}`,"X-CSRF-Token":h.csrf},t=(e,s)=>o(e,{method:"POST",headers:d,body:JSON.stringify({protocol:"1.1",...s})}),l=e=>o(`/conversations/${encodeURIComponent(e)}`,{headers:d}),y=async(e,s)=>{w.push(e);try{await s()||u.push(e)}catch (e2){u.push(e)}},b={key:"form-fixture-a",resource:"items",label:"Item",route:"/items/new",state:"pending"},v={mode:"form-fill",title:"Form fixture",subject:b,clientCreationId:"form-create-a"},a;try{a=(await t("/conversations",v)).body}catch (e3){return{passed:!1,failures:["form create"],scenarios:["form create"]}}await y("form creation replay",async()=>(await t("/conversations",v)).body.id===a.id),await y("form mode survives refetch",async()=>{let e=(await l(a.id)).body;return e.mode==="form-fill"&&_optionalChain([e, 'access', _2 => _2.subject, 'optionalAccess', _3 => _3.key])===b.key}),await y("form subject filtering",async()=>{await t("/conversations",{...v,subject:{...b,key:"form-fixture-b"},clientCreationId:"form-create-b"});let e=await o(`/conversations?subject=${b.key}`,{headers:d}),s=e.body;return e.status===200&&s.some(n=>n.id===a.id)&&s.every(n=>_optionalChain([n, 'access', _4 => _4.subject, 'optionalAccess', _5 => _5.key])===b.key)});let g={kind:"form-fill",clientReplyId:"form-fill-a",request:{requestId:"form-request-a",text:"Draft",references:["https://example.test/reference"],attachments:["private-image"],fields:[{name:"title",label:"Title",tier:"low",value:""}]}},I=async e=>{let s=await t(`/conversations/${e}/replies`,g),n=await t(`/conversations/${e}/replies`,g),c=(await l(e)).body.messages.flatMap(i=>i.blocks).filter(i=>i.type==="form.fill"),p=c[0];return s.status===200&&s.body.id===n.body.id&&c.length===1&&_optionalChain([p, 'optionalAccess', _6 => _6.body, 'access', _7 => _7.requestId])===g.request.requestId&&Object.keys(p.body.values).join()==="title"&&["valid","invalid"].includes(p.body.values.title.validation.status)&&Array.isArray(p.body.values.title.validation.messages)};return await y("form values and validation replay",()=>I(a.id)),await y("form rejects non-low input",async()=>(await t(`/conversations/${a.id}/replies`,{...g,clientReplyId:"forbidden",request:{...g.request,fields:[{name:"secret",tier:"sensitive",label:"Secret",value:""}]}})).status>=400),await y("form child inherits mode and values",async()=>{let e=(await t("/conversations",{...v,clientCreationId:"form-child-a",parentConversationId:a.id,field:"title"})).body;return e.parentConversationId===a.id&&e.mode==="form-fill"&&_optionalChain([e, 'access', _8 => _8.subject, 'optionalAccess', _9 => _9.key])===b.key&&await I(e.id)}),await y("form rejects wrong-subject child",async()=>(await t("/conversations",{...v,clientCreationId:"form-child-wrong",parentConversationId:a.id,field:"title",subject:{...b,key:"another"}})).status>=400),await y("form refuses general replies",async()=>{let e=await t("/conversations",{title:"Ordinary fixture"});if(e.status<200||e.status>=300)return!1;let s={kind:"message",clientReplyId:"general-reply",clientMessageId:"general-message",content:"An ordinary message"},n=await t(`/conversations/${e.body.id}/messages`,s),r=await t(`/conversations/${a.id}/messages`,{...s,clientReplyId:"form-general-reply",clientMessageId:"form-general-message"});return n.status>=200&&n.status<300&&r.status>=400&&_optionalChain([r, 'access', _10 => _10.body, 'optionalAccess', _11 => _11.code])==="refused"}),{passed:u.length===0,failures:u,scenarios:w}}async function O(o){let u=[],w=[],h=(await o("/__conformance/session",{method:"POST"})).body,d={"Content-Type":"application/json",Cookie:`waypoint=${h.session}`,"X-CSRF-Token":h.csrf},t=(l,y)=>o(l,{method:"POST",headers:d,body:JSON.stringify({protocol:"1.0",...y})});for(let l of["run","refuse"]){w.push(`plan ${l}`);try{await t("/__conformance/script",{planScenario:l});let v=`/conversations/${(await t("/conversations",{title:"Plan"})).body.id}/replies`,a=async i=>(await o(`/plans/${i}`,{headers:d})).body,g=await a("plan-a");if(g.plan.kind!=="immediate"||g.plan.stage!=="draft")throw new Error("Missing draft");let I=await o("/items/a",{headers:d});await t(v,{kind:"plan.values",clientReplyId:"values-a",planId:"plan-a",steps:[{stepId:"step-a",...I.body}]});let e=await a("plan-a"),s=e.plan;if(s.stage!=="final"||!s.digest)throw new Error("Missing final");let n=_optionalChain([e, 'access', _12 => _12.confirmation, 'optionalAccess', _13 => _13.token]);if(!n)throw new Error("Missing confirmation record");let r=(i,m)=>t(v,{kind:"confirm",clientReplyId:i,planId:"plan-a",digest:s.digest,...m});for(let[i,m]of[["no-token",{}],["wrong-token",{confirmationToken:`${n}x`}]])if((await r(i,m)).status!==409)throw new Error("Confirmation without its token accepted");if((await r("confirm-a",{confirmationToken:n})).status!==200)throw new Error("Confirmation refused");if((await r("confirm-b",{confirmationToken:n})).status!==409)throw new Error("Confirmation token used twice");let c=_chunkQ7BULGQGcjs.j.call(void 0, {read:a,heartbeat:async i=>{await t(`/plans/${i}/heartbeat`,{})},request:async(i,m)=>{if((await o(i.path,{method:i.method,headers:{...d,...m.headers},body:i.body})).status>=400)throw new Error("Step refused")}});await c.run("plan-a",s.digest);let p=await a("plan-a");if(l==="run"&&p.state!=="completed")throw new Error("Not completed");if(l==="refuse"&&(p.state==="undoing"||p.undoPlanId!==void 0))throw new Error("Undo requested automatically");if(l==="run"){await t("/plans/plan-a/stop",{}),await c.run("undo-a",(await a("undo-a")).plan.digest);let i=await o("/items/a",{headers:d});if(JSON.stringify(i.body).includes("After"))throw new Error("Not restored")}c.dispose()}catch (e4){u.push(`plan ${l}`)}}return{passed:u.length===0,failures:u,scenarios:w}}var _={kind:"action",clientReplyId:"card-answer-a",blockId:"card-answer-choice",actionId:"accept"};function T(o){return o===void 0?!0:typeof o!="object"||o===null||Array.isArray(o)?!1:Object.entries(_).every(([u,w])=>o[u]===w)}async function U(o){let u=[],w=[],R=await o.request("/__conformance/session",{method:"POST"});if(R.status!==200)return{passed:!1,failures:["test session unavailable"],scenarios:[]};let h=R.body,d={"Content-Type":"application/json",Cookie:`waypoint=${h.session}`,"X-CSRF-Token":h.csrf},t=(e,s)=>o.request(e,{method:"POST",headers:d,body:JSON.stringify({protocol:"1.0",...s})}),l=async(e,s)=>{w.push(e);try{await s()||u.push(e)}catch (e5){u.push(e)}};await l("negotiation",async()=>{let e=await t("/negotiate",{supported:_chunkQ7BULGQGcjs.a});return e.status===200&&_chunkQ7BULGQGcjs.a.some(s=>s===e.body.protocol)&&Array.isArray(e.body.capabilities)});let b=(await t("/negotiate",{supported:_chunkQ7BULGQGcjs.a})).body;if(b.protocol==="1.1"&&_optionalChain([b, 'access', _14 => _14.capabilities, 'optionalAccess', _15 => _15.includes, 'call', _16 => _16("form-fill")])){let e=await j(o.request);u.push(...e.failures),w.push(...e.scenarios)}let a=(await t("/conversations",{title:"Fixture"})).body.id;await l("optimistic replay",async()=>{let e={clientMessageId:"replay-a",content:"Request"},s=await t(`/conversations/${a}/messages`,e),n=await t(`/conversations/${a}/messages`,e);return s.body.id===n.body.id}),await l("closed failures",async()=>{for(let e of["in-doubt","replaced","retryable","refused","closed","full","declined","unavailable"]){await t("/__conformance/script",{turns:[{problem:{id:"failure-a",code:e}}]});let s=await t(`/conversations/${a}/messages`,{clientMessageId:`failure-${e}`,content:"Request"});if(s.status<400||s.body.code!==e)return!1}return!0}),await l("blocks and fallback",async()=>{let e=["markdown","card","details","list","table","form","choice","buttons","diff","plan","route-link","notice","example/future"],s=e.map(c=>({type:c,id:c,fallback:"Readable",body:F(c)}));await t("/__conformance/script",{turns:[{blocks:s}]}),await t(`/conversations/${a}/messages`,{clientMessageId:"blocks-a",content:"Request"});let r=(await o.request(`/conversations/${a}`,{headers:d})).body;return e.every(c=>r.messages.some(p=>p.blocks.some(i=>i.type===c&&i.fallback==="Readable")))}),await l("drop then refetch",async()=>(await t("/__conformance/script",{turns:[{content:"Authoritative after drop"}]}),await t(`/conversations/${a}/messages`,{clientMessageId:"drop-a",content:"Request"}),await o.request(`/conversations/${a}/stream`,{headers:d}),(await o.request(`/conversations/${a}`,{headers:d})).body.messages.some(s=>s.content==="Authoritative after drop"))),await l("one answer per card",async()=>{await t("/__conformance/script",{turns:[{blocks:[{type:"card",id:"card-answer",fallback:"Answer",body:{title:"Question",blocks:[{type:"buttons",id:"card-answer-choice",fallback:"Answer",body:{actions:[{id:"accept",label:"Accept"},{id:"decline",label:"Decline"}]}}]}}]}]}),await t(`/conversations/${a}/messages`,{clientMessageId:"card-answer",content:"Request"});let e=(f,P)=>t(`/conversations/${a}/replies`,{kind:"action",clientReplyId:f,blockId:"card-answer-choice",actionId:P}),s=f=>f.status===409&&f.body.code==="refused",n=await e("card-answer-a","accept"),r=await e("card-answer-a","accept"),c=await e("card-answer-a","decline"),p=await e("card-answer-b","decline"),m=(await o.request(`/conversations/${a}`,{headers:d})).body.messages.flatMap(f=>f.blocks).find(f=>f.id==="card-answer");return n.status>=200&&n.status<300&&r.status===n.status&&JSON.stringify(r.body)===JSON.stringify(n.body)&&(s(c)||c.status===422)&&s(p)&&_optionalChain([m, 'optionalAccess', _17 => _17.answered])===!0&&T(m.answer)}),await l("agreement binding",async()=>{let e=await t("/negotiate",{supported:_chunkQ7BULGQGcjs.a,offer:{capabilities:["plans"]}}),s=e.body;if(e.status===200&&s.agreementId===void 0)return!0;if(e.status!==200||typeof s.agreementId!="string")return!1;let n={...d,"Waypoint-Agreement":"conformance-unknown"},r=await o.request(`/conversations/${a}`,{headers:n}),c=await o.request(`/conversations/${a}/messages`,{method:"POST",headers:n,body:JSON.stringify({protocol:"1.0",clientMessageId:"binding-a",content:"Request"})}),p=await o.request(`/conversations/${a}`,{headers:d}),i=await o.request(`/conversations/${a}`,{headers:{...d,"Waypoint-Agreement":s.agreementId}});return r.status===409&&r.body.code==="agreement-expired"&&c.status===409&&c.body.code==="agreement-expired"&&!p.body.messages.some(m=>m.clientMessageId==="binding-a")&&i.status===200}),await l("agreement keeps its answer",async()=>{let e=await t("/negotiate",{supported:["1.0"],offer:{capabilities:["plans"]}}),s=await t("/negotiate",{supported:_chunkQ7BULGQGcjs.a,offer:{capabilities:["plans"]}}),n=e.body,r=s.body;if(!n.agreementId||!r.agreementId||n.protocol===r.protocol)return!0;let c=await o.request(`/conversations/${a}`,{headers:{...d,"Waypoint-Agreement":n.agreementId}});return c.status===200&&c.body.protocol===n.protocol});let g=await t("/negotiate",{supported:_chunkQ7BULGQGcjs.a,offer:{capabilities:["reply-stop"]}});_optionalChain([g, 'access', _18 => _18.body, 'access', _19 => _19.capabilities, 'optionalAccess', _20 => _20.includes, 'call', _21 => _21("reply-stop")])&&await l("reply stop",async()=>{await t("/__conformance/script",{turns:[{chunks:["Partial answer"],interval:0,ending:"held"}]}),await t(`/conversations/${a}/messages`,{clientMessageId:"stop-a",content:"Request"});let e=C=>C?{...d,"Waypoint-Agreement":C}:d,s=g.body.agreementId,n=async(C=s)=>(await o.request(`/conversations/${a}`,{headers:e(C)})).body.messages.at(-1),r=await n();for(let C=0;_optionalChain([r, 'optionalAccess', _22 => _22.content])!=="Partial answer"&&C<100;C++)r=await n();if(!s||_optionalChain([r, 'optionalAccess', _23 => _23.role])!=="assistant"||r.status!=="writing")return!1;let c=_nullishCoalesce(r.versionIndex, () => (1)),p=await t(`/conversations/${a}/replies`,{kind:"stop",clientReplyId:"stop-a-other-version",messageId:r.id,versionIndex:c+1}),i=await n(),m={kind:"stop",clientReplyId:"stop-a-reply",messageId:r.id,versionIndex:c},f=await t(`/conversations/${a}/replies`,m),P=await t(`/conversations/${a}/replies`,m),x=await t(`/conversations/${a}/replies`,{kind:"stop",clientReplyId:"stop-a-reply-2",messageId:r.id}),$=await n(),A=(await t("/negotiate",{supported:_chunkQ7BULGQGcjs.a,offer:{capabilities:["plans"]}})).body.agreementId,q=A?await n(A):void 0;return p.status<500&&_optionalChain([i, 'optionalAccess', _24 => _24.status])==="writing"&&(!q||q.status==="failed"&&q.content==="Partial answer")&&f.status>=200&&f.status<300&&P.status===f.status&&JSON.stringify(P.body)===JSON.stringify(f.body)&&x.status>=200&&x.status<300&&_optionalChain([$, 'optionalAccess', _25 => _25.id])===r.id&&$.status==="stopped"&&$.content==="Partial answer"});let I=await O(o.request);return u.push(...I.failures),w.push(...I.scenarios),{passed:u.length===0,failures:u,scenarios:w}}function F(o){return_nullishCoalesce({markdown:{text:"Readable"},card:{title:"Card",blocks:[]},details:{summary:"Details",blocks:[]},list:{items:[]},table:{columns:[],rows:[]},form:{fields:[]},choice:{mode:"single",options:[]},buttons:{actions:[]},diff:{before:"Before",after:"After"},plan:{planId:"plan-a"},"route-link":{label:"View",route:"/items/a"},notice:{text:"Ready"}}[o], () => ({}))}exports.runConformance = U; exports.runFormFillConformance = j; exports.runPlanConformance = O;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { H as HttpRequest, C as ConformanceResult, a as ConformanceConfig } from './index-B5idIFTx.cjs';
|
|
2
|
+
import './generated-C9tbjwK0.cjs';
|
|
3
|
+
|
|
4
|
+
declare function runFormFillConformance(request: HttpRequest): Promise<ConformanceResult>;
|
|
5
|
+
|
|
6
|
+
declare function runPlanConformance(request: HttpRequest): Promise<ConformanceResult>;
|
|
7
|
+
|
|
8
|
+
declare function runConformance(config: ConformanceConfig): Promise<ConformanceResult>;
|
|
9
|
+
|
|
10
|
+
export { runConformance, runFormFillConformance, runPlanConformance };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { H as HttpRequest, C as ConformanceResult, a as ConformanceConfig } from './index-DPzoKXCK.js';
|
|
2
|
+
import './generated-C9tbjwK0.js';
|
|
3
|
+
|
|
4
|
+
declare function runFormFillConformance(request: HttpRequest): Promise<ConformanceResult>;
|
|
5
|
+
|
|
6
|
+
declare function runPlanConformance(request: HttpRequest): Promise<ConformanceResult>;
|
|
7
|
+
|
|
8
|
+
declare function runConformance(config: ConformanceConfig): Promise<ConformanceResult>;
|
|
9
|
+
|
|
10
|
+
export { runConformance, runFormFillConformance, runPlanConformance };
|