@lobu/runtime-server 24.9.0 → 24.11.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/dist/catalogs/automations.json +2 -2
- package/dist/catalogs/connectors.json +16 -4
- package/dist/catalogs/skills.json +1 -1
- package/dist/component.json +1 -1
- package/dist/connectors/linkedin-inbox-adapter.js +13 -3
- package/dist/connectors/postgres.ts +39 -24
- package/dist/connectors/whatsapp-web-adapter.js +54 -22
- package/dist/connectors/whatsapp-web-helpers.ts +48 -2
- package/dist/connectors/whatsapp_web.ts +23 -7
- package/dist/connectors/x-dm-adapter.js +17 -3
- package/dist/db/migrations/20261112210000_instance_identity.sql +18 -0
- package/dist/db/migrations/20261113170000_member_sql_rls.sql +254 -0
- package/dist/db/migrations/20261113180000_member_sql_rls_parallel_plans.sql +192 -0
- package/dist/db/migrations/20261113190000_member_sql_schema_usage.sql +24 -0
- package/dist/db/migrations/20261114120000_events_owner_only_visibility.sql +39 -0
- package/dist/dependencies.bun.lock +66 -64
- package/dist/embeddings-server.mjs +39 -6
- package/dist/guest.bundle.js +1 -1
- package/dist/owletto/dist/assets/_-BDMUN9XZ.js +2 -0
- package/dist/owletto/dist/assets/_-CF5X4ANe.js +3 -0
- package/dist/owletto/dist/assets/{_agentId-bna2tPsW.js → _agentId-CGScf8z_.js} +2 -2
- package/dist/owletto/dist/assets/_agentId-EQU2aUP0.js +2 -0
- package/dist/owletto/dist/assets/_automationId-PXZ33jsF.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-DcI29kGy.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-Cr2NDJWX.js +2 -0
- package/dist/owletto/dist/assets/{_conversationId-zcs-S3dY.js → _conversationId-CnmLYlVS.js} +2 -2
- package/dist/owletto/dist/assets/_eventId-w5sDz5oa.js +2 -0
- package/dist/owletto/dist/assets/_owner-CkOZR4n0.js +3 -0
- package/dist/owletto/dist/assets/_shape-C_FmSf9G.js +2 -0
- package/dist/owletto/dist/assets/_slug-COPpRXLt.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-BVdJiilV.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-mxxpqjtC.js +2 -0
- package/dist/owletto/dist/assets/accept-invitation-BKeIzZXE.js +2 -0
- package/dist/owletto/dist/assets/activity-route-location-sLvKaSCa.js +2 -0
- package/dist/owletto/dist/assets/activity-route-view-msesKUwn.js +2 -0
- package/dist/owletto/dist/assets/agent-connect-pages-DVq9nAR7.js +4 -0
- package/dist/owletto/dist/assets/{agent-editor-form-Bnc_q5WD.js → agent-editor-form-DVFyyMyd.js} +2 -2
- package/dist/owletto/dist/assets/{agent-loading-shells-xteN-pyK.js → agent-loading-shells-BLNHIy-r.js} +2 -2
- package/dist/owletto/dist/assets/agent-permissions-matrix-UBKRR5vs.js +2 -0
- package/dist/owletto/dist/assets/{agent-skill-context-r0O0BVOu.js → agent-skill-context-fqedKd0D.js} +2 -2
- package/dist/owletto/dist/assets/{agent-subpage-shell-C2KpYdu3.js → agent-subpage-shell-BUCoY2Nf.js} +2 -2
- package/dist/owletto/dist/assets/{agent-thread-Bv_chdPy.js → agent-thread-Cqf9ITrT.js} +3 -3
- package/dist/owletto/dist/assets/app-bridge-B-L0rGz9.js +121 -0
- package/dist/owletto/dist/assets/{app._appId-BUcNaSMS.js → app._appId-ByIypCL9.js} +2 -2
- package/dist/owletto/dist/assets/{assist-composer-B1LykXpD.js → assist-composer-kG_heHXo.js} +2 -2
- package/dist/owletto/dist/assets/automation-run-now-C5XTS00o.js +2 -0
- package/dist/owletto/dist/assets/{callback-kSLa4n5s.js → callback-Pz5uS-k7.js} +2 -2
- package/dist/owletto/dist/assets/{card-C01y1O-W.js → card-CAPpY9P5.js} +2 -2
- package/dist/owletto/dist/assets/{claim-Dnux9Lqf.js → claim-DgWWK0KI.js} +2 -2
- package/dist/owletto/dist/assets/{client-activity-scopes-BBIq16tG.js → client-activity-scopes-Aqdo6Pdr.js} +2 -2
- package/dist/owletto/dist/assets/{client-rows-DGh1O-Fu.js → client-rows-Dd5YV8vn.js} +2 -2
- package/dist/owletto/dist/assets/clients-Bf7ZgGro.js +2 -0
- package/dist/owletto/dist/assets/{code-editor-BdRMYojw.js → code-editor-z1Sy_hiX.js} +2 -2
- package/dist/owletto/dist/assets/connect-BFNp1y_s.js +2 -0
- package/dist/owletto/dist/assets/connect-menu-BWrAhMqO.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-CSPfwYIN.js +2 -0
- package/dist/owletto/dist/assets/{connected._clientId-BsDzltNz.js → connected._clientId-CuOeHafK.js} +2 -2
- package/dist/owletto/dist/assets/connection-CVeHmDLs.js +2 -0
- package/dist/owletto/dist/assets/{connection-feed-detail-CJju0qiw.js → connection-feed-detail-BYo7zdVD.js} +2 -2
- package/dist/owletto/dist/assets/connector-page-shell-an3SYLim.js +2 -0
- package/dist/owletto/dist/assets/{connector-provenance-B2C2cjBg.js → connector-provenance-mSZCOud-.js} +2 -2
- package/dist/owletto/dist/assets/connectors-DBEM9QQz.js +2 -0
- package/dist/owletto/dist/assets/consent-1ulwyJ3k.js +2 -0
- package/dist/owletto/dist/assets/{copy-button-BhXeXLIm.js → copy-button-Xhh7ZnjO.js} +2 -2
- package/dist/owletto/dist/assets/{core.esm-CJUp2aNZ.js → core.esm-Ctg_pXLe.js} +3 -3
- package/dist/owletto/dist/assets/create-CGuoqPh8.js +2 -0
- package/dist/owletto/dist/assets/create-Ccb5R-S4.js +2 -0
- package/dist/owletto/dist/assets/{create-DUlRsFNn.js → create-DmhbacIa.js} +2 -2
- package/dist/owletto/dist/assets/{create-automation-form-D141prEG.js → create-automation-form-CD6jSlWL.js} +3 -3
- package/dist/owletto/dist/assets/create._connectorKey-CZsAqj1p.js +2 -0
- package/dist/owletto/dist/assets/{custom-guardrail-edits-DuQ28xv3.js → custom-guardrail-edits-Ce_BwiwD.js} +2 -2
- package/dist/owletto/dist/assets/{definition-comparison-BUDNuAN_.js → definition-comparison-D_qP25jR.js} +2 -2
- package/dist/owletto/dist/assets/{detail-page-skeleton-BRHaq5Sj.js → detail-page-skeleton-CPAfZLG0.js} +2 -2
- package/dist/owletto/dist/assets/device-DDl5XKvt.js +2 -0
- package/dist/owletto/dist/assets/{device-pin-tombstone-BIM-ziCH.js → device-pin-tombstone-Dkj7hrBE.js} +2 -2
- package/dist/owletto/dist/assets/{device._deviceId-BnPqTgK1.js → device._deviceId-bNhTcops.js} +2 -2
- package/dist/owletto/dist/assets/{dynamic-schema-form-OkIZImgp.js → dynamic-schema-form-CRyUchXo.js} +2 -2
- package/dist/owletto/dist/assets/{entity-options-CpeX7iiX.js → entity-options-D4t-NAcg.js} +2 -2
- package/dist/owletto/dist/assets/entity-page-BOOL_vy3.js +2 -0
- package/dist/owletto/dist/assets/entity-pages-_nuesgnp.js +2 -0
- package/dist/owletto/dist/assets/entity-schema-graph-Cq96SJ3c.js +2 -0
- package/dist/owletto/dist/assets/{entity-type-page-MgZ7_0oh.js → entity-type-page-CkCSbkBx.js} +2 -2
- package/dist/owletto/dist/assets/event-detail-DUvlqn9b.js +2 -0
- package/dist/owletto/dist/assets/events-feed-DcKTkJVe.js +2 -0
- package/dist/owletto/dist/assets/{filter-editors-DDTwyYt0.js → filter-editors-DGVl9U4D.js} +3 -3
- package/dist/owletto/dist/assets/{full-page-spinner-DWo519BU.js → full-page-spinner-CtVlF8GQ.js} +2 -2
- package/dist/owletto/dist/assets/{index-BYcFrinP.js → index-BUlkNJzX.js} +2 -2
- package/dist/owletto/dist/assets/{index-Cd8jMsz8.js → index-BifR-LE9.js} +2 -2
- package/dist/owletto/dist/assets/{index-CdDNNAx2.js → index-BoqrvLHQ.js} +1427 -1427
- package/dist/owletto/dist/assets/index-CA9mW_ZM.js +2 -0
- package/dist/owletto/dist/assets/index-CH0GzG4i.js +2 -0
- package/dist/owletto/dist/assets/{index-DznAbTOF.js → index-CK5GDX4B.js} +2 -2
- package/dist/owletto/dist/assets/index-CtI5Eomq.js +2 -0
- package/dist/owletto/dist/assets/{index-BW7IFKXC.js → index-DbjbHlDe.js} +2 -2
- package/dist/owletto/dist/assets/index-DmtQ0bds.js +2 -0
- package/dist/owletto/dist/assets/index-Du_J8hnx.js +2 -0
- package/dist/owletto/dist/assets/{index-DmqnKGqW.js → index-DvuJ_S_o.js} +2 -2
- package/dist/owletto/dist/assets/index-Pae_f9LM.css +1 -0
- package/dist/owletto/dist/assets/{index-D1UCJQl1.js → index-XETZnN7L.js} +2 -2
- package/dist/owletto/dist/assets/{json-diff-C-WQqyIf.js → json-diff-OjtREegr.js} +2 -2
- package/dist/owletto/dist/assets/{list-skeleton-0B1bTrAK.js → list-skeleton-CH0qQBYk.js} +2 -2
- package/dist/owletto/dist/assets/login-DG0b9uSC.js +2 -0
- package/dist/owletto/dist/assets/{logout-D474YsYQ.js → logout-DfdgOLoM.js} +2 -2
- package/dist/owletto/dist/assets/{member-scope-gate-CH_0jHiM.js → member-scope-gate-Cxg2zGQT.js} +2 -2
- package/dist/owletto/dist/assets/memory-browse-page-qEDQ9Z18.js +74 -0
- package/dist/owletto/dist/assets/missing-view-xT0B-f5z.js +2 -0
- package/dist/owletto/dist/assets/{model-selector-XYmk7Iru.js → model-selector-D2OpDkwH.js} +2 -2
- package/dist/owletto/dist/assets/{needs-you-list-Bd4iiiqm.js → needs-you-list-3uMsWcDv.js} +2 -2
- package/dist/owletto/dist/assets/new-AdGV6a8R.js +2 -0
- package/dist/owletto/dist/assets/new-BdtIhBpo.js +2 -0
- package/dist/owletto/dist/assets/new-BjGwX6s6.js +2 -0
- package/dist/owletto/dist/assets/{new-CJ6TF3Vc.js → new-D-iMjV74.js} +2 -2
- package/dist/owletto/dist/assets/organization-qaIpEiQg.js +2 -0
- package/dist/owletto/dist/assets/peek-pane-content-CEsDVScl.js +2 -0
- package/dist/owletto/dist/assets/{pending-seed-D7-ld7as.js → pending-seed-BBACroge.js} +2 -2
- package/dist/owletto/dist/assets/{proposal-review-shell-BWRJidwb.js → proposal-review-shell-C8ZfIAYn.js} +2 -2
- package/dist/owletto/dist/assets/public-shell-ready-K2R8iXSI.js +2 -0
- package/dist/owletto/dist/assets/{record-session-ClKBr1_C.js → record-session-BrM9cdXu.js} +2 -2
- package/dist/owletto/dist/assets/{renderer-DZ0w2k2r.js → renderer-CTKNMcXP.js} +5 -5
- package/dist/owletto/dist/assets/reset-password-DKBEneyR.js +2 -0
- package/dist/owletto/dist/assets/{run-initiator-B8IRlRd-.js → run-initiator-BKSgI1o0.js} +2 -2
- package/dist/owletto/dist/assets/runs-k2NpbZm8.js +2 -0
- package/dist/owletto/dist/assets/runs-list-DUXRMkWN.js +2 -0
- package/dist/owletto/dist/assets/{schema-value-k19Ata7u.js → schema-value-wjqGxXhv.js} +3 -3
- package/dist/owletto/dist/assets/{scoped-feed-bar-L7h-Ca4u.js → scoped-feed-bar-DNFL0sYX.js} +2 -2
- package/dist/owletto/dist/assets/{settings-BZqntV3E.js → settings-V0m5Om5j.js} +2 -2
- package/dist/owletto/dist/assets/source-record-panels-BMut9YIA.js +2 -0
- package/dist/owletto/dist/assets/{status-variants-BR_iGWN5.js → status-variants-SzXYYedJ.js} +2 -2
- package/dist/owletto/dist/assets/subDays-9s9OEl5t.js +2 -0
- package/dist/owletto/dist/assets/{table-C3DMoL4K.js → table-ZuYMOjVR.js} +2 -2
- package/dist/owletto/dist/assets/use-automations-DfBtVzGa.js +2 -0
- package/dist/owletto/dist/assets/use-login-redirect-BDiS3eyl.js +2 -0
- package/dist/owletto/dist/assets/{use-mention-search-CtbixPEE.js → use-mention-search-khySpz_V.js} +2 -2
- package/dist/owletto/dist/assets/view-card-DiHWlypr.js +2 -0
- package/dist/owletto/dist/assets/view-param-filters-DGKxSr7r.js +2 -0
- package/dist/owletto/dist/assets/{views-access-required-CvIIxdS_.js → views-access-required-HA-PiOwA.js} +2 -2
- package/dist/owletto/dist/index.html +2 -2
- package/dist/server-main.bundle.mjs +3778 -2326
- package/npm-shrinkwrap.json +251 -234
- package/package.json +1 -1
- package/vendor/connector-sdk/dist/connector-types.d.ts +6 -0
- package/vendor/connector-sdk/dist/index.d.ts +1 -0
- package/vendor/connector-sdk/dist/index.js +1 -0
- package/vendor/connector-sdk/dist/ip-reachability.d.ts +1 -1
- package/vendor/connector-sdk/dist/ip-reachability.js +1 -1
- package/vendor/connector-sdk/dist/logger.d.ts +1 -1
- package/vendor/connector-sdk/dist/logger.js +1 -1
- package/vendor/connector-sdk/dist/reaction-client-types.d.ts +3 -1
- package/vendor/connector-sdk/dist/retry.d.ts +1 -1
- package/vendor/connector-sdk/dist/retry.js +1 -1
- package/vendor/connector-sdk/dist/source-withheld-error.d.ts +16 -0
- package/vendor/connector-sdk/dist/source-withheld-error.js +19 -0
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/classify-error.d.ts +1 -1
- package/vendor/core/dist/classify-error.js +2 -2
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +28 -3
- package/vendor/core/dist/contracts/tools/manage-automations.js +27 -8
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +8 -0
- package/vendor/core/dist/contracts/tools/manage-entity.js +11 -3
- package/vendor/core/dist/contracts/tools/save-memory.d.ts +11 -1
- package/vendor/core/dist/contracts/tools/save-memory.js +25 -3
- package/vendor/core/dist/contracts/tools/search-memory.js +1 -1
- package/vendor/core/dist/credentials.d.ts +12 -0
- package/vendor/core/dist/credentials.js +1 -0
- package/vendor/core/dist/errors.js +2 -2
- package/vendor/core/dist/worker/auth.d.ts +5 -0
- package/vendor/core/dist/worker/auth.js +15 -4
- package/vendor/core/package.json +1 -1
- package/vendor/postgres/cf/src/connection.js +7 -2
- package/vendor/postgres/cjs/src/connection.js +7 -2
- package/vendor/postgres/src/connection.js +7 -2
- package/vendor/views/dist/native.d.ts +33 -1
- package/vendor/views/dist/native.js +3 -0
- package/vendor/views/package.json +1 -1
- package/dist/owletto/dist/assets/_-B2C9B2RM.js +0 -2
- package/dist/owletto/dist/assets/_-CjyiGzwB.js +0 -3
- package/dist/owletto/dist/assets/_agentId-DKHXGvS2.js +0 -2
- package/dist/owletto/dist/assets/_automationId-CowRFD4E.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey._connectionId-dE6im18z.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey.index-DqwSv8Zs.js +0 -2
- package/dist/owletto/dist/assets/_eventId-BVOVizs4.js +0 -2
- package/dist/owletto/dist/assets/_owner-DsvIC94q.js +0 -3
- package/dist/owletto/dist/assets/_shape-CWjpzcvv.js +0 -2
- package/dist/owletto/dist/assets/_slug-DuCxYsJk.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-BqVeHB6Z.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-DzyOCG5U.js +0 -2
- package/dist/owletto/dist/assets/accept-invitation-k1u3zBcn.js +0 -2
- package/dist/owletto/dist/assets/activity-route-view-jTBMW7a9.js +0 -2
- package/dist/owletto/dist/assets/agent-connect-pages-D3mVM_q4.js +0 -4
- package/dist/owletto/dist/assets/agent-permissions-matrix-C_ayr0pd.js +0 -2
- package/dist/owletto/dist/assets/app-bridge-C4nPtae3.js +0 -121
- package/dist/owletto/dist/assets/automation-run-now-CjkJIkaZ.js +0 -2
- package/dist/owletto/dist/assets/clients-BCvjAJDT.js +0 -2
- package/dist/owletto/dist/assets/connect-DZeFSGIH.js +0 -2
- package/dist/owletto/dist/assets/connect-menu-D4w-JhJW.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-IZEMQJ64.js +0 -2
- package/dist/owletto/dist/assets/connection-C7glVpPE.js +0 -2
- package/dist/owletto/dist/assets/connector-page-shell-BeuyjiB2.js +0 -2
- package/dist/owletto/dist/assets/connectors-DSQ5AWPf.js +0 -2
- package/dist/owletto/dist/assets/consent-B6Aw_89N.js +0 -2
- package/dist/owletto/dist/assets/create-CWcza8NT.js +0 -2
- package/dist/owletto/dist/assets/create-bGOYifof.js +0 -2
- package/dist/owletto/dist/assets/create._connectorKey-Ds4tpwHP.js +0 -2
- package/dist/owletto/dist/assets/device-D3fzoIrM.js +0 -2
- package/dist/owletto/dist/assets/entity-page-Cjc8oXA2.js +0 -2
- package/dist/owletto/dist/assets/entity-pages-18xSANrS.js +0 -2
- package/dist/owletto/dist/assets/entity-schema-graph-uwZ-P0t8.js +0 -2
- package/dist/owletto/dist/assets/event-detail-D6AH6a2C.js +0 -2
- package/dist/owletto/dist/assets/events-feed-BI7wNRUY.js +0 -2
- package/dist/owletto/dist/assets/index-9tTjJo_J.css +0 -1
- package/dist/owletto/dist/assets/index-BhJsTy-C.js +0 -2
- package/dist/owletto/dist/assets/index-CEcsgXDj.js +0 -2
- package/dist/owletto/dist/assets/index-CPscKk2u.js +0 -2
- package/dist/owletto/dist/assets/index-CfJ2-EpK.js +0 -2
- package/dist/owletto/dist/assets/index-D5DM4g2w.js +0 -2
- package/dist/owletto/dist/assets/login-CH7P2AyR.js +0 -2
- package/dist/owletto/dist/assets/memory-browse-page-Ba4aYavw.js +0 -74
- package/dist/owletto/dist/assets/new-BOsrRqp8.js +0 -2
- package/dist/owletto/dist/assets/new-DGPOjak2.js +0 -2
- package/dist/owletto/dist/assets/new-Q0XqiZq2.js +0 -2
- package/dist/owletto/dist/assets/organization-hD_Z6TSd.js +0 -2
- package/dist/owletto/dist/assets/peek-pane-content-Cc8YX1oy.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-CRyAZATw.js +0 -2
- package/dist/owletto/dist/assets/record-activity-9ux6SfCd.js +0 -2
- package/dist/owletto/dist/assets/reset-password-D2RfrEVZ.js +0 -2
- package/dist/owletto/dist/assets/runs-CuC7WMtd.js +0 -2
- package/dist/owletto/dist/assets/runs-list-8gUPWjP4.js +0 -2
- package/dist/owletto/dist/assets/source-record-panels-C4UItfdk.js +0 -2
- package/dist/owletto/dist/assets/subDays-hOwerOLo.js +0 -2
- package/dist/owletto/dist/assets/use-automations-CdtiVLCv.js +0 -2
- package/dist/owletto/dist/assets/use-login-redirect-CYlVkAhE.js +0 -2
- package/dist/owletto/dist/assets/view-param-filters-BdN8OU35.js +0 -2
- /package/vendor/postgres/{.bun-tag-c81dacd34e959a7a → .bun-tag-652f2580b8090d71} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as c,
|
|
2
|
-
//# sourceMappingURL=app._appId-
|
|
1
|
+
import{r as c,ja as b,ba as w,aZ as y,bj as C,a_ as f,j as e,au as k,L as i,i5 as j,ib as A,B as N,ia as P,jo as B,j4 as v,dt as D,du as R,dv as $,A as I,a9 as L,gd as M,jp as _,aS as E}from"./index-BoqrvLHQ.js";import{C as O}from"./connector-page-shell-an3SYLim.js";function z({ownerSlug:s,appId:n}){const a=c.useMemo(()=>b(s,n,w()),[s,n]),{data:r=[],isLoading:l,isError:d,refetch:g}=y(),[m,x]=c.useMemo(()=>{const t=a?.devicePlatforms;if(!t?.length)return[[],[]];const h=r.filter(o=>{const u=C(o);return u!=null&&t.includes(u)});return[h.filter(o=>f(o,s)),h.filter(o=>!f(o,s))]},[a,r,s]);if(!a)return e.jsxs(k,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"There is no app by that name."}),e.jsx(i,{to:"/$owner/connectors",params:{owner:s},search:{},className:"text-sm text-primary hover:underline",children:"Back to connectors"})]});const p=(a.devicePlatforms?.length??0)>0;return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(O,{header:e.jsx(D,{breadcrumb:e.jsx(R,{crumbs:[e.jsx(i,{to:"/$owner/connectors",params:{owner:s},search:{},className:$,children:"Connectors"},"connectors")]}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-muted-foreground",children:a.icon}),title:a.name,caption:a.description}),children:[e.jsx("div",{id:"setup",className:"scroll-mt-40",children:e.jsx(j,{title:m.length>0?n==="owletto-chrome"?"Connect another profile":"Connect another device":"Set up",children:e.jsx("div",{className:"space-y-3",children:a.steps.map(t=>e.jsx(T,{step:t},t.label))})})}),p?e.jsx(A,{entries:m.map(t=>({id:t.id,name:v(t),description:B(t,s),tone:t.online?null:"muted",link:P({to:"/$owner/connectors/device/$deviceId",params:{owner:s,deviceId:t.id}})})),isLoading:l,isError:d,onRetry:()=>void g(),action:e.jsx(N,{asChild:!0,variant:"outline",size:"sm",children:e.jsx("a",{href:"#setup",children:"Add connection"})})}):null,p&&!l&&!d&&x.length>0?e.jsxs(j,{title:"Your devices in other workspaces",children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Open a device to connect its capabilities here. Moving it is confirmed first and pauses its connections where it is now."}),e.jsx("ul",{className:"divide-y border-y",children:x.map(t=>e.jsx("li",{children:e.jsxs(i,{to:"/$owner/connectors/device/$deviceId",params:{owner:s,deviceId:t.id},className:"flex items-center justify-between gap-3 py-2.5 text-sm hover:text-primary",children:[e.jsx("span",{className:"font-medium",children:v(t)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Attached to"," ",t.organization_name??"another workspace"]})]})},t.id))})]}):null]})})}function T({step:s}){const[n,a]=c.useState(!1);if(s.href)return e.jsxs("a",{href:s.href,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs font-medium text-primary hover:bg-accent/50",children:[s.label,e.jsx(I,{className:"h-3 w-3"})]});const r=s.command??"";return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s.label}),e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border bg-muted/40 p-2.5",children:[e.jsx("pre",{className:"min-w-0 flex-1 overflow-x-auto font-mono text-xs leading-relaxed",children:r}),e.jsxs(N,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-1.5 text-xs",onClick:()=>{typeof navigator>"u"||!navigator.clipboard||navigator.clipboard.writeText(r).then(()=>{a(!0),setTimeout(()=>a(!1),1500)})},children:[n?e.jsx(L,{className:"h-3.5 w-3.5"}):e.jsx(M,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"sr-only",children:"Copy"})]})]})]})}function G(){const{owner:s,appId:n}=_.useParams();return e.jsx(E,{owner:s,children:({ownerSlug:a})=>e.jsx(z,{ownerSlug:a,appId:n})})}export{G as component};
|
|
2
|
+
//# sourceMappingURL=app._appId-ByIypCL9.js.map
|
package/dist/owletto/dist/assets/{assist-composer-B1LykXpD.js → assist-composer-kG_heHXo.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as b,s as k,r as o,
|
|
2
|
-
//# sourceMappingURL=assist-composer-
|
|
1
|
+
import{c as b,s as k,r as o,jM as v,j as e,L as x,B as M,jN as P}from"./index-BoqrvLHQ.js";import{u as S,a as y,M as R}from"./use-mention-search-khySpz_V.js";import{P as C,s as I}from"./pending-seed-BBACroge.js";import{n as A,c as E}from"./agent-thread-storage-Bx2-WBHQ.js";import"./index-Vcq4gwWv.js";import"./use-automations-DfBtVzGa.js";function $({ownerSlug:i,starters:m,preferredMentionKinds:u,onSent:f}){const g=b(),{data:j=[]}=k(),l=S(R),n=o.useMemo(()=>new Set(u??[]),[u]),N=o.useCallback(async d=>{const t=await l(d);return n.size===0?t:[...t].sort((a,w)=>Number(n.has(w.kind))-Number(n.has(a.kind)))},[n,l]),r=v(j),[s,h]=o.useState(""),p=o.useRef(s);p.current=s;const c=d=>{const t=d.trim();if(!t||!r)return;const a=A();I(a,t),h(""),g(E(i,r.agentId,a)),f?.()};return e.jsxs("div",{className:"rounded-lg border bg-background p-4 transition-colors focus-within:ring-1 focus-within:ring-ring",children:[r?e.jsx(y,{value:s,onChange:h,onSubmit:()=>c(p.current),searchRefs:N,placeholder:"Ask Lobu…",className:"[&_.ProseMirror]:max-h-40 [&_.ProseMirror]:min-h-24 [&_.ProseMirror]:overflow-y-auto"}):e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Bring your"," ",e.jsx(x,{to:"/$owner/agents/connect",params:{owner:i},className:"text-foreground hover:underline",children:"agent"})," ","or"," ",e.jsx(x,{to:"/$owner/agents/new",params:{owner:i},search:{},className:"text-foreground hover:underline",children:"create a new agent"})," ","to get started."]}),e.jsxs("div",{className:"flex items-end justify-between gap-3 pt-2",children:[r&&m&&!s.trim()?e.jsx(C,{prompts:m,onPick:c}):e.jsx("span",{}),e.jsxs(M,{type:"button",size:"icon",className:"h-10 w-10 shrink-0 rounded-full",disabled:!r||!s.trim(),onClick:()=>c(s),children:[e.jsx(P,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Send message"})]})]})]})}export{$ as AssistComposer};
|
|
2
|
+
//# sourceMappingURL=assist-composer-kG_heHXo.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{M as k,j as e,L as P,eo as $,r as p,al as R,B as F,fM as w,ez as K,fa as q,aw as B,H as O,n as L,z as H,m as I,cm as z,hR as J,co as Q,fh as W,dL as Y,K as V,f1 as G,hS as U,hT as X,y as Z,i as ee,u as te}from"./index-BoqrvLHQ.js";import{E as se}from"./event-detail-DUvlqn9b.js";import{a as ne,M as ie}from"./needs-you-list-3uMsWcDv.js";import{S as re}from"./scoped-feed-bar-DNFL0sYX.js";import{C as ae,A as oe}from"./create-automation-form-CD6jSlWL.js";import{P as ue}from"./proposal-review-shell-C8ZfIAYn.js";import{u as A,a as ce,i as le}from"./runs-k2NpbZm8.js";import{E as de}from"./events-feed-DcKTkJVe.js";import{D as me,a as fe}from"./definition-comparison-D_qP25jR.js";import{R as xe}from"./runs-list-DUXRMkWN.js";import{a as T,h as ge}from"./use-automations-DfBtVzGa.js";function C({automationId:t}){const{currentOwner:s}=k();return s?e.jsx(P,{to:"/$owner/events",params:{owner:s},search:$({semanticTypes:["change"],eventCategory:"config",resourceKind:"automation",resourceId:t}),className:"text-sm text-primary underline underline-offset-4",children:"View definition history in Events"}):null}const pe={workspace:!0},he=6,je=["name","title"],S=10;function j(t){return t==null?!1:typeof t=="string"?t.trim().length>0:Array.isArray(t)?t.some(j):typeof t=="object"?Object.values(t).some(j):!0}function ye(t){const s=t.split("_").join(" ").trim();return s.charAt(0).toUpperCase()+s.slice(1)}function _({value:t,depth:s=0}){if(!j(t))return null;if(typeof t!="object"||t==null)return e.jsx("span",{className:"break-words",children:String(t)});if(s>=he)return e.jsx("span",{className:"break-words text-muted-foreground",children:JSON.stringify(t).slice(0,200)});if(Array.isArray(t))return e.jsx("ul",{className:"space-y-1.5",children:t.filter(j).map((a,u)=>e.jsx("li",{className:"border-l-2 border-border pl-2",children:e.jsx(_,{value:a,depth:s+1})},u))});const n=t,r=je.find(a=>typeof n[a]=="string"&&j(n[a])),i=Object.entries(n).filter(([a,u])=>a!==r&&j(u));return e.jsxs("div",{className:"space-y-1",children:[r?e.jsx("p",{className:"font-medium text-foreground",children:String(n[r])}):null,i.length>0?e.jsx("dl",{className:"space-y-1",children:i.map(([a,u])=>e.jsxs("div",{children:[e.jsxs("dt",{className:"inline text-muted-foreground",children:[ye(a),":"," "]}),e.jsx("dd",{className:"inline",children:typeof u=="object"?e.jsx("div",{className:"mt-1",children:e.jsx(_,{value:u,depth:s+1})}):e.jsx(_,{value:u,depth:s+1})})]},a))}):null]})}function E({run:t}){const s=t.completed_at??t.created_at;return e.jsx("time",{dateTime:new Date(s).toISOString(),title:q(s),className:"text-xs text-muted-foreground",children:K(s)})}function b({rows:t}){return t.length===0?null:e.jsx("ul",{className:"divide-y overflow-hidden rounded-lg border",children:t.map(s=>e.jsx("li",{children:s.content},s.key))})}function Ne({owner:t,automationId:s,failedRows:n}){const r=p.useId(),i=A(pe,{runTypes:["automation"],automationIds:[s],status:"completed"},t),a=i.data?.pages.flatMap(d=>d.runs)??[],u=a.filter(d=>j(d.output)),c=a.length-u.length,[o,...m]=u,f=i.data?.pages.length??0,{hasNextPage:x,isFetching:l,fetchNextPage:h}=i;p.useEffect(()=>{!o&&x&&!l&&f<S&&h()},[o,x,l,f,h]);const y=i.hasNextPage?e.jsx("div",{className:"flex justify-center",children:i.isFetchingNextPage?e.jsx(R,{role:"status","aria-label":"Loading earlier runs",className:"text-muted-foreground"}):e.jsx(F,{variant:"link",size:"sm",className:"h-auto p-0 text-xs font-normal text-muted-foreground",disabled:i.isFetching,onClick:()=>void i.fetchNextPage(),children:"Show earlier runs"})}):null,N=o?[...m.map(d=>({key:String(d.id),occurredAt:d.completed_at??d.created_at,content:e.jsxs("div",{className:"space-y-1 px-3 py-2 text-xs",children:[e.jsx(E,{run:d}),e.jsx(_,{value:d.output})]})})),...n].sort((d,g)=>(w(g.occurredAt)??0)-(w(d.occurredAt)??0)):[];return i.isError?e.jsxs("div",{className:"space-y-6 py-6",children:[e.jsx("p",{role:"alert",className:"text-sm text-muted-foreground",children:"Couldn't load this Automation's runs."}),e.jsx(b,{rows:n})]}):i.isLoading||!o&&x&&f<S?null:o?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{"aria-label":"Latest result",className:"space-y-2",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("h2",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Latest result"}),e.jsx(E,{run:o})]}),e.jsx("div",{className:"text-sm",children:e.jsx(_,{value:o.output})})]}),N.length>0?e.jsxs("section",{"aria-labelledby":r,className:"space-y-2",children:[e.jsx("h2",{id:r,className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Earlier results"}),e.jsx(b,{rows:N})]}):null,c>0?e.jsxs("p",{className:"text-xs text-muted-foreground",children:[c," other ",c===1?"run":"runs"," found nothing new."]}):null,y]}):e.jsxs("div",{className:"space-y-6 py-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:a.length===0?"This Automation hasn't run yet. Its results appear here, newest first.":`It ran ${a.length}${i.hasNextPage?"+":""} times without returning a result.`}),e.jsx(b,{rows:n}),y]})}function D(t){const{orgContext:s,hasOrgContext:n}=k(),{data:r,isLoading:i}=B(`/${t}`,s),{isAuthenticated:a}=O(),{isMember:u,isLoading:c}=L(),o=a&&u,m=r?.workspace,f=o?!n||i||c:i||c;return{organizationId:m?.id??"",isLoading:f}}function Be(t){return D(t)}const _e={workspace:!0};function M(t,s,n=!0){const r=n?_e:null,i=A(r,{runTypes:["automation"],automationIds:[s],status:"failed"},t),a=A(r,{runTypes:["automation"],automationIds:[s],status:"timeout"},t);return p.useMemo(()=>[...i.data?.pages[0]?.runs??[],...a.data?.pages[0]?.runs??[]].sort((u,c)=>Date.parse(c.created_at)-Date.parse(u.created_at)||c.id-u.id),[i.data,a.data])}function ve(t,s){const n=z(t),{decisions:r,notices:i}=p.useMemo(()=>{const c=n.attentionCards.filter(o=>o.automation_id===s);return{decisions:Q(c),notices:c.filter(o=>!J(o)&&o.unread&&o.notification_id!=null)}},[n.attentionCards,s]);return{attention:n,decisions:r,notices:i,markRead:c=>{c.length>0&&n.markManyRead.mutateAsync(c)},unreadFor:c=>i.flatMap(o=>o.run_id!=null&&o.run_id===c.run_id||W(o.href?.split(/[?#]/)[0]??"")?.eventId===Number(c.id)?[o.notification_id]:[])}}function be({owner:t,automationId:s,organizationId:n}){const r=Number(s),i=p.useMemo(()=>({producedByAutomationId:r}),[r]),{attention:a,decisions:u,notices:c,markRead:o,unreadFor:m}=ve(t,r),f=M(t,r);if(!Number.isFinite(r))return null;const x=f.map(l=>({key:`run:${l.id}`,occurredAt:l.completed_at??l.created_at,content:e.jsx(xe,{run:l,ownerSlug:t})}));return e.jsxs(e.Fragment,{children:[a.isError?e.jsx("p",{role:"alert",className:"mb-6 text-sm text-destructive",children:"Could not load notifications. Refresh to try again."}):u.length>0?e.jsxs("section",{"aria-label":"Needs you",className:"mb-6 space-y-2",children:[e.jsx("h2",{className:"px-1 text-sm font-semibold",children:"Needs you"}),e.jsx(ne,{owner:t,entries:u})]}):null,e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(re,{owner:t,organizationId:n||null,activitySearch:{produced_by:String(r)}}),e.jsx(ie,{entries:c.map(l=>({unreadIds:[l.notification_id]})),disabled:a.markManyRead.isPending,onMarkRead:o})]}),e.jsx(de,{organizationId:n,ownerSlug:t,filters:i,foldRunSatellites:!1,unreadNotices:m,onMarkRead:o,extraRows:x,renderLead:(l,{hasEarlier:h})=>e.jsxs("div",{className:"mb-4 space-y-6",children:[e.jsxs("section",{"aria-label":"Latest result",className:"space-y-2",children:[e.jsx("h2",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Latest result"}),e.jsx(se,{owner:t,organizationId:n,eventId:l.id})]}),h?e.jsx("h2",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Earlier results"}):null]}),emptyState:e.jsx(Ne,{owner:t,automationId:r,failedRows:x})})]})}function Ae({agentId:t,automationId:s,runId:n,organizationId:r,onDone:i}){const[a,u]=p.useState({ready:!1,triggers:[]}),c=p.useCallback(d=>{u(g=>JSON.stringify(g)===JSON.stringify(d)?g:d)},[]),o=T(s,void 0,r,{includeVersions:!0}),m=o.data?.automation,{currentOwner:f}=k(),x=H({queryKey:["automations-list",f,"editor",s,m?.status],enabled:!!f&&!!r&&!!m,queryFn:async()=>{const g=(await Y("manage_automations",{action:"list",automation_id:s,status:m?.status,include_details:!0,limit:1},{slug:f})).automations.find(v=>v.automation_id===s);if(!g)throw new V("Automation not found",404);return g},staleTime:3e4}),l=x.data,h=p.useMemo(()=>m&&l?{automation_id:m.automation_id,name:l.name,slug:l.slug,description:l.description,prompt:l.prompt,sources:l.sources,reaction_script:m.reaction_script,managed_agent_id:l.managed_agent_id,device_worker_id:l.device_worker_id,agent_kind:l.agent_kind,delivery_target:l.delivery_target??void 0,execution_config:l.execution_config??void 0,model_config:l.model_config,tags:l.tags,keying_config:m.keying_config,reactions_guidance:l.reactions_guidance,triggers:l.triggers}:void 0,[m,l]),y=e.jsx("div",{className:"flex flex-col gap-4",children:[0,1,2].map(d=>e.jsx(I,{className:"h-16 w-full rounded-lg"},d))}),N=x.isError?e.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[e.jsx("p",{children:"Could not load the saved Automation definition."}),e.jsx("button",{type:"button",className:"text-primary underline underline-offset-4",onClick:()=>void x.refetch(),children:"Retry"})]}):o.isLoading||m&&x.isPending?y:h?e.jsx(ae,{organizationId:r,prefillAgentId:t??void 0,editingAutomation:h,createFields:{triggers:a.triggers},triggerFields:e.jsx(oe,{organizationId:r,initialTriggers:h.triggers??[],onChange:c},JSON.stringify(h.triggers??[])),hideHeader:!0,hideCancel:!0,submitDisabled:!a.ready,onClose:i}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Automation not found. It may have been removed."});return t?e.jsxs("div",{className:"space-y-6",children:[e.jsx(ue,{resource:{kind:"automation",agentId:t,automationId:s},runId:n,onDone:i,children:({reviewMode:d,proposal:g})=>d==="active"?e.jsx(me,{current:g?.current??null,proposed:{...g?.current??{},...g?.proposedAfter??{}},render:v=>e.jsx(fe,{value:v})}):d==="loading"?y:d==="error"?null:N}),e.jsx(C,{automationId:s})]}):e.jsxs("div",{className:"space-y-6",children:[N,e.jsx(C,{automationId:s})]})}function He({owner:t,agentId:s,automationId:n,view:r,runId:i,onDone:a}){const{organizationId:u}=D(t),c=T(n,void 0,u),o=s??c.data?.automation?.managed_agent_id??null;return i||r==="definition"?e.jsx(Ae,{agentId:o,automationId:n,runId:i,organizationId:u,onDone:a},`${t}/${n}`):e.jsx(be,{owner:t,automationId:n,organizationId:u})}function Ie(t,s,n,r=!0){const{isAuthenticated:i}=O(),{isMember:a}=L(),u=ge(),c=r&&i&&a&&n?.status==="active",o=c&&n?.schedule_auto_paused_at!=null,m=Number(s),[f]=M(t,m,o&&Number.isFinite(m));return{owner:t,automationId:s,canRun:c,paused:o,pending:u.isPending,run:()=>u.mutate(s),failures:n?.consecutive_scheduled_failures??0,scheduled:n?.triggers?.some(x=>x.kind==="schedule")??!1,external:["external","manual"].includes(G(n)),error:(f?.error_message??n?.last_scheduling_error)?.trim()||null,result:c?u.data:void 0}}function ze({runNow:t}){return e.jsxs(e.Fragment,{children:[t.paused?e.jsx(Re,{failures:t.failures,error:t.error,scheduled:t.scheduled,external:t.external,action:e.jsx(ke,{variant:"default",pending:t.pending,onRun:t.run})}):null,t.result?e.jsx(Se,{owner:t.owner,automationId:t.automationId,result:t.result},t.result.run_id):null]})}function ke({pending:t,onRun:s,variant:n="ghost"}){return e.jsxs(F,{type:"button",variant:n,size:"sm",className:"h-8 gap-1.5",disabled:t,onClick:s,children:[t?e.jsx(R,{}):e.jsx(U,{className:"h-3.5 w-3.5","aria-hidden":!0}),t?"Starting...":"Run now"]})}function Re({failures:t,error:s,scheduled:n,external:r,action:i}){const a=r?`Run now resumes it right away${n?" and restarts its schedule":""}.`:"Run now retries it, and a successful run resumes it.";return e.jsxs("section",{"aria-label":"Automation paused",className:"flex flex-wrap items-start gap-3 rounded-lg bg-amber-500/10 px-3 py-2.5 text-sm",children:[e.jsx(X,{"aria-hidden":!0,className:"mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("p",{className:"font-medium",children:["Automation paused after"," ",t===1?"a failed run":`${t} consecutive failed runs`]}),s?e.jsxs("p",{title:s,className:"line-clamp-3 whitespace-pre-wrap break-words text-muted-foreground",children:["Latest error: ",s]}):null,e.jsxs("p",{className:"text-muted-foreground",children:[a,n?" Changing its schedule also resumes it.":null]})]}),i]})}function we({owner:t,automationId:s,runId:n}){const r=te();return e.jsxs(P,{to:"/$owner/events",params:{owner:t},search:{run_ids:String(n)},className:"font-medium text-foreground underline-offset-4 hover:underline",onClick:i=>{!r||i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey||(i.preventDefault(),r.open({href:`/${t}/automations/${s}?view=activity&run_id=${n}`,title:`Run #${n}`,runId:n}))},children:["Run #",n]})}function Ce(t,s){return t==="running"||t==="claimed"?"is running":t==="pending"?s==="external_client"?"is waiting for a connected client to pick it up":s==="device_worker"?"is waiting for its device":"is queued":t==="completed"?"completed":t==="timeout"?"timed out":t==="cancelled"?"was cancelled":t}function Se({owner:t,automationId:s,result:n}){const r=ce(t,n.run_id),i=r.data?.status??n.status,a=le(i),u=Z(),c=p.useRef(!1);p.useEffect(()=>{if(a){c.current=!0;return}if(c.current){c.current=!1;for(const f of["automation-detail","automations-list","runs-infinite"])u.invalidateQueries({queryKey:[f]})}},[a,u]);const o=a?null:r.data?.error_message?.trim(),m=i==="failed"||i==="timeout"||i==="cancelled";return e.jsxs("p",{role:"status",className:ee("flex items-center gap-1.5 text-sm",m?"text-destructive":"text-muted-foreground"),children:[a&&!r.isError?e.jsx(R,{className:"shrink-0"}):null,e.jsxs("span",{className:"min-w-0 break-words",children:[!n.created&&a?"Already in progress: ":null,e.jsx(we,{owner:t,automationId:s,runId:n.run_id})," ",Ce(i,n.execution.lane),o?`: ${o}`:"."]})]})}export{He as A,ke as R,ze as a,Be as b,Ie as u};
|
|
2
|
+
//# sourceMappingURL=automation-run-now-C5XTS00o.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as a,
|
|
2
|
-
//# sourceMappingURL=callback-
|
|
1
|
+
import{c as a,H as i,r as n,j as t}from"./index-BoqrvLHQ.js";function r(){const s=a(),{isReady:e}=i();return n.useEffect(()=>{e&&setTimeout(()=>{s({to:"/"})},500)},[e,s]),t.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center",children:t.jsx("div",{className:"text-center",children:t.jsx("p",{className:"text-muted-foreground",children:e?"Redirecting...":"Completing sign in..."})})})}export{r as component};
|
|
2
|
+
//# sourceMappingURL=callback-Pz5uS-k7.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as r,
|
|
2
|
-
//# sourceMappingURL=card-
|
|
1
|
+
import{j as r,bJ as d}from"./index-BoqrvLHQ.js";function n({className:a,...t}){return r.jsx("div",{"data-slot":"card",className:`bg-card text-card-foreground flex flex-col gap-6 rounded-2xl border py-6 ${a||""}`,...t})}function i({className:a,...t}){return r.jsx("div",{"data-slot":"card-header",className:`grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] ${a||""}`,...t})}function c({className:a,asChild:t=!1,...s}){const o=t?d:"div";return r.jsx(o,{"data-slot":"card-title",className:`leading-none font-semibold ${a||""}`,...s})}function l({className:a,...t}){return r.jsx("div",{"data-slot":"card-description",className:`mt-1 first:mt-0 text-muted-foreground text-sm ${a||""}`,...t})}function u({className:a,...t}){return r.jsx("div",{"data-slot":"card-content",className:`px-6 ${a||""}`,...t})}export{n as C,i as a,c as b,u as c,l as d};
|
|
2
|
+
//# sourceMappingURL=card-CAPpY9P5.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=claim-
|
|
1
|
+
import{V as e,j as c,W as r}from"./index-BoqrvLHQ.js";function n(){const{team:a}=e({from:"/slack/claim"});return c.jsx(r,{to:"/connector/$name/connection",params:{name:"slack"},search:{ref:a},replace:!0})}export{n as component};
|
|
2
|
+
//# sourceMappingURL=claim-DgWWK0KI.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=client-activity-scopes-
|
|
1
|
+
import{H as m,z as f,af as y,a4 as I,dN as v}from"./index-BoqrvLHQ.js";function w(t){const{session:o,isReady:u}=m(),c=u?o?.user.id:void 0,l=t?.limit??20,i=(t?.clientIds??[]).join(","),a=t?.activityKind??null,d=t?.excludeCommandClients??!1,n=t?.organizationId??null,s=t?.refetchInterval;return f({queryKey:["client-activity-scopes",c,l,i,a,d,n],queryFn:async()=>{const e=new URLSearchParams({limit:String(l)});i&&e.set("client_ids",i),a&&e.set("activity_kind",a),d&&e.set("exclude_command_clients","true"),n&&e.set("organization_id",n);const r=await y(`${I}/api/me/clients/activity-scopes?${e}`,{credentials:"include"});return await v(r,"Failed to load client activity"),(await r.json()).scopes??[]},enabled:!!c&&(t?.enabled??!0),staleTime:15e3,refetchInterval:typeof s=="function"?e=>s((e.state.data?.length??0)>0):s})}export{w as u};
|
|
2
|
+
//# sourceMappingURL=client-activity-scopes-Aqdo6Pdr.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=client-rows-
|
|
1
|
+
import{eR as c}from"./index-BoqrvLHQ.js";function a(t){const n=new Map;for(const e of t){if(e.kind!=="mcp")continue;const s=e.title?.trim()||e.identifier||"Unknown app",l=e.registrationGroupKey||e.id,i=n.get(l);if(!i){n.set(l,{key:l,clientId:e.id,title:s,drivenBy:e.drivenBy?.trim()||null,clientIds:[e.id],connected:e.status==="connected",lastSeenAt:e.lastSeenAt??null,linkedUser:e.linkedUserName??e.linkedUserEmail??null,linkedUserEntitySlug:e.linkedUserEntitySlug??null});continue}i.clientIds.push(e.id),i.connected=i.connected||e.status==="connected",(e.lastSeenAt??0)>(i.lastSeenAt??0)&&(i.lastSeenAt=e.lastSeenAt??null,i.drivenBy=e.drivenBy?.trim()||null)}return[...n.values()].sort((e,s)=>(s.lastSeenAt??0)-(e.lastSeenAt??0))}function o(t){const n=[t.linkedUser];return n.push(t.connected?`active ${c(t.lastSeenAt)}`:"disconnected"),t.drivenBy&&t.drivenBy!==t.title&&n.push(`via ${t.drivenBy}`),n.filter(Boolean).join(" · ")}function d(t){return t.title?.trim()||t.clientName?.trim()||(t.activityKind==="session"?"MCP session":"App activity")}export{d as a,o as c,a as g};
|
|
2
|
+
//# sourceMappingURL=client-rows-Dd5YV8vn.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{dM as c,z as u,y as d,E as p,by as r,af as o,dN as i,a4 as w}from"./index-BoqrvLHQ.js";function l(t,s="",e){const n=`${w}/api/${t}/clients${s}`,a=e?.toString();return a?`${n}?${a}`:n}function y(t,s){const e=s?.ownerSlug??c().slug;return u({queryKey:["connected-clients",e,t??null],queryFn:async()=>{if(!e)throw new Error("Workspace required");const n=new URLSearchParams;t&&n.set("agentId",t);const a=await o(l(e,"",n),{credentials:"include"});return await i(a,"Failed to load connected clients"),(await a.json()).clients??[]},enabled:!!e&&(s?.enabled??!0),staleTime:15e3,refetchInterval:s?.refetchInterval})}function h(){const{slug:t}=c(),s=d();return p({mutationFn:async e=>{if(!t)throw new Error("Workspace required");const n=new URLSearchParams;e.scope==="all"&&n.set("scope","all");const a=await o(l(t,`/mcp/${encodeURIComponent(e.clientId)}`,n),{method:"DELETE",credentials:"include"});return await i(a,"Failed to revoke client"),await a.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["connected-clients",t]}),r.success("App access revoked")},onError:e=>{r.error(e.message||"Failed to revoke app access")}})}export{h as a,y as u};
|
|
2
|
+
//# sourceMappingURL=clients-Bf7ZgGro.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as $t,j as yu,i as bu}from"./index-
|
|
1
|
+
import{r as $t,j as yu,i as bu}from"./index-BoqrvLHQ.js";import{k as Su,b as Qu,s as ku}from"./index-Vcq4gwWv.js";let Or=[],lh=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?lh:Or).push(t=t+n[e])})();function wu(n){if(n<768)return!1;for(let e=0,t=Or.length;;){let i=e+t>>1;if(n<Or[i])t=i;else if(n>=lh[i])e=i+1;else return!0;if(e==t)return!1}}function sl(n){return n>=127462&&n<=127487}const rl=8205;function vu(n,e,t=!0,i=!0){return(t?ah:$u)(n,e,i)}function ah(n,e,t){if(e==n.length)return e;e&&hh(n.charCodeAt(e))&&ch(n.charCodeAt(e-1))&&e--;let i=Ls(n,e);for(e+=ol(i);e<n.length;){let s=Ls(n,e);if(i==rl||s==rl||t&&wu(s))e+=ol(s),i=s;else if(sl(s)){let r=0,o=e-2;for(;o>=0&&sl(Ls(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function $u(n,e,t){for(;e>0;){let i=ah(n,e-2,t);if(i<e)return i;e--}return 0}function Ls(n,e){let t=n.charCodeAt(e);if(!ch(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return hh(i)?(t-55296<<10)+(i-56320)+65536:t}function hh(n){return n>=56320&&n<57344}function ch(n){return n>=55296&&n<56320}function ol(n){return n<65536?1:2}class E{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=li(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Ue.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=li(this,e,t);let i=[];return this.decompose(e,t,i,0),Ue.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Ci(this),r=new Ci(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Ci(this,e)}iterRange(e,t=this.length){return new fh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new uh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?E.empty:e.length<=32?new H(e):Ue.from(H.split(e,[]))}}class H extends E{constructor(e,t=Pu(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Tu(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new H(ll(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Mn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new H(l,o.length+r.length));else{let a=l.length>>1;i.push(new H(l.slice(0,a)),new H(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof H))return super.replace(e,t,i);[e,t]=li(this,e,t);let s=Mn(this.text,Mn(i.text,ll(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new H(s,r):Ue.from(H.split(s,[]),r)}sliceString(e,t=this.length,i=`
|
|
2
2
|
`){[e,t]=li(this,e,t);let s="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let l=this.text[o],a=r+l.length;r>e&&o&&(s+=i),e<a&&t>r&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new H(i,s)),i=[],s=-1);return s>-1&&t.push(new H(i,s)),t}}class Ue extends E{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let l=this.children[r],a=o+l.length;if(e<=a&&t>=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=li(this,e,t),i.lines<this.lines)for(let s=0,r=0;s<this.children.length;s++){let o=this.children[s],l=r+o.length;if(e>=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let c=this.children.slice();return c[s]=a,new Ue(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
3
3
|
`){[e,t]=li(this,e,t);let s="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let l=this.children[r],a=o+l.length;o>e&&r&&(s+=i),e<a&&t>o&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ue))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let O of e)O.flatten(d);return new H(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let O;if(d.lines>r&&d instanceof Ue)for(let p of d.children)f(p);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof H&&a&&(O=c[c.length-1])instanceof H&&d.lines+O.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new H(O.text.concat(d.text),O.length+1+d.length)):(a+d.lines>s&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:Ue.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Ue(l,t)}}E.empty=new H([""],0);function Pu(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Mn(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r<n.length&&s<=i;r++){let l=n[r],a=s+l.length;a>=t&&(a>i&&(l=l.slice(0,i-s)),s<t&&(l=l.slice(t-s)),o?(e[e.length-1]+=l,o=!1):e.push(l)),s=a+1}return e}function ll(n,e,t){return Mn(n,[""],e,t)}class Ci{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof H?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof H?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
4
4
|
`,this;e--}else if(s instanceof H){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof H?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class fh{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ci(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class uh{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(E.prototype[Symbol.iterator]=function(){return this.iter()},Ci.prototype[Symbol.iterator]=fh.prototype[Symbol.iterator]=uh.prototype[Symbol.iterator]=function(){return this});class Tu{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}function li(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function se(n,e,t=!0,i=!0){return vu(n,e,t,i)}function Cu(n){return n>=56320&&n<57344}function Zu(n){return n>=55296&&n<56320}function me(n,e){let t=n.charCodeAt(e);if(!Zu(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Cu(i)?(t-55296<<10)+(i-56320)+65536:t}function fo(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Fe(n){return n<65536?1:2}const pr=/\r\n?|\n/;var le=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(le||(le={}));class it{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,s=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];o<0?(e(i,s,r),s+=r):s+=o,i+=r}}iterChangedRanges(e,t=!1){mr(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];s<0?e.push(i,s):e.push(s,i)}return new it(e)}composeDesc(e){return this.empty?e:e.empty?this:dh(this,e)}mapDesc(e,t=!1){return e.empty?this:gr(this,e,t)}mapPos(e,t=-1,i=le.Simple){let s=0,r=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=s+l;if(a<0){if(h>e)return r+(e-s);r+=l}else{if(i!=le.Simple&&h>=e&&(i==le.TrackDel&&s<e&&h>e||i==le.TrackBefore&&s<e||i==le.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i<this.sections.length&&s<=t;){let r=this.sections[i++],o=this.sections[i++],l=s+r;if(o>=0&&s<=t&&l>=e)return s<e&&l>t?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];e+=(e?" ":"")+i+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new it(e)}static create(e){return new it(e)}}class ie extends it{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return mr(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return gr(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s<t.length;s+=2){let o=t[s],l=t[s+1];if(l>=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length<a;)i.push(E.empty);i.push(o?e.slice(r,r+o):E.empty)}r+=o}return new ie(t,i)}compose(e){return this.empty?e:e.empty?this:dh(this,e,!0)}map(e,t=!1){return e.empty?this:gr(this,e,t,!0)}iterChanges(e,t=!1){mr(this,e,t)}get desc(){return it.create(this.sections)}filter(e){let t=[],i=[],s=[],r=new Wi(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&r.len==0;){if(r.done)break e;let c=Math.min(r.len,a-l);he(s,c,-1);let f=r.ins==-1?-1:r.off==0?r.ins:0;he(t,c,f),f>0&&Ot(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l<h;){if(r.done)break e;let c=Math.min(r.len,h-l);he(t,c,-1),he(s,c,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(c),l+=c}}return{changes:new ie(t,i),filtered:it.create(s)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],s=this.sections[t+1];s<0?e.push(i):s==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;o<t&&he(s,t-o,-1);let f=new ie(s,r);l=l?l.compose(f.map(l)):f,s=[],r=[],o=0}function h(c){if(Array.isArray(c))for(let f of c)h(f);else if(c instanceof ie){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:f,to:u=f,insert:d}=c;if(f>u||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let O=d?typeof d=="string"?E.of(d.split(i||pr)):d:E.empty,p=O.length;if(f==u&&p==0)return;f<o&&a(),f>o&&he(s,f-o,-1),he(s,u-f,p),Ot(r,s,O),o=u}}return h(e),a(!l),l}static empty(e){return new ie(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;s<e.length;s++){let r=e[s];if(typeof r=="number")t.push(r,-1);else{if(!Array.isArray(r)||typeof r[0]!="number"||r.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length<s;)i.push(E.empty);i[s]=E.of(r.slice(1)),t.push(r[0],i[s].length)}}}return new ie(t,i)}static createSet(e,t){return new ie(e,t)}}function he(n,e,t,i=!1){if(e==0&&t<=0)return;let s=n.length-2;s>=0&&t<=0&&t==n[s+1]?n[s]+=e:s>=0&&e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function Ot(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(E.empty);n.push(t)}}function mr(n,e,t){let i=n.inserted;for(let s=0,r=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)s+=l,r+=l;else{let h=s,c=r,f=E.empty;for(;h+=l,c+=a,a&&i&&(f=f.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,f),s=h,r=c}}}function gr(n,e,t,i=!1){let s=[],r=i?[]:null,o=new Wi(n),l=new Wi(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);he(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let h=l.len;for(he(s,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(he(s,0,o.ins),r&&Ot(r,s,o.text),a=o.i),o.forward(c),h-=c}l.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;he(s,h,a<o.i?o.ins:0),r&&a<o.i&&Ot(r,s,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return r?ie.createSet(s,r):it.create(s);throw new Error("Mismatched change set lengths")}}}function dh(n,e,t=!1){let i=[],s=t?[]:null,r=new Wi(n),o=new Wi(e);for(let l=!1;;){if(r.done&&o.done)return s?ie.createSet(i,s):it.create(i);if(r.ins==0)he(i,r.len,0,l),r.next();else if(o.len==0&&!o.done)he(i,0,o.ins,l),s&&Ot(s,i,o.text),o.next();else{if(r.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(r.len2,o.len),h=i.length;if(r.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;he(i,a,c,l),s&&c&&Ot(s,i,o.text)}else o.ins==-1?(he(i,r.off?0:r.len,a,l),s&&Ot(s,i,r.textBit(a))):(he(i,r.off?0:r.len,o.off?0:o.ins,l),s&&!o.off&&Ot(s,i,o.text));l=(r.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class Wi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?E.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?E.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Rt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new Rt(i,s,this.flags)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return y.range(e,t,void 0,void 0,i);let s=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return y.range(this.anchor,s,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return y.range(e.anchor,e.head)}static create(e,t,i){return new Rt(e,t,i)}}class y{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:y.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new y([this.main],0)}addRange(e,t=!0){return y.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,y.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new y(e.ranges.map(t=>Rt.fromJSON(t)),e.main)}static single(e,t=e){return new y([y.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;s<e.length;s++){let r=e[s];if(r.empty?r.from<=i:r.from<i)return y.normalized(e.slice(),t);i=r.to}return new y(e,t)}static cursor(e,t=0,i,s){return Rt.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(s??16777215)<<6)}static range(e,t,i,s,r){let o=(i??16777215)<<6|(s==null?7:Math.min(6,s));return!r&&e!=t&&(r=t<e?1:-1),t<e?Rt.create(t,e,48|o):Rt.create(e,t,(r?r<0?8:16:0)|o)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;s<e.length;s++){let r=e[s],o=e[s-1];if(r.empty?r.from<=o.to:r.from<o.to){let l=o.from,a=Math.max(r.to,o.to);s<=t&&t--,e.splice(--s,2,r.anchor>r.head?y.range(a,l):y.range(l,a))}}return new y(e,t)}}function Oh(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let uo=0;class P{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=uo++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new P(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Oo),!!e.static,e.enables)}of(e){return new Rn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Rn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Rn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Oo(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Rn{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=uo++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||xr(f,c)){let d=i(f);if(l?!al(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,O=u.config.address[r];if(O!=null){let p=Yn(u,O);if(this.dependencies.every(m=>m instanceof P?u.facet(m)===f.facet(m):m instanceof ce?u.field(m,!1)==f.field(m,!1):!0)||(l?al(d=i(f),p,s):s(d=i(f),p)))return f.values[o]=p,0}else d=i(f);return f.values[o]=d,1}}}}function al(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function xr(n,e){let t=!1;for(let i of e)Zi(n,i)&1&&(t=!0);return t}function Au(n,e,t){let i=t.map(a=>n[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let f=Yn(a,i[c]);if(s[c]==2)for(let u of f)h.push(u);else h.push(f)}return e.combine(h)}return{create(a){for(let h of i)Zi(a,h);return a.values[o]=l(a),1},update(a,h){if(!xr(a,r))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=xr(a,i),f=h.config.facets[e.id],u=h.facet(e);if(f&&!c&&Oo(t,f))return a.values[o]=u,0;let d=l(a);return e.compare(d,u)?(a.values[o]=u,0):(a.values[o]=d,1)}}}const hn=P.define({static:!0});class ce{constructor(e,t,i,s,r){this.id=e,this.createF=t,this.updateF=i,this.compareF=s,this.spec=r,this.provides=void 0}static define(e){let t=new ce(uo++,e.create,e.update,e.compare||((i,s)=>i===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(hn).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>{let r=i.facet(hn),o=s.facet(hn),l;return(l=r.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,hn.of({field:this,create:e})]}get extension(){return this}}const At={lowest:4,low:3,default:2,high:1,highest:0};function bi(n){return e=>new ph(e,n)}const kt={highest:bi(At.highest),high:bi(At.high),default:bi(At.default),low:bi(At.low),lowest:bi(At.lowest)};class ph{constructor(e,t){this.inner=e,this.prec=t}}class ps{of(e){return new yr(this,e)}reconfigure(e){return ps.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class yr{constructor(e,t){this.compartment=e,this.inner=t}}class Bn{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Mu(e,t,o))u instanceof ce?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i?.config.facets;for(let u in r){let d=r[u],O=d[0].facet,p=c&&c[u]||[];if(d.every(m=>m.type==0))if(l[O.id]=a.length<<1|1,Oo(p,d))a.push(i.facet(O));else{let m=O.combine(d.map(x=>x.value));a.push(i&&O.compare(m,i.facet(O))?i.facet(O):m)}else{for(let m of d)m.type==0?(l[m.id]=a.length<<1|1,a.push(m.value)):(l[m.id]=h.length<<1,h.push(x=>m.dynamicSlot(x)));l[O.id]=h.length<<1,h.push(m=>Au(m,O,d))}}let f=h.map(u=>u(l));return new Bn(e,o,f,l,a,r)}}function Mu(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof yr&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof yr){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof ph)r(o.inner,o.prec);else if(o instanceof ce)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Rn)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,At.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,At.default),i.reduce((o,l)=>o.concat(l))}function Zi(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function Yn(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const mh=P.define(),br=P.define({combine:n=>n.some(e=>e),static:!0}),gh=P.define({combine:n=>n.length?n[0]:void 0,static:!0}),xh=P.define(),yh=P.define(),bh=P.define(),Sh=P.define({combine:n=>n.length?n[0]:!1});class ct{constructor(e,t){this.type=e,this.value=t}static define(){return new Ru}}class Ru{of(e){return new ct(this,e)}}class Xu{constructor(e){this.map=e}of(e){return new M(this,e)}}class M{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new M(this.type,t)}is(e){return this.type==e}static define(e={}){return new Xu(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}M.reconfigure=M.define();M.appendConfig=M.define();class J{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Oh(i,t.newLength),r.some(l=>l.type==J.time)||(this.annotations=r.concat(J.time.of(Date.now())))}static create(e,t,i,s,r,o){return new J(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(J.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}J.time=ct.define();J.userEvent=ct.define();J.addToHistory=ct.define();J.remote=ct.define();function Lu(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i<n.length&&(s==e.length||e[s]>=n[i]))r=n[i++],o=n[i++];else if(s<e.length)r=e[s++],o=e[s++];else return t;!t.length||t[t.length-1]<r?t.push(r,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Qh(n,e,t){var i;let s,r,o;return t?(s=e.changes,r=ie.empty(e.changes.length),o=n.changes.compose(e.changes)):(s=e.changes.map(n.changes),r=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(r):(i=n.selection)===null||i===void 0?void 0:i.map(s),effects:M.mapEffects(n.effects,s).concat(M.mapEffects(e.effects,r)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function Sr(n,e,t){let i=e.selection,s=Jt(e.annotations);return e.userEvent&&(s=s.concat(J.userEvent.of(e.userEvent))),{changes:e.changes instanceof ie?e.changes:ie.of(e.changes||[],t,n.facet(gh)),selection:i&&(i instanceof y?i:y.single(i.anchor,i.head)),effects:Jt(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function kh(n,e,t){let i=Sr(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let r=1;r<e.length;r++){e[r].filter===!1&&(t=!1);let o=!!e[r].sequential;i=Qh(i,Sr(n,e[r],o?i.changes.newLength:n.doc.length),o)}let s=J.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Wu(t?Du(s):s)}function Du(n){let e=n.startState,t=!0;for(let s of e.facet(xh)){let r=s(n);if(r===!1){t=!1;break}Array.isArray(r)&&(t=t===!0?r:Lu(t,r))}if(t!==!0){let s,r;if(t===!1)r=n.changes.invertedDesc,s=ie.empty(e.doc.length);else{let o=n.changes.filter(t);s=o.changes,r=o.filtered.mapDesc(o.changes).invertedDesc}n=J.create(e,s,n.selection&&n.selection.map(r),M.mapEffects(n.effects,r),n.annotations,n.scrollIntoView)}let i=e.facet(yh);for(let s=i.length-1;s>=0;s--){let r=i[s](n);r instanceof J?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof J?n=r[0]:n=kh(e,Jt(r),!1)}return n}function Wu(n){let e=n.startState,t=e.facet(bh),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=Qh(i,Sr(e,r,n.changes.newLength),!0))}return i==n?n:J.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const Eu=[];function Jt(n){return n==null?Eu:Array.isArray(n)?n:[n]}var G=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(G||(G={}));const zu=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Qr;try{Qr=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Bu(n){if(Qr)return Qr.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||zu.test(t)))return!0}return!1}function Yu(n){return e=>{if(!/\S/.test(e))return G.Space;if(Bu(e))return G.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return G.Word;return G.Other}}class z{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Zi(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Zi(this,i),Yn(this,i)}update(...e){return kh(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:s}=t;for(let l of e.effects)l.is(ps.reconfigure)?(t&&(s=new Map,t.compartments.forEach((a,h)=>s.set(h,a)),t=null),s.set(l.value.compartment,l.value.extension)):l.is(M.reconfigure)?(t=null,i=l.value):l.is(M.appendConfig)&&(t=null,i=Jt(i).concat(l.value));let r;t?r=e.startState.values.slice():(t=Bn.resolve(i,s,this),r=new z(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(br)?e.newSelection:e.newSelection.asSingle();new z(t,e.newDoc,o,r,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:y.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=Jt(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),c=h.map(s);for(let u=0;u<l;u++)r[u]=r[u].map(c);let f=s.mapDesc(h,!0);r.push(a.range.map(f)),s=s.compose(c),o=M.mapEffects(o,c).concat(M.mapEffects(Jt(a.effects),f))}return{changes:s,selection:y.create(r,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ie?e:ie.of(e,this.doc.length,this.facet(z.lineSeparator))}toText(e){return E.of(e.split(this.facet(z.lineSeparator)||pr))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Zi(this,t),Yn(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let s=e[i];s instanceof ce&&this.config.address[s.id]!=null&&(t[i]=s.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(i){for(let r in i)if(Object.prototype.hasOwnProperty.call(e,r)){let o=i[r],l=e[r];s.push(o.init(a=>o.spec.fromJSON(l,a)))}}return z.create({doc:e.doc,selection:y.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Bn.resolve(e.extensions||[],new Map),i=e.doc instanceof E?e.doc:E.of((e.doc||"").split(t.staticFacet(z.lineSeparator)||pr)),s=e.selection?e.selection instanceof y?e.selection:y.single(e.selection.anchor,e.selection.head):y.single(0);return Oh(s,i.length),t.staticFacet(br)||(s=s.asSingle()),new z(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(z.tabSize)}get lineBreak(){return this.facet(z.lineSeparator)||`
|
|
@@ -23,4 +23,4 @@ import{r as $t,j as yu,i as bu}from"./index-CdDNNAx2.js";import{k as Su,b as Qu,
|
|
|
23
23
|
}`,{label:"class",detail:"definition",type:"keyword"}),pe('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),pe('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],b1=jf.concat([pe("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),pe("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),pe("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Ya=new Pp,Nf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function vi(n){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,n),!0}}const S1=["FunctionDeclaration"],Q1={FunctionDeclaration:vi("function"),ClassDeclaration:vi("class"),ClassExpression:()=>!0,EnumDeclaration:vi("constant"),TypeAliasDeclaration:vi("type"),NamespaceDeclaration:vi("namespace"),VariableDefinition(n,e){n.matchContext(S1)||e(n,"variable")},TypeDefinition(n,e){e(n,"type")},__proto__:null};function Gf(n,e){let t=Ya.get(e);if(t)return t;let i=[],s=!0;function r(o,l){let a=n.sliceString(o.from,o.to);i.push({label:a,type:l})}return e.cursor(U.IncludeAnonymous).iterate(o=>{if(s)s=!1;else if(o.name){let l=Q1[o.name];if(l&&l(o,r)||Nf.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of Gf(n,o.node))i.push(l);return!1}}),Ya.set(e,i),i}const _a=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function k1(n){let e=te(n.state).resolveInner(n.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&_a.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let i=[];for(let s=e;s;s=s.parent)Nf.has(s.name)&&(i=i.concat(Gf(n.state.doc,s)));return{options:i,from:t?e.from:n.pos,validFor:_a}}const zt=ui.define({name:"javascript",parser:y1.configure({props:[$s.add({IfStatement:ni({except:/^\s*({|else\b)/}),TryStatement:ni({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Np,SwitchBody:n=>{let e=n.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return n.baseIndent+(t?0:i?1:2)*n.unit},Block:jp({closing:"}"}),ArrowFunction:n=>n.baseIndent+n.unit,"TemplateString BlockComment":()=>null,"Statement Property":ni({except:/^\s*{/}),JSXElement(n){let e=/^\s*<\//.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},JSXEscape(n){let e=/\s*\}/.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},"JSXOpenTag JSXSelfClosingTag"(n){return n.column(n.node.from)+n.unit}}),Ps.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":qc,BlockComment(n){return{from:n.from+2,to:n.to-2}},JSXElement(n){let e=n.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=n.lastChild;return{from:e.to,to:t.type.isError?n.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(n){var e;let t=(e=n.firstChild)===null||e===void 0?void 0:e.nextSibling,i=n.lastChild;return!t||t.type.isError?null:{from:t.to,to:i.type.isError?n.to:i.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Ff={test:n=>/^JSX/.test(n.name),facet:Ec({commentTokens:{block:{open:"{/*",close:"*/}"}}})},w1=zt.configure({dialect:"ts"},"typescript"),v1=zt.configure({dialect:"jsx",props:[Lo.add(n=>n.isTop?[Ff]:void 0)]}),$1=zt.configure({dialect:"jsx ts",props:[Lo.add(n=>n.isTop?[Ff]:void 0)]},"typescript");let Hf=n=>({label:n,type:"keyword"});const Kf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Hf),P1=Kf.concat(["declare","implements","private","protected","public"].map(Hf));function qa(n={}){let e=n.jsx?n.typescript?$1:v1:n.typescript?w1:zt,t=n.typescript?b1.concat(P1):jf.concat(Kf);return new Do(e,[zt.data.of({autocomplete:nf(Uf,Eo(t))}),zt.data.of({autocomplete:k1}),n.jsx?Z1:[]])}function T1(n){for(;;){if(n.name=="JSXOpenTag"||n.name=="JSXSelfClosingTag"||n.name=="JSXFragmentTag")return n;if(n.name=="JSXEscape"||!n.parent)return null;n=n.parent}}function Va(n,e,t=n.length){for(let i=e?.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return n.sliceString(i.from,Math.min(i.to,t));return""}const C1=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Z1=$.inputHandler.of((n,e,t,i,s)=>{if((C1?n.composing:n.compositionStarted)||n.state.readOnly||e!=t||i!=">"&&i!="/"||!zt.isActiveAt(n.state,e,-1))return!1;let r=s(),{state:o}=r,l=o.changeByRange(a=>{var h;let{head:c}=a,f=te(o).resolveInner(c-1,-1),u;if(f.name=="JSXStartTag"&&(f=f.parent),!(o.doc.sliceString(c-1,c)!=i||f.name=="JSXAttributeValue"&&f.to>c)){if(i==">"&&f.name=="JSXFragmentTag")return{range:a,changes:{from:c,insert:"</>"}};if(i=="/"&&f.name=="JSXStartCloseTag"){let d=f.parent,O=d.parent;if(O&&d.from==c-2&&((u=Va(o.doc,O.firstChild,c))||((h=O.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let p=`${u}>`;return{range:y.cursor(c+p.length,-1),changes:{from:c,insert:p}}}}else if(i==">"){let d=T1(f);if(d&&d.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(c,c+2))&&(u=Va(o.doc,d,c)))return{range:a,changes:{from:c,insert:`</${u}>`}}}}return{range:a}});return l.changes.empty?!1:(n.dispatch([r,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),A1=ks({String:g.string,Number:g.number,"True False":g.bool,PropertyName:g.propertyName,Null:g.null,", :":g.separator,"[ ]":g.squareBracket,"{ }":g.brace}),M1=Oi.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[A1],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),R1=ui.define({name:"json",parser:M1.configure({props:[$s.add({Object:ni({except:/^\s*\}/}),Array:ni({except:/^\s*\]/})}),Ps.add({"Object Array":qc})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function X1(){return new Do(R1)}const L1=36,Ia=1,D1=2,It=3,cr=4,W1=5,E1=6,z1=7,B1=8,Y1=9,_1=10,q1=11,V1=12,I1=13,j1=14,N1=15,G1=16,U1=17,ja=18,F1=19,Jf=20,eu=21,Na=22,H1=23,K1=24;function oo(n){return n>=65&&n<=90||n>=97&&n<=122||n>=48&&n<=57}function J1(n){return n>=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70}function Zt(n,e,t){for(let i=!1;;){if(n.next<0)return;if(n.next==e&&!i){n.advance();return}i=t&&!i&&n.next==92,n.advance()}}function ex(n,e){e:for(;;){if(n.next<0)return;if(n.next==36){n.advance();for(let t=0;t<e.length;t++){if(n.next!=e.charCodeAt(t))continue e;n.advance()}if(n.next==36){n.advance();return}}else n.advance()}}function tx(n,e){let t="[{<(".indexOf(String.fromCharCode(e)),i=t<0?e:"]}>)".charCodeAt(t);for(;;){if(n.next<0)return;if(n.next==i&&n.peek(1)==39){n.advance(2);return}n.advance()}}function lo(n,e){for(;!(n.next!=95&&!oo(n.next));)e!=null&&(e+=String.fromCharCode(n.next)),n.advance();return e}function ix(n){if(n.next==39||n.next==34||n.next==96){let e=n.next;n.advance(),Zt(n,e,!1)}else lo(n)}function Ga(n,e){for(;n.next==48||n.next==49;)n.advance();e&&n.next==e&&n.advance()}function Ua(n,e){for(;;){if(n.next==46){if(e)break;e=!0}else if(n.next<48||n.next>57)break;n.advance()}if(n.next==69||n.next==101)for(n.advance(),(n.next==43||n.next==45)&&n.advance();n.next>=48&&n.next<=57;)n.advance()}function Fa(n){for(;!(n.next<0||n.next==10);)n.advance()}function Tt(n,e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)==n)return!0;return!1}const fr=` \r
|
|
24
24
|
`;function tu(n,e,t){let i=Object.create(null);i.true=i.false=W1,i.null=i.unknown=E1;for(let s of n.split(" "))s&&(i[s]=Jf);for(let s of e.split(" "))s&&(i[s]=eu);for(let s of(t||"").split(" "))s&&(i[s]=K1);return i}const nx="array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying ",sx="absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone ",ao={backslashEscapes:!1,hashComments:!1,spaceAfterDashes:!1,slashComments:!1,doubleQuotedStrings:!1,doubleDollarQuotedStrings:!1,unquotedBitLiterals:!1,treatBitsAsBytes:!1,charSetCasts:!1,plsqlQuotingMechanism:!1,operatorChars:"*+-%<>!=&|~^/",specialVar:"?",identifierQuotes:'"',caseInsensitiveIdentifiers:!1,words:tu(sx,nx)};function rx(n,e,t,i){let s={};for(let r in ao)s[r]=(n.hasOwnProperty(r)?n:ao)[r];return e&&(s.words=tu(e,t||"",i)),s}function iu(n){return new xi(e=>{var t;let{next:i}=e;if(e.advance(),Tt(i,fr)){for(;Tt(e.next,fr);)e.advance();e.acceptToken(L1)}else if(i==36&&n.doubleDollarQuotedStrings){let s=lo(e,"");e.next==36&&(e.advance(),ex(e,s),e.acceptToken(It))}else if(i==39||i==34&&n.doubleQuotedStrings)Zt(e,i,n.backslashEscapes),e.acceptToken(It);else if(i==35&&n.hashComments||i==47&&e.next==47&&n.slashComments)Fa(e),e.acceptToken(Ia);else if(i==45&&e.next==45&&(!n.spaceAfterDashes||e.peek(1)==32))Fa(e),e.acceptToken(Ia);else if(i==47&&e.next==42){e.advance();for(let s=1;;){let r=e.next;if(e.next<0)break;if(e.advance(),r==42&&e.next==47){if(s--,e.advance(),!s)break}else r==47&&e.next==42&&(s++,e.advance())}e.acceptToken(D1)}else if((i==101||i==69)&&e.next==39)e.advance(),Zt(e,39,!0),e.acceptToken(It);else if((i==110||i==78)&&e.next==39&&n.charSetCasts)e.advance(),Zt(e,39,n.backslashEscapes),e.acceptToken(It);else if(i==95&&n.charSetCasts)for(let s=0;;s++){if(e.next==39&&s>1){e.advance(),Zt(e,39,n.backslashEscapes),e.acceptToken(It);break}if(!oo(e.next))break;e.advance()}else if(n.plsqlQuotingMechanism&&(i==113||i==81)&&e.next==39&&e.peek(1)>0&&!Tt(e.peek(1),fr)){let s=e.peek(1);e.advance(2),tx(e,s),e.acceptToken(It)}else if(Tt(i,n.identifierQuotes)){const s=i==91?93:i;Zt(e,s,!1),e.acceptToken(F1)}else if(i==40)e.acceptToken(z1);else if(i==41)e.acceptToken(B1);else if(i==123)e.acceptToken(Y1);else if(i==125)e.acceptToken(_1);else if(i==91)e.acceptToken(q1);else if(i==93)e.acceptToken(V1);else if(i==59)e.acceptToken(I1);else if(n.unquotedBitLiterals&&i==48&&e.next==98)e.advance(),Ga(e),e.acceptToken(Na);else if((i==98||i==66)&&(e.next==39||e.next==34)){const s=e.next;e.advance(),n.treatBitsAsBytes?(Zt(e,s,n.backslashEscapes),e.acceptToken(H1)):(Ga(e,s),e.acceptToken(Na))}else if(i==48&&(e.next==120||e.next==88)||(i==120||i==88)&&e.next==39){let s=e.next==39;for(e.advance();J1(e.next);)e.advance();s&&e.next==39&&e.advance(),e.acceptToken(cr)}else if(i==46&&e.next>=48&&e.next<=57)Ua(e,!0),e.acceptToken(cr);else if(i==46)e.acceptToken(j1);else if(i>=48&&i<=57)Ua(e,!1),e.acceptToken(cr);else if(Tt(i,n.operatorChars)){for(;Tt(e.next,n.operatorChars);)e.advance();e.acceptToken(N1)}else if(Tt(i,n.specialVar))e.next==i&&e.advance(),ix(e),e.acceptToken(U1);else if(i==58||i==44)e.acceptToken(G1);else if(oo(i)){let s=lo(e,String.fromCharCode(i));e.acceptToken(e.next==46||e.peek(-s.length-1)==46?ja:(t=n.words[s.toLowerCase()])!==null&&t!==void 0?t:ja)}})}const nu=iu(ao),ox=Oi.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:"⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",maxTerm:38,nodeProps:[["isolate",-4,1,2,3,19,""]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:"RORO",tokenizers:[0,nu],topRules:{Script:[0,25]},tokenPrec:0});function ho(n){let e=n.cursor().moveTo(n.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function Ui(n,e){let t=n.sliceString(e.from,e.to),i=/^([`'"\[])(.*)([`'"\]])$/.exec(t);return i?i[2]:t}function as(n){return n&&(n.name=="Identifier"||n.name=="QuotedIdentifier")}function lx(n,e){if(e.name=="CompositeIdentifier"){let t=[];for(let i=e.firstChild;i;i=i.nextSibling)as(i)&&t.push(Ui(n,i));return t}return[Ui(n,e)]}function Ha(n,e){for(let t=[];;){if(!e||e.name!=".")return t;let i=ho(e);if(!as(i))return t;t.unshift(Ui(n,i)),e=ho(i)}}function ax(n,e){let t=te(n).resolveInner(e,-1),i=cx(n.doc,t);return t.name=="Identifier"||t.name=="QuotedIdentifier"||t.name=="Keyword"?{from:t.from,quoted:t.name=="QuotedIdentifier"?n.doc.sliceString(t.from,t.from+1):null,parents:Ha(n.doc,ho(t)),aliases:i}:t.name=="."?{from:e,quoted:null,parents:Ha(n.doc,t),aliases:i}:{from:e,quoted:null,parents:[],empty:!0,aliases:i}}const hx=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function cx(n,e){let t;for(let s=e;!t;s=s.parent){if(!s)return null;s.name=="Statement"&&(t=s)}let i=null;for(let s=t.firstChild,r=!1,o=null;s;s=s.nextSibling){let l=s.name=="Keyword"?n.sliceString(s.from,s.to).toLowerCase():null,a=null;if(!r)r=l=="from";else if(l=="as"&&o&&as(s.nextSibling))a=Ui(n,s.nextSibling);else{if(l&&hx.has(l))break;o&&as(s)&&(a=Ui(n,s))}a&&(i||(i=Object.create(null)),i[a]=lx(n,o)),o=/Identifier$/.test(s.name)?s:null}return i}function fx(n,e,t){return t.map(i=>({...i,label:i.label[0]==n?i.label:n+i.label+e,apply:void 0}))}const ux=/^\w*$/,dx=/^[`'"\[]?\w*[`'"\]]?$/;function Ka(n){return n.self&&typeof n.self.label=="string"}class Fo{constructor(e,t){this.idQuote=e,this.idCaseInsensitive=t,this.list=[],this.children=void 0}child(e){let t=this.children||(this.children=Object.create(null)),i=t[e];return i||(e&&!this.list.some(s=>s.label==e)&&this.list.push(Ja(e,"type",this.idQuote,this.idCaseInsensitive)),t[e]=new Fo(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let t=this.list.findIndex(i=>i.label==e.label);t>-1?this.list[t]=e:this.list.push(e)}addCompletions(e){for(let t of e)this.addCompletion(typeof t=="string"?Ja(t,"property",this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):Ka(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let t of Object.keys(e)){let i=e[t],s=null,r=t.replace(/\\?\./g,l=>l=="."?"\0":l).split("\0"),o=this;Ka(i)&&(s=i.self,i=i.children);for(let l=0;l<r.length;l++)s&&l==r.length-1&&o.addCompletion(s),o=o.child(r[l].replace(/\\\./g,"."));o.addNamespace(i)}}}function Ja(n,e,t,i){return new RegExp("^[a-z_][a-z_\\d]*$",i?"i":"").test(n)?{label:n,type:e}:{label:n,type:e,apply:t+n+su(t)}}function su(n){return n==="["?"]":n}function Ox(n,e,t,i,s,r){var o;let l=((o=r?.spec.identifierQuotes)===null||o===void 0?void 0:o[0])||'"',a=new Fo(l,!!r?.spec.caseInsensitiveIdentifiers),h=s?a.child(s):null;return a.addNamespace(n),e&&(h||a).addCompletions(e),t&&a.addCompletions(t),h&&a.addCompletions(h.list),i&&a.addCompletions((h||a).child(i).list),c=>{let{parents:f,from:u,quoted:d,empty:O,aliases:p}=ax(c.state,c.pos);if(O&&!c.explicit)return null;p&&f.length==1&&(f=p[f[0]]||f);let m=a;for(let b of f){for(;!m.children||!m.children[b];)if(m==a&&h)m=h;else if(m==h&&i)m=m.child(i);else return null;let S=m.maybeChild(b);if(!S)return null;m=S}let x=m.list;if(m==a&&p&&(x=x.concat(Object.keys(p).map(b=>({label:b,type:"constant"})))),d){let b=d[0],S=su(b),C=c.state.sliceDoc(c.pos,c.pos+1)==S;return{from:u,to:C?c.pos+1:void 0,options:fx(b,S,x),validFor:dx}}else return{from:u,options:x,validFor:ux}}}function px(n){return n==eu?"type":n==Jf?"keyword":"variable"}function mx(n,e,t){let i=Object.keys(n).map(s=>t(e?s.toUpperCase():s,px(n[s])));return nf(["QuotedIdentifier","String","LineComment","BlockComment","."],Eo(i))}let gx=ox.configure({props:[$s.add({Statement:ni()}),Ps.add({Statement(n,e){return{from:Math.min(n.from+100,e.doc.lineAt(n.from).to),to:n.to}},BlockComment(n){return{from:n.from+2,to:n.to-2}}}),ks({Keyword:g.keyword,Type:g.typeName,Builtin:g.standard(g.name),Bits:g.number,Bytes:g.string,Bool:g.bool,Null:g.null,Number:g.number,String:g.string,Identifier:g.name,QuotedIdentifier:g.special(g.string),SpecialVar:g.special(g.name),LineComment:g.lineComment,BlockComment:g.blockComment,Operator:g.operator,"Semi Punctuation":g.punctuation,"( )":g.paren,"{ }":g.brace,"[ ]":g.squareBracket})]});class hs{constructor(e,t,i){this.dialect=e,this.language=t,this.spec=i}get extension(){return this.language.extension}configureLanguage(e,t){return new hs(this.dialect,this.language.configure(e,t),this.spec)}static define(e){let t=rx(e,e.keywords,e.types,e.builtin),i=ui.define({name:"sql",parser:gx.configure({tokenizers:[{from:nu,to:iu(t)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new hs(t,i,e)}}function xx(n,e){return{label:n,type:e,boost:-1}}function yx(n,e=!1,t){return mx(n.dialect.words,e,t||xx)}function bx(n){return n.schema?Ox(n.schema,n.tables,n.schemas,n.defaultTable,n.defaultSchema,n.dialect||Ho):()=>null}function Sx(n){return n.schema?(n.dialect||Ho).language.data.of({autocomplete:bx(n)}):[]}function Qx(n={}){let e=n.dialect||Ho;return new Do(e.language,[Sx(n),e.language.data.of({autocomplete:yx(e,n.upperCaseKeywords,n.keywordCompletion)})])}const Ho=hs.define({});class eh{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Mt{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let s=i.facet(Fi).markerFilter;s&&(e=s(e,i));let r=e.slice().sort((d,O)=>d.from-O.from||d.to-O.to),o=new at,l=[],a=0,h=i.doc.iter(),c=0,f=i.doc.length;for(let d=0;;){let O=d==r.length?null:r[d];if(!O&&!l.length)break;let p,m;if(l.length)p=a,m=l.reduce((S,C)=>Math.min(S,C.to),O&&O.from>p?O.from:1e8);else{if(p=O.from,p>f)break;m=O.to,l.push(O),d++}for(;d<r.length;){let S=r[d];if(S.from==p&&(S.to>S.from||S.to==p))l.push(S),d++,m=Math.min(S.to,m);else{m=Math.min(S.from,m);break}}m=Math.min(m,f);let x=!1;if(l.some(S=>S.from==p&&(S.to==m||m==f))&&(x=p==m,!x&&m-p<10)){let S=p-(c+h.value.length);S>0&&(h.next(S),c=p);for(let C=p;;){if(C>=m){x=!0;break}if(!h.lineBreak&&c+h.value.length>C)break;C=c+h.value.length,c+=h.value.length,h.next()}}let b=Lx(l);if(x)o.add(p,p,Z.widget({widget:new Ax(b),diagnostics:l.slice()}));else{let S=l.reduce((C,Q)=>Q.markClass?C+" "+Q.markClass:C,"");o.add(p,m,Z.mark({class:"cm-lintRange cm-lintRange-"+b+S,diagnostics:l.slice(),inclusiveEnd:l.some(C=>C.to>m)}))}if(a=m,a==f)break;for(let S=0;S<l.length;S++)l[S].to<=a&&l.splice(S--,1)}let u=o.finish();return new Mt(u,t,Qt(u))}}function Qt(n,e=null,t=0){let i=null;return n.between(t,1e9,(s,r,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!i)i=new eh(s,r,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new eh(i.from,r,i.diagnostic)}}),i}function kx(n,e){let t=e.pos,i=e.end||t,s=n.state.facet(Fi).hideOn(n,t,i);if(s!=null)return s;let r=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(ru))||n.changes.touchesRange(r.from,Math.max(r.to,i)))}function wx(n,e){return n.field(Te,!1)?e:e.concat(M.appendConfig.of(Dx))}const ru=M.define(),Ko=M.define(),ou=M.define(),Te=ce.define({create(){return new Mt(Z.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,s=n.panel;if(n.selected){let r=e.changes.mapPos(n.selected.from,1);i=Qt(t,n.selected.diagnostic,r)||Qt(t,null,r)}!t.size&&s&&e.state.facet(Fi).autoPanel&&(s=null),n=new Mt(t,s,i)}for(let t of e.effects)if(t.is(ru)){let i=e.state.facet(Fi).autoPanel?t.value.length?Hi.open:null:n.panel;n=Mt.init(t.value,i,e.state)}else t.is(Ko)?n=new Mt(n.diagnostics,t.value?Hi.open:null,n.selected):t.is(ou)&&(n=new Mt(n.diagnostics,n.panel,t.value));return n},provide:n=>[qi.from(n,e=>e.panel),$.decorations.from(n,e=>e.diagnostics)]}),vx=Z.mark({class:"cm-lintRange cm-lintRange-active"});function $x(n,e,t){let{diagnostics:i}=n.state.field(Te),s,r=-1,o=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(a,h,{spec:c})=>{if(e>=a&&e<=h&&(a==h||(e>a||t>0)&&(e<h||t<0)))return s=c.diagnostics,r=a,o=h,!1});let l=n.state.facet(Fi).tooltipFilter;return s&&l&&(s=l(s,n.state)),s?{pos:r,end:o,above:n.state.doc.lineAt(r).to<o,create(){return{dom:Px(n,s)}}}:null}function Px(n,e){return _("ul",{class:"cm-tooltip-lint"},e.map(t=>au(n,t,!1)))}const Tx=n=>{let e=n.state.field(Te,!1);(!e||!e.panel)&&n.dispatch({effects:wx(n.state,[Ko.of(!0)])});let t=Zo(n,Hi.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},th=n=>{let e=n.state.field(Te,!1);return!e||!e.panel?!1:(n.dispatch({effects:Ko.of(!1)}),!0)},Cx=n=>{let e=n.state.field(Te,!1);if(!e)return!1;let t=n.state.selection.main,i=Qt(e.diagnostics,null,t.to+1);return!i&&(i=Qt(e.diagnostics,null,0),!i||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),lp(n,i.from,1,{tooltip:hu,until:s=>s.docChanged||s.newSelection.main.head<i.from||s.newSelection.main.head>i.to}),!0)},Zx=[{key:"Mod-Shift-m",run:Tx,preventDefault:!0},{key:"F8",run:Cx}],Fi=P.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...nt(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:ih,tooltipFilter:ih,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,s,r)=>e(i,s,r)||t(i,s,r):e:t,autoPanel:(e,t)=>e||t})}}});function ih(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function lu(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;i<t.length;i++){let s=t[i];if(/[a-zA-Z]/.test(s)&&!e.some(r=>r.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function au(n,e,t){var i;let s=t?lu(e.actions):[];return _("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},_("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((r,o)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let O=Qt(n.state.field(Te).diagnostics,e);O&&r.apply(n,O.from,O.to)},{name:h}=r,c=s[o]?h.indexOf(s[o]):-1,f=c<0?h:[h.slice(0,c),_("u",h.slice(c,c+1)),h.slice(c+1)],u=r.markClass?" "+r.markClass:"";return _("button",{type:"button",class:"cm-diagnosticAction"+u,onclick:a,onmousedown:a,"aria-label":` Action: ${h}${c<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&_("div",{class:"cm-diagnosticSource"},e.source))}class Ax extends Be{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return _("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class nh{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=au(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Hi{constructor(e){this.view=e,this.items=[];let t=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)th(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=lu(r.actions);for(let l=0;l<o.length;l++)if(o[l].toUpperCase().charCodeAt(0)==s.keyCode){let a=Qt(this.view.state.field(Te).diagnostics,r);a&&r.actions[l].apply(e,a.from,a.to)}}else return;s.preventDefault()}},i=s=>{for(let r=0;r<this.items.length;r++)this.items[r].dom.contains(s.target)&&this.moveSelection(r)};this.list=_("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:i}),this.dom=_("div",{class:"cm-panel-lint"},this.list,_("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>th(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Te).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Te),i=0,s=!1,r=null,o=new Set;for(e.between(0,this.view.state.doc.length,(l,a,{spec:h})=>{for(let c of h.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,u;for(let d=i;d<this.items.length;d++)if(this.items[d].diagnostic==c){f=d;break}f<0?(u=new nh(this.view,c),this.items.splice(i,0,u),s=!0):(u=this.items[f],f>i&&(this.items.splice(i,f-i),s=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),r=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),i++}});i<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new nh(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let h=a.height/this.list.offsetHeight;l.top<a.top?this.list.scrollTop-=(a.top-l.top)/h:l.bottom>a.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Te),i=Qt(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:ou.of(i)})}static open(e){return new Hi(e)}}function Mx(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(n)}</svg>')`}function Cn(n){return Mx(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${n}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const Rx=$.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Cn("#f11")},".cm-lintRange-warning":{backgroundImage:Cn("orange")},".cm-lintRange-info":{backgroundImage:Cn("#999")},".cm-lintRange-hint":{backgroundImage:Cn("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function Xx(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function Lx(n){let e="hint",t=1;for(let i of n){let s=Xx(i.severity);s>t&&(t=s,e=i.severity)}return e}const hu=op($x,{hideOn:kx}),Dx=[Te,$.decorations.compute([Te],n=>{let{selected:e,panel:t}=n.field(Te);return!e||!t||e.from==e.to?Z.none:Z.set([vx.range(e.from,e.to)])}),hu,Rx],sh=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class pi{constructor(e,t,i=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?l=>r(sh(l)):sh,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return me(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=fo(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Fe(e);let s=this.normalize(t);if(s.length)for(let r=0,o=i,l=!0;;r++){let a=s.charCodeAt(r),h=this.match(a,o,l,this.bufferPos+this.bufferStart,r==s.length-1);if(h)return this.value=h,this;if(r==s.length-1)break;l&&r<t.length&&t.charCodeAt(r)==a?o++:l=!1}}}match(e,t,i,s,r){let o=null;for(let l=0;l<this.matches.length;){let a=this.matches[l],h=!1;this.query.charCodeAt(a.index)==e&&(a.index==this.query.length-1?o={from:a.from,to:s,precise:r&&a.precise}:(a.index++,h=!0)),h?l++:this.matches.splice(l,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:t,to:s,precise:i&&r}:this.matches.push({from:t,index:1,precise:i})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(pi.prototype[Symbol.iterator]=function(){return this});const cu={from:-1,to:-1,match:/.*/.exec(""),precise:!0},Jo="gm"+(/x/.unicode==null?"":"u");class fu{constructor(e,t,i,s=0,r=e.length){if(this.text=e,this.to=r,this.curLine="",this.done=!1,this.value=cu,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new uu(e,t,i,s,r);this.re=new RegExp(t,Jo+(i?.ignoreCase?"i":"")),this.test=i?.test,this.iter=e.iter();let o=e.lineAt(s);this.curLineStart=o.from,this.matchPos=cs(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=cs(this.text,s+(i==s?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(i<s||i>this.value.to)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const ur=new WeakMap;class oi{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,i){let s=ur.get(e);if(!s||s.from>=i||s.to<=t){let l=new oi(t,e.sliceString(t,i));return ur.set(e,l),l}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to<i&&(r+=e.sliceString(s.to,i)),ur.set(e,new oi(o,r)),new oi(t,r.slice(t-o,i-o))}}class uu{constructor(e,t,i,s,r){this.text=e,this.to=r,this.done=!1,this.value=cu,this.matchPos=cs(e,s),this.re=new RegExp(t,Jo+(i?.ignoreCase?"i":"")),this.test=i?.test,this.flat=oi.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,s=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,precise:!0,match:t},this.matchPos=cs(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=oi.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(fu.prototype[Symbol.iterator]=uu.prototype[Symbol.iterator]=function(){return this});function Wx(n){try{return new RegExp(n,Jo),!0}catch{return!1}}function cs(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e<t.to&&(i=t.text.charCodeAt(e-t.from))>=56320&&i<57344;)e++;return e}const Ex=n=>{let{state:e}=n,t=String(e.doc.lineAt(n.state.selection.main.head).number),{close:i,result:s}=hp(n,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return s.then(r=>{let o=r&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.elements.line.value);if(!o){n.dispatch({effects:i});return}let l=e.doc.lineAt(e.selection.main.head),[,a,h,c,f]=o,u=c?+c.slice(1):0,d=h?+h:l.number;if(h&&f){let m=d/100;a&&(m=m*(a=="-"?-1:1)+l.number/e.doc.lines),d=Math.round(e.doc.lines*m)}else h&&a&&(d=d*(a=="-"?-1:1)+l.number);let O=e.doc.line(Math.max(1,Math.min(e.doc.lines,d))),p=y.cursor(O.from+Math.max(0,Math.min(u,O.length)));n.dispatch({effects:[i,$.scrollIntoView(p.from,{y:"center"})],selection:p})}),!0},zx={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Bx=P.define({combine(n){return nt(n,zx,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Yx(n){return[jx,Ix]}const _x=Z.mark({class:"cm-selectionMatch"}),qx=Z.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function rh(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=G.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=G.Word)}function Vx(n,e,t,i){return n(e.sliceDoc(t,t+1))==G.Word&&n(e.sliceDoc(i-1,i))==G.Word}const Ix=ee.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(Bx),{state:t}=n,i=t.selection;if(i.ranges.length>1)return Z.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return Z.none;let a=t.wordAt(s.head);if(!a)return Z.none;o=t.charCategorizer(s.head),r=t.sliceDoc(a.from,a.to)}else{let a=s.to-s.from;if(a<e.minSelectionLength||a>200)return Z.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(rh(o,t,s.from,s.to)&&Vx(o,t,s.from,s.to)))return Z.none}else if(r=t.sliceDoc(s.from,s.to),!r)return Z.none}let l=[];for(let a of n.visibleRanges){let h=new pi(t.doc,r,a.from,a.to);for(;!h.next().done;){let{from:c,to:f}=h.value;if((!o||rh(o,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(qx.range(c,f)):(c>=s.to||f<=s.from)&&l.push(_x.range(c,f)),l.length>e.maxMatches))return Z.none}}return Z.set(l)}},{decorations:n=>n.decorations}),jx=$.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Nx=({state:n,dispatch:e})=>{let{selection:t}=n,i=y.create(t.ranges.map(s=>n.wordAt(s.head)||y.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function Gx(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,l=new pi(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new pi(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(r){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const Ux=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return Nx({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=Gx(n,i);return s?(e(n.update({selection:n.selection.addRange(y.range(s.from,s.to),!1),effects:$.scrollIntoView(s.to)})),!0):!1},yi=P.define({combine(n){return nt(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new hy(e),scrollToMatch:e=>$.scrollIntoView(e)})}});class du{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Wx(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?`
|
|
25
25
|
`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new ty(this):new Kx(this)}getCursor(e,t=0,i){let s=e.doc?e:z.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?Gt(this,s,t,i):Nt(this,s,t,i)}}class Ou{constructor(e){this.spec=e}}function Fx(n,e,t){return(i,s,r,o)=>{if(t&&!t(i,s,r,o))return!1;let l=i>=o&&s<=o+r.length?r.slice(i-o,s-o):e.doc.sliceString(i,s);return n(l,e,i,s)}}function Nt(n,e,t,i){let s;return n.wholeWord&&(s=Hx(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(s=Fx(n.test,e,s)),new pi(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:r=>r.toLowerCase(),s)}function Hx(n,e){return(t,i,s,r)=>((r>t||r+s.length<i)&&(r=Math.max(0,t-2),s=n.sliceString(r,Math.min(n.length,i+2))),(e(fs(s,t-r))!=G.Word||e(us(s,t-r))!=G.Word)&&(e(us(s,i-r))!=G.Word||e(fs(s,i-r))!=G.Word))}class Kx extends Ou{constructor(e){super(e)}nextMatch(e,t,i){let s=Nt(this.spec,e,i,e.doc.length).nextOverlapping();if(s.done){let r=Math.min(e.doc.length,t+this.spec.unquoted.length);s=Nt(this.spec,e,0,r).nextOverlapping()}return s.done||s.value.from==t&&s.value.to==i?null:s.value}prevMatchInRange(e,t,i){for(let s=i;;){let r=Math.max(t,s-1e4-this.spec.unquoted.length),o=Nt(this.spec,e,r,s),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(r==t)return null;s-=1e4}}prevMatch(e,t,i){let s=this.prevMatchInRange(e,0,t);return s||(s=this.prevMatchInRange(e,Math.max(0,i-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=t||s.to!=i)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let i=Nt(this.spec,e,0,e.doc.length),s=[];for(;!i.next().done;){if(s.length>=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Nt(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Jx(n,e,t){return(i,s,r)=>(!t||t(i,s,r))&&n(r[0],e,i,s)}function Gt(n,e,t,i){let s;return n.wholeWord&&(s=ey(e.charCategorizer(e.selection.main.head))),n.test&&(s=Jx(n.test,e,s)),new fu(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:s},t,i)}function fs(n,e){return n.slice(se(n,e,!1),e)}function us(n,e){return n.slice(e,se(n,e))}function ey(n){return(e,t,i)=>!i[0].length||(n(fs(i.input,i.index))!=G.Word||n(us(i.input,i.index))!=G.Word)&&(n(us(i.input,i.index+i[0].length))!=G.Word||n(fs(i.input,i.index+i[0].length))!=G.Word)}class ty extends Ou{nextMatch(e,t,i){let s=Gt(this.spec,e,i,e.doc.length).next();return s.done&&(s=Gt(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=Gt(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let s=i.length;s>0;s--){let r=+i.slice(0,s);if(r>0&&r<e.match.length)return e.match[r]+i.slice(s)}return t})}matchAll(e,t){let i=Gt(this.spec,e,0,e.doc.length),s=[];for(;!i.next().done;){if(s.length>=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Gt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const Ki=M.define(),el=M.define(),pt=ce.define({create(n){return new dr(co(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Ki)?n=new dr(t.value.create(),n.panel):t.is(el)&&(n=new dr(n.query,t.value?tl:null));return n},provide:n=>qi.from(n,e=>e.panel)});class dr{constructor(e,t){this.query=e,this.panel=t}}const iy=Z.mark({class:"cm-searchMatch"}),ny=Z.mark({class:"cm-searchMatch cm-searchMatch-selected"}),sy=ee.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(pt))}update(n){let e=n.state.field(pt);(e!=n.startState.field(pt)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return Z.none;let{view:t}=this,i=new at;for(let s=0,r=t.visibleRanges,o=r.length;s<o;s++){let{from:l,to:a}=r[s];for(;s<o-1&&a>r[s+1].from-500;)a=r[++s].to;n.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?ny:iy)})}return i.finish()}},{decorations:n=>n.decorations});function ln(n){return e=>{let t=e.state.field(pt,!1);return t&&t.query.spec.valid?n(e,t):gu(e)}}const ds=ln((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let s=y.single(i.from,i.to),r=n.state.facet(yi);return n.dispatch({selection:s,effects:[il(n,i),r.scrollToMatch(s.main,n)],userEvent:"select.search"}),mu(n),!0}),Os=ln((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t,i,i);if(!s)return!1;let r=y.single(s.from,s.to),o=n.state.facet(yi);return n.dispatch({selection:r,effects:[il(n,s),o.scrollToMatch(r.main,n)],userEvent:"select.search"}),mu(n),!0}),ry=ln((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:y.create(t.map(i=>y.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),oy=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new pi(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(y.range(l.value.from,l.value.to))}return e(n.update({selection:y.create(r,o),userEvent:"select.search.matches"})),!0},oh=ln((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=r,l=[],a,h,c=[];o.precise?o.from==i&&o.to==s&&(h=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:h}),c.push($.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))):o=e.nextMatch(t,o.from,o.to);let f=n.state.changes(l);return o&&(a=y.single(o.from,o.to).map(f),c.push(il(n,o)),c.push(t.facet(yi).scrollToMatch(a.main,n))),n.dispatch({changes:f,selection:a,effects:c,userEvent:"input.replace"}),!0}),ly=ln((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let s of e.matchAll(n.state,1e9)){let{from:r,to:o,precise:l}=s;l&&t.push({from:r,to:o,insert:e.getReplacement(s)})}if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:$.announce.of(i),userEvent:"input.replace.all"}),!0});function tl(n){return n.state.facet(yi).createPanel(n)}function co(n,e){var t,i,s,r,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=n.facet(yi);return new du({search:((t=e?.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e?.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(r=e?.regexp)!==null&&r!==void 0?r:h.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function pu(n){let e=Zo(n,tl);return e&&e.dom.querySelector("[main-field]")}function mu(n){let e=pu(n);e&&e==n.root.activeElement&&e.select()}const gu=n=>{let e=n.state.field(pt,!1);if(e&&e.panel){let t=pu(n);if(t&&t!=n.root.activeElement){let i=co(n.state,e.query.spec);i.valid&&n.dispatch({effects:Ki.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[el.of(!0),e?Ki.of(co(n.state,e.query.spec)):M.appendConfig.of(fy)]});return!0},xu=n=>{let e=n.state.field(pt,!1);if(!e||!e.panel)return!1;let t=Zo(n,tl);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:el.of(!1)}),!0},ay=[{key:"Mod-f",run:gu,scope:"editor search-panel"},{key:"F3",run:ds,shift:Os,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ds,shift:Os,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:xu,scope:"editor search-panel"},{key:"Mod-Shift-l",run:oy},{key:"Mod-Alt-g",run:Ex},{key:"Mod-d",run:Ux,preventDefault:!0}];class hy{constructor(e){this.view=e;let t=this.query=e.state.field(pt).query.spec;this.commit=this.commit.bind(this),this.searchField=_("input",{value:t.search,placeholder:$e(e,"Find"),"aria-label":$e(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=_("input",{value:t.replace,placeholder:$e(e,"Replace"),"aria-label":$e(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=_("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=_("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=_("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return _("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=_("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>ds(e),[$e(e,"next")]),i("prev",()=>Os(e),[$e(e,"previous")]),i("select",()=>ry(e),[$e(e,"all")]),_("label",null,[this.caseField,$e(e,"match case")]),_("label",null,[this.reField,$e(e,"regexp")]),_("label",null,[this.wordField,$e(e,"by word")]),...e.state.readOnly?[]:[_("br"),this.replaceField,i("replace",()=>oh(e),[$e(e,"replace")]),i("replaceAll",()=>ly(e),[$e(e,"replace all")])],_("button",{name:"close",onclick:()=>xu(e),"aria-label":$e(e,"close"),type:"button"},["×"])])}commit(){let e=new du({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Ki.of(e)}))}keydown(e){PO(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Os:ds)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),oh(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(Ki)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(yi).top}}function $e(n,e){return n.state.phrase(e)}const Zn=30,An=/[\s\.,:;?!]/;function il(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-Zn),o=Math.min(s,t+Zn),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let a=0;a<Zn;a++)if(!An.test(l[a+1])&&An.test(l[a])){l=l.slice(a);break}}if(o!=s){for(let a=l.length-1;a>l.length-Zn;a--)if(!An.test(l[a-1])&&An.test(l[a])){l=l.slice(0,a);break}}return $.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const cy=$.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),fy=[pt,kt.low(sy),cy],uy=$.theme({"&":{backgroundColor:"var(--background)",color:"var(--foreground)",fontSize:"13px",border:"1px solid var(--border)",borderRadius:"0.5rem",overflow:"hidden",width:"100%"},"& .cm-scroller":{overflow:"auto"},"&.cm-focused":{outline:"2px solid var(--ring)",outlineOffset:"-1px"},".cm-content":{caretColor:"var(--foreground)",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',padding:"8px 0"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--foreground)"},".cm-selectionBackground, ::selection":{backgroundColor:"var(--accent)"},".cm-activeLine":{backgroundColor:"var(--accent)",opacity:"0.3"},".cm-gutters":{backgroundColor:"var(--muted)",color:"var(--muted-foreground)",border:"none",borderRight:"1px solid var(--border)"},".cm-activeLineGutter":{backgroundColor:"var(--accent)"},".cm-foldPlaceholder":{backgroundColor:"var(--muted)",color:"var(--muted-foreground)",border:"1px solid var(--border)"},".cm-tooltip":{backgroundColor:"var(--popover)",color:"var(--popover-foreground)",border:"1px solid var(--border)"},".cm-placeholder":{color:"var(--muted-foreground)"}},{dark:!1});function dy(n){switch(n){case"javascript":return qa({jsx:!0});case"typescript":return qa({jsx:!0,typescript:!0});case"sql":return Qx();default:return X1()}}function yy({value:n,onChange:e,readonly:t=!1,placeholder:i,className:s,minHeight:r="120px",language:o="json"}){const l=$t.useRef(null),a=$t.useRef(null),h=$t.useRef(e),c=$t.useRef(n),f=$t.useRef(o);return h.current=e,$t.useEffect(()=>{if(!l.current)return;const u=[bp(),_O(),Cg(),om(),RO(),z.allowMultipleSelections.of(!0),am(fm,{fallback:!0}),xm(),lg(),xg(),GO(),Yx(),Ss.of([...fg,...R0,...ay,...Eg,...im,...uf,...Zx]),dy(f.current),uy,$.theme({".cm-scroller":{minHeight:r}}),$.updateListener.of(p=>{p.docChanged&&h.current?.(p.state.doc.toString())})];t&&u.push(z.readOnly.of(!0),$.editable.of(!1)),i&&u.push(KO(i));const d=z.create({doc:c.current,extensions:u}),O=new $({state:d,parent:l.current});return a.current=O,()=>{O.destroy(),a.current=null}},[t,i,r]),$t.useEffect(()=>{const u=a.current;if(!u)return;const d=u.state.doc.toString();d!==n&&u.dispatch({changes:{from:0,to:d.length,insert:n}})},[n]),yu.jsx("div",{ref:l,className:bu("w-full",s)})}export{yy as C,Z as D,$ as E,P as F,yt as G,kt as P,at as R,ce as S,E as T,ee as V,Be as W,M as a,xy as b,ie as c,D as d,z as e,fm as f,dp as g,Xp as h,X1 as j,St as l,am as s};
|
|
26
|
-
//# sourceMappingURL=code-editor-
|
|
26
|
+
//# sourceMappingURL=code-editor-z1Sy_hiX.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{H as fe,cJ as ie,iA as ge,iB as oe,iC as ke,aV as ce,iG as je,iH as ve,iI as be,iJ as ye,r as j,u as re,iK as Ae,j as s,di as Ce,iL as _e,a7 as ue,dk as w,iM as Ne,dg as Q,df as Se,B as f,dh as Oe,i as E,de as ne,hI as De,hJ as Le,hK as we,hL as Me,hM as Pe,iN as $e,iO as ae,iP as Fe,L as Re,iQ as Ue,iR as ze,iS as Be,c4 as B,iT as Ie,iU as Ee,c3 as Ke,fp as Te,Z as G,gd as qe,e9 as Ve,$ as le,fq as Je,c8 as He,al as Ge,fr as Qe}from"./index-BoqrvLHQ.js";function es({connector:t,organizationId:l,ownerSlug:n,connections:r,openNewApp:g=!1,onNewAppHandled:c}){const{session:v}=fe(),{isAdmin:u,isLoading:C}=ie(l),M=ge(t.auth_schema),o=oe(t.auth_schema),_=ke(t.auth_schema),N=ce(l,{connectorKey:t.key,provider:o?.provider}),m=je(l,t.key),S=ve(),P=be(),p=ye(),[O,D]=j.useState(null),[b,y]=j.useState(null),[x,$]=j.useState([]),F=re(),k=j.useCallback(e=>F?.open({href:"",key:`oauth-apps:${t.key}`,title:"OAuth apps",connectorPanel:{section:"oauth-apps",connectorKey:t.key,organizationId:l,ownerSlug:n,newApp:e}}),[F,t.key,l,n]);j.useEffect(()=>{!g||!u||(k(!0),c?.())},[g,u,k,c]);const R=v?.user?.id;if(!R||C||N.isLoading||m.isPending)return null;const a=(N.data??[]).filter(e=>e.profile_kind==="oauth_app"),A=a.filter(e=>e.status==="active"),W=e=>I(e,t.key),U=A.find(W),de=new Set(r.map(e=>e.auth_profile_slug)),pe=(N.data??[]).filter(e=>e.profile_kind==="oauth_account"&&e.created_by===R&&!de.has(e.slug)),he=(m.data?.options??[]).filter(e=>e.kind!=="local"&&e.configured&&!!e.url),K=m.data?.options.find(e=>e.kind==="local"),T=m.isError||m.data?.cloud_status==="unavailable",d=[],X=e=>({key:`app:${e.slug}`,kind:"app",slug:e.slug,button:"Connect account",label:e.display_name,hint:"Your OAuth app",badge:W(e)?"Default":void 0,canLead:!!U||A.length===1}),q=u?A:U?[U]:[],V=U??(q.length===1?q[0]:void 0);V&&d.push(X(V));for(const e of he)d.push({key:`offer:${e.kind}:${e.managed_by_org??e.url}`,kind:"link",href:e.url,external:!0,note:e.instructions,button:e.label,label:e.label,hint:e.execution==="cloud"?"Runs in Lobu Cloud":"The cloud holds the grant; data syncs here",canLead:!0});_&&K?.configured&&K.url&&d.push({key:"install",kind:"link",href:Ae(K.url,{installShape:_.installShape}),external:!1,button:`Install ${t.name} app`,label:`Install ${t.name} app`,hint:"Installs on your provider account",canLead:!0});for(const e of q)e!==V&&d.push(X(e));for(const e of pe){const i=e.status==="active";d.push({key:`account:${e.slug}`,kind:"account",profile:e,button:i?"Use this account":"Reconnect",label:`${i?"Use":"Reconnect"} ${e.display_name}`,canLead:!1})}(!o||M.some(e=>e.type!=="oauth"))&&d.push({key:"create",kind:"create",button:"Add connection",label:_?"Use your own app":"Add connection",canLead:!0});const me=u&&o?{key:"new-app",kind:"new-app",button:"New OAuth app",label:"New OAuth app…",canLead:!0}:void 0,h=d.find(e=>e.canLead)??(d.length?void 0:me),Y=e=>p.begin(()=>S.mutateAsync({connector_key:t.key,app_auth_profile_slug:e,requested_scopes:o?Ue(o,x):[]})),J=e=>{if(D(null),e.kind==="app")o&&ae(o).length?y(e.slug):Y(e.slug);else if(e.kind==="account"){const{profile:i}=e;p.begin(()=>i.status==="active"?S.mutateAsync({connector_key:t.key,auth_profile_slug:i.slug}):P.mutateAsync({auth_profile_slug:i.slug}))}else e.kind==="new-app"?k(!0):e.kind==="link"&&D(e.note??null)},Z=(e,i)=>e.kind==="link"?s.jsx("a",{href:e.href,...e.external?{target:"_blank",rel:"noopener noreferrer"}:{},onClick:()=>J(e),children:i}):e.kind==="create"?s.jsx(Re,{to:"/$owner/connectors/create/$connectorKey",params:{owner:n,connectorKey:t.key},children:i}):null,z=d.length===1&&d[0]===h?[]:d,ee=!!(u&&o),H=z.length>0||T||ee&&(d.length>0||a.length>0),se=s.jsxs(Ce,{align:"end",className:"w-72",children:[z.length?s.jsx(_e,{children:"Connect with"}):null,z.map(e=>{const i=s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate",children:e.label}),e.hint?s.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:e.hint}):null]}),e.badge?s.jsx(ue,{variant:"secondary",className:"text-[10px]",children:e.badge}):null]}),L=Z(e,i);return L?s.jsx(w,{asChild:!0,children:L},e.key):s.jsx(w,{onSelect:()=>J(e),children:i},e.key)}),T?s.jsx(w,{onSelect:e=>{e.preventDefault(),m.refetch()},children:s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block",children:"Retry cloud options"}),s.jsx("span",{className:"block text-xs text-muted-foreground",children:"Cloud connection options could not be checked"})]})}):null,ee?s.jsxs(s.Fragment,{children:[z.length||T?s.jsx(Ne,{}):null,s.jsxs(w,{onSelect:()=>k(!0),children:[s.jsx(Q,{}),"New OAuth app…"]}),a.length?s.jsx(w,{onSelect:()=>k(!1),children:"Manage OAuth apps…"}):null]}):null]}),te=s.jsx(Se,{asChild:!0,children:s.jsxs(f,{size:"sm",variant:h?"default":"outline",className:E(h&&"rounded-l-none border-l border-primary-foreground/25 px-2"),"aria-label":h?"More ways to connect":void 0,children:[h?null:"Connect",s.jsx(Oe,{className:"size-3.5"})]})});return s.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1.5",children:[h?s.jsxs(ne,{children:[s.jsxs("div",{className:"inline-flex",children:[(()=>{const e=s.jsxs(s.Fragment,{children:[h.kind==="new-app"||h.kind==="create"?s.jsx(Q,{className:"size-3.5"}):null,h.button]}),i=Z(h,e);return s.jsx(f,{size:"sm",disabled:p.pending,className:E(H&&"rounded-r-none"),asChild:!!i,onClick:i?void 0:()=>J(h),children:i??e})})(),H?te:null]}),se]}):H?s.jsxs(ne,{children:[te,se]}):s.jsxs(s.Fragment,{children:[s.jsx(f,{size:"sm",disabled:!0,children:"Connect account"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Ask an administrator to set the workspace-default OAuth app."})]}),O?s.jsx("p",{className:"max-w-sm text-xs text-muted-foreground",children:O}):null,p.error?s.jsx("p",{role:"alert",className:"max-w-sm text-xs text-destructive",children:p.error}):null,p.continueUrl?s.jsx("a",{href:p.continueUrl,target:"_blank",rel:"noreferrer",className:"text-xs underline",children:"Continue authorization in your browser"}):null,o?s.jsx(De,{open:b!==null,onOpenChange:e=>!e&&y(null),children:s.jsxs(Le,{className:"max-w-md",children:[s.jsxs(we,{children:[s.jsx(Me,{children:"Permissions"}),s.jsxs(Pe,{children:["Choose what ",t.name," may access."]})]}),s.jsx($e,{requiredScopes:Fe(o),optionalScopes:ae(o),selectedOptionalScopes:x,onToggleOptionalScope:(e,i)=>$(L=>i?[...new Set([...L,e])]:L.filter(xe=>xe!==e))}),s.jsx("div",{className:"flex justify-end",children:s.jsx(f,{size:"sm",disabled:p.pending,onClick:()=>{const e=b;y(null),e&&Y(e)},children:"Continue"})})]})}):null]})}function ss({connector:t,organizationId:l,newApp:n}){const r=re(),{isAdmin:g}=ie(l),c=oe(t.auth_schema),v=ce(l,{connectorKey:t.key,provider:c?.provider});return c?s.jsx(We,{connector:t,oauthMethod:c,appProfiles:(v.data??[]).filter(u=>u.profile_kind==="oauth_app"),isAdmin:g,initialOpen:n,onClose:n?()=>r?.close():void 0,refetchProfiles:()=>void v.refetch()}):null}function We({initialOpen:t=!1,onClose:l,connector:n,oauthMethod:r,appProfiles:g,isAdmin:c,refetchProfiles:v}){const u=ze(),C=Be(),[M,o]=B(n.key,t&&c),[_,N]=j.useState(!1);j.useEffect(()=>{t&&c&&o(!0)},[t,c,o]);const m=`${Ie()}/connect/oauth/callback`,[S,P]=B(n.key,`${n.name} OAuth App`),[p,O]=B(n.key,""),[D,b]=B(n.key,null),y=Ee(r),x=Ke(`${n.key}:${M}`,Te(y),y),{values:$,setValues:F}=x,k=g.find(a=>I(a,n.key)),R=()=>{x.canSubmit&&(b(null),u.mutate({connector_key:n.key,profile_kind:"oauth_app",display_name:S.trim()||`${n.name} OAuth App`,slug:p.trim()||void 0,credentials:Ye(Qe($))},{onSuccess:a=>{const A=a.auth_profile?.slug;A&&!k&&C.mutate({connector_key:n.key,auth_profile_slug:A}),o(!1),l?.(),P(`${n.name} OAuth App`),O(""),v()},onError:a=>{b(a instanceof Error?a.message:"Failed to add OAuth app")}}))};return s.jsxs("div",{className:"min-w-0 space-y-4",children:[c&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(G,{children:"OAuth callback URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"min-w-0 flex-1 break-all text-xs",children:m}),s.jsxs(f,{variant:"outline",size:"sm",onClick:()=>{navigator.clipboard.writeText(m).then(()=>N(!0)).catch(()=>b("Could not copy the callback URL. Select and copy it above."))},children:[s.jsx(qe,{className:"mr-1.5 h-3.5 w-3.5"}),_?"Copied":"Copy callback URL"]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Register this exact URL in your provider’s app settings before saving the client configuration."})]}),g.length>0?s.jsx("div",{className:"space-y-2",children:g.map(a=>s.jsxs("div",{className:E(Ve,"flex flex-wrap items-center gap-3 p-3"),children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:a.display_name}),I(a,n.key)?s.jsx(ue,{variant:"secondary",className:"text-[10px]",children:"Default"}):null,s.jsx(Xe,{status:a.status})]}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.slug})]}),c&&!I(a,n.key)&&a.connector_key===n.key&&a.status==="active"?s.jsx(f,{variant:"outline",size:"sm",disabled:C.isPending,onClick:()=>C.mutate({connector_key:n.key,auth_profile_slug:a.slug}),children:"Set default"}):null]},a.slug))}):null,c?M?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(G,{htmlFor:"oauth-app-name",children:"Display name"}),s.jsx(le,{id:"oauth-app-name",value:S,onChange:a=>P(a.target.value)})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(G,{htmlFor:"oauth-app-slug",children:"Slug"}),s.jsx(le,{id:"oauth-app-slug",placeholder:"optional",value:p,onChange:a=>O(a.target.value)})]}),s.jsx(Je,{schema:x.revision??void 0,values:$,onValuesChange:F,fieldIdPrefix:"oauth-app-"}),s.jsx(He,{visible:x.hasConflict,onReload:x.reset}),D?s.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:D}):null,s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(f,{variant:"outline",size:"sm",disabled:u.isPending,onClick:()=>{o(!1),l?.()},children:"Cancel"}),s.jsxs(f,{size:"sm",disabled:u.isPending||!x.canSubmit,onClick:R,children:[u.isPending?s.jsx(Ge,{size:"md",className:"mr-1.5"}):null,"Save OAuth app"]})]})]}):s.jsxs(f,{variant:"outline",size:"sm",onClick:()=>o(!0),children:[s.jsx(Q,{className:"size-3.5"}),"Add OAuth app"]}):null]})}function I(t,l){return!!t.is_default_for_connector&&t.connector_key===l}function Xe({status:t}){const l=t==="active"?"text-green-500":t==="error"||t==="revoked"?"text-destructive":"text-amber-500";return s.jsxs("span",{className:E("text-xs",l),children:["· ",t]})}function Ye(t){const l={};for(const[n,r]of Object.entries(t))typeof r=="string"&&r.trim()?l[n]=r.trim():(typeof r=="number"||typeof r=="boolean")&&(l[n]=String(r));return l}export{Xe as A,es as C,ss as O};
|
|
2
|
+
//# sourceMappingURL=connect-menu-BWrAhMqO.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jA as r,j as t,aS as a}from"./index-BoqrvLHQ.js";import{a as s}from"./agent-connect-pages-DVq9nAR7.js";import"./connector-page-shell-an3SYLim.js";import"./copy-button-Xhh7ZnjO.js";import"./clients-Bf7ZgGro.js";import"./client-rows-Dd5YV8vn.js";function x(){const{owner:e,clientId:o}=r.useParams();return t.jsx(a,{owner:e,children:({ownerSlug:n})=>t.jsx(s,{owner:n,clientId:o})})}export{x as component};
|
|
2
|
+
//# sourceMappingURL=connect._clientId-CSPfwYIN.js.map
|
package/dist/owletto/dist/assets/{connected._clientId-BsDzltNz.js → connected._clientId-CuOeHafK.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e,
|
|
2
|
-
//# sourceMappingURL=connected._clientId-
|
|
1
|
+
import{j as e,a7 as R,c as E,L as N,ez as M,A as $,M as D,cJ as _,r as u,m as I,dO as K,eR as H,i5 as f,B as y,al as O,at as G,dt as Q,eY as J,du as V,dv as W,jz as Y,aS as q}from"./index-BoqrvLHQ.js";import{T as F,a as X,b as S,c as d,d as Z,e as x}from"./table-ZuYMOjVR.js";import{a as w,g as P}from"./client-rows-Dd5YV8vn.js";import{u as A}from"./client-activity-scopes-Aqdo6Pdr.js";import{u as z,a as ee}from"./clients-Bf7ZgGro.js";import{C as se}from"./connector-page-shell-an3SYLim.js";function te({isLive:n}){return e.jsx(R,{variant:n?"default":"secondary",className:`shrink-0 text-[10px] ${n?"":"text-muted-foreground"}`,title:n?"Live MCP transport":"No live MCP transport; activity history is retained",children:n?"Active":"Ended"})}function L({scopes:n,ownerSlug:i}){const l=E(),c=t=>({to:"/$owner/events",params:{owner:t.organizationId===null?"me":i},search:{client_ids:t.clientId,mcp_activity_id:t.activityId}}),r=t=>{l(c(t))};return e.jsx("div",{className:"rounded-lg border",children:e.jsxs(F,{children:[e.jsx(X,{children:e.jsxs(S,{children:[e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Conversation"}),e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Calls"}),e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Last action"}),e.jsx(d,{className:"px-3 py-1.5 text-xs",children:"Last active"}),e.jsx(d,{className:"w-8 px-3 py-1.5"})]})}),e.jsx(Z,{children:n.map(t=>e.jsxs(S,{className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>r(t),children:[e.jsx(x,{className:"max-w-0 px-3 py-2 text-xs font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{...c(t),onClick:o=>o.stopPropagation(),className:"truncate hover:underline",children:w(t)}),t.activityKind==="session"?e.jsx(te,{isLive:t.isLive}):null,t.unreadNotificationCount>0?e.jsxs(R,{variant:"secondary",className:"shrink-0 text-[10px]",children:[t.unreadNotificationCount," unread"]}):null]})}),e.jsx(x,{className:"px-3 py-2 font-mono text-xs text-muted-foreground",children:t.callCount}),e.jsx(x,{className:"max-w-0 truncate px-3 py-2 text-xs text-muted-foreground",children:t.lastAction||"—"}),e.jsx(x,{className:"px-3 py-2 text-xs text-muted-foreground",children:M(t.lastCallAt)}),e.jsx(x,{className:"px-3 py-2 text-right",children:e.jsx("button",{type:"button","aria-label":`View ${w(t)} activity`,className:"text-muted-foreground hover:text-foreground",tabIndex:-1,children:e.jsx($,{className:"h-3.5 w-3.5"})})})]},`${t.clientId}:${t.activityId}`))})]})})}function ne({ownerSlug:n,clientId:i}){const{orgContext:l}=D(),{isAdmin:c}=_(l.organizationId),{data:r=[],isLoading:t}=z(null),o=ee(),[B,h]=u.useState(!1),s=u.useMemo(()=>P(r),[r]).find(a=>a.clientIds.includes(i)),b=s?.clientIds??[],g=A({enabled:!!s,limit:100,clientIds:b,activityKind:"conversation",organizationId:l?.organizationId??null}),p=A({enabled:!!s,limit:100,clientIds:b,activityKind:"session",organizationId:l?.organizationId??null,refetchInterval:a=>a?5e3:!1}),m=g.data??[],v=p.data??[],T=u.useMemo(()=>r.filter(a=>s?.clientIds.includes(a.id)),[r,s]);if(t)return e.jsxs("div",{className:"space-y-4",children:[e.jsx(I,{className:"h-16 w-full rounded-lg"}),e.jsx(I,{className:"h-24 w-full rounded-lg"})]});if(!s)return e.jsx("p",{className:"text-sm text-muted-foreground",children:"This app isn't connected to this workspace, so its details aren't available."});const j=T[0],C=j?.details?.redirectUris??[],k=s.linkedUserEntitySlug?K(n,[{entity_type:"$member",slug:s.linkedUserEntitySlug}]):null,U=[{label:"Registered",value:s.title},{label:s.clientIds.length===1?"Client ID":"Client IDs",value:e.jsx("div",{className:"space-y-1",children:s.clientIds.map(a=>e.jsx("code",{className:"block break-all",children:a},a))})},...s.drivenBy&&s.drivenBy!==s.title?[{label:"Driven by",value:s.drivenBy}]:[],...j?.platform?[{label:"Software",value:j.platform}]:[],...C.length>0?[{label:"Redirects",value:C.join(", ")}]:[],{label:"Granted by",value:k&&s.linkedUser?e.jsx(N,{to:k,className:"font-medium text-primary hover:underline",children:s.linkedUser}):s.linkedUser??"—"},{label:"Last active",value:s.connected?H(s.lastSeenAt):"disconnected"},{label:"Registrations",value:String(s.clientIds.length)}];return e.jsxs("div",{className:"space-y-7",children:[e.jsx(f,{title:"Settings",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"overflow-hidden rounded-lg border text-xs",children:e.jsx("dl",{className:"divide-y",children:U.map(a=>e.jsxs("div",{className:"flex gap-3 px-3 py-2",children:[e.jsx("dt",{className:"w-28 shrink-0 text-muted-foreground",children:a.label}),e.jsx("dd",{className:"min-w-0 flex-1 break-words",children:a.value})]},a.label))})}),c&&s.connected?e.jsxs("div",{className:"space-y-2 rounded-lg border p-3",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Revoking disconnects every registration this app holds",s.clientIds.length>1?` (${s.clientIds.length} of them)`:""," ","and kills its live sessions. It can reconnect by authorizing again."]}),B?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",disabled:o.isPending,onClick:()=>o.mutate({clientId:s.clientIds[0],scope:"all"},{onSettled:()=>h(!1)}),children:o.isPending?"Revoking…":"Confirm revoke"}),e.jsx(y,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",disabled:o.isPending,onClick:()=>h(!1),children:"Cancel"})]}):e.jsx(y,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs text-destructive hover:text-destructive",onClick:()=>h(!0),children:"Revoke"})]}):null]})}),e.jsx(f,{title:"Conversations",count:m.length>0?String(m.length):void 0,children:g.isLoading||p.isLoading?e.jsxs("div",{className:"flex items-center py-4 text-xs text-muted-foreground",children:[e.jsx(O,{className:"mr-2"})," Loading client activity…"]}):g.isError||p.isError?e.jsx("p",{className:"py-3 text-xs text-destructive",children:"Could not load this app's activity."}):m.length===0?e.jsx("p",{className:"py-3 text-xs text-muted-foreground",children:"No recent conversations."}):e.jsx(L,{scopes:m,ownerSlug:n})}),v.length>0?e.jsx(f,{title:"Sessions",count:String(v.length),children:e.jsx(L,{scopes:v,ownerSlug:n})}):null]})}function ae({owner:n,clientId:i}){const{data:l=[]}=z(null),r=u.useMemo(()=>P(l).find(t=>t.clientIds.includes(i)),[i,l])?.title??"Connected agent";return e.jsx(G,{className:"gap-3 pt-2.5 pb-8",children:e.jsx(se,{header:e.jsx(Q,{breadcrumb:e.jsx(V,{crumbs:[e.jsx(N,{to:"/$owner",params:{owner:n},search:{section:"agent"},className:W,children:"Agents"},"agents")]}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:e.jsx(J,{name:r})}),title:r,caption:"An external agent connected to this workspace through Lobu. Review its Lobu conversations, activity, and access."}),children:e.jsx(ne,{ownerSlug:n,clientId:i},i)})})}function me(){const{owner:n,clientId:i}=Y.useParams();return e.jsx(q,{owner:n,children:({ownerSlug:l})=>e.jsx(ae,{owner:l,clientId:i})})}export{me as component};
|
|
2
|
+
//# sourceMappingURL=connected._clientId-CuOeHafK.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{bp as W,V as F,r as l,af as z,a4 as R,j as e,al as N,B as f,bq as V,br as q,bs as M,bt as Y,bu as E,$ as B,Q as D,F as G,ah as K,an as H,a0 as J}from"./index-BoqrvLHQ.js";import{s as Q}from"./index-BifR-LE9.js";import{C as X,a as Z,b as ee,c as ne}from"./card-CAPpY9P5.js";const C="__new_org__";function te(r){return r.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function w(r){return Q.find(i=>i.provider===r)?.name??r}function re(r,i){return`${window.location.origin}/connector/${encodeURIComponent(r)}/connection?${new URLSearchParams({ref:i})}`}function ie(r,i){return r==="account_already_linked_to_different_user"?`This ${i} account belongs to a different Lobu account than the one you are signed in to. Sign out, then continue with ${i} to finish setup as that account.`:`We couldn’t verify your ${i} account for this setup. Sign out, then continue with ${i} to try again.`}function oe(r,i){const[s,n]=l.useState({}),o=i?`${i}:${r}`:null;return l.useEffect(()=>{if(!o||!i||o in s)return;let c=!1;return D(i).then(h=>h.find(g=>g.key===r)?.name??null).catch(()=>null).then(h=>{c||n(g=>({...g,[o]:h}))}),()=>{c=!0}},[o,r,s,i]),o?s[o]??null:null}function I(r,i,s){if(!r)return"/";const n=`/${encodeURIComponent(r)}/`;if(s?.startsWith(n)){const o=new URL(s,window.location.origin);if(o.origin===window.location.origin&&o.pathname.startsWith(n))return o.pathname+o.search}return`${n}connectors/${encodeURIComponent(i)}?connected=1`}function se(r,i){return r==="not_admin"?`You must be an admin or owner to connect ${i} to Lobu.`:`You don't have permission to connect ${i} to Lobu.`}function T(r,i,s){switch(r){case"not_authorized":return se(i,s);case"no_pending":return`No Lobu install was found for ${s}. Add Lobu from the marketplace to get started.`;case"no_org":return`Your account has no Lobu organization to connect ${s} to.`;default:return`Something went wrong while connecting ${s}. Please try again.`}}function de(){const{name:r}=W({from:"/connector/$name/connection"}),{ref:i,error:s}=F({from:"/connector/$name/connection"}),[n,o]=l.useState({kind:"loading"}),[c,h]=l.useState(""),[g,O]=l.useState(""),[x,$]=l.useState(!1),[_,p]=l.useState(null),[j,k]=l.useState(null),u=oe(r,n.kind==="confirm"?n.orgs[0]?.slug??null:n.kind==="already_connected"?n.orgSlug:null),m=n.kind==="confirm"&&n.subjectKind||"connection",S=n.kind==="confirm"&&n.subjectName?n.subjectName:u?`this ${u} ${m}`:`this ${m}`,P=l.useCallback(async()=>{if(!i){o({kind:"error",message:"This connection link is missing its reference."});return}o({kind:"loading"});try{const t=await(await z(`${R}/api/connector/${encodeURIComponent(r)}/connection/claim-context?ref=${encodeURIComponent(i)}`,{credentials:"include"})).json();if("error"in t){if(t.error==="unauthenticated"){o({kind:"signin",signinProvider:t.signinProvider??r,linkAccount:!1});return}if(t.error==="signin_required"){o(s?{kind:"link_failed",signinProvider:t.signinProvider??r,error:s}:{kind:"signin",signinProvider:t.signinProvider??r,linkAccount:!0});return}o({kind:"error",message:T(t.error,t.code,"this connection")});return}if("alreadyConnected"in t){o({kind:"already_connected",orgSlug:t.orgSlug,nextUrl:t.nextUrl});return}h(t.orgs[0]?.slug??""),o({kind:"confirm",subjectKind:t.subjectKind,subjectName:t.subjectName,orgs:t.orgs})}catch{o({kind:"error",message:"We couldn’t load this connection link. Please try again."})}},[r,i,s]);l.useEffect(()=>{P()},[P]);const L=async d=>{if(!i)return;const t=re(r,i);if(n.kind==="signin"&&n.linkAccount){const y=await G.linkSocial({provider:d,callbackURL:t,errorCallbackURL:t});y.error&&o({kind:"error",message:y.error.message??"Couldn’t verify this account."});return}n.kind==="link_failed"&&await K(),await H.social({provider:d,callbackURL:t,errorCallbackURL:t})},U=async(d=!1)=>{if(!(!i||!c)){$(!0),p(null),k(null);try{let t=c;if(c===C){const b=g.trim();if(!b){p("Enter a name for the new organization.");return}const v=await J.create({name:b,slug:te(b)});if(v.error||!v.data){p(v.error?.message??"Couldn’t create the organization.");return}t=v.data.slug}const a=await(await z(`${R}/api/connector/${encodeURIComponent(r)}/connection/claim`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({ref:i,org:t,confirmMove:d})})).json();if("error"in a){if(a.error==="signin_required"||a.error==="unauthenticated"){o({kind:"signin",signinProvider:a.signinProvider??r,linkAccount:a.error==="signin_required"});return}if((a.error==="already_connected_elsewhere"||a.error==="enterprise_scope_overlap")&&a.existing){k({kind:a.error,existing:a.existing});return}p(T(a.error,a.code,S));return}window.location.href=I(a.orgSlug,r,a.nextUrl)}catch{p(`Something went wrong while connecting this ${m}. Please try again.`)}finally{$(!1)}}},A=n.kind==="signin"?"Sign in to continue":n.kind==="link_failed"?"Use a different account":n.kind==="error"?`Can’t connect this ${m}`:n.kind==="already_connected"?"Already connected":u?`Connect ${u} to Lobu`:"Connect to Lobu";return e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center",children:e.jsx("div",{className:"w-full max-w-md p-8",children:e.jsxs(X,{children:[e.jsx(Z,{children:e.jsx(ee,{asChild:!0,children:e.jsx("h1",{children:A})})}),e.jsxs(ne,{children:[n.kind==="loading"&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground",children:[e.jsx(N,{size:"lg"}),e.jsx("span",{children:"Checking this connection link…"})]}),n.kind==="error"&&e.jsx("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:n.message}),n.kind==="already_connected"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["This ",u?`${u} `:"",m," is already connected to Lobu."]}),e.jsx(f,{className:"w-full",asChild:!0,children:e.jsx("a",{href:I(n.orgSlug,r,n.nextUrl),children:n.nextUrl?"Choose an agent":"Open Lobu"})})]}),n.kind==="signin"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Sign in with ",w(n.signinProvider)," to verify you can connect this ",m,"."]}),e.jsxs(f,{className:"w-full",onClick:()=>L(n.signinProvider),children:["Sign in with ",w(n.signinProvider)]})]}),n.kind==="link_failed"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{role:"alert",className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:ie(n.error,w(n.signinProvider))}),e.jsxs(f,{className:"w-full",onClick:()=>L(n.signinProvider),children:["Sign out and continue with"," ",w(n.signinProvider)]})]}),n.kind==="confirm"&&(()=>{const d=n.subjectName||S;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Connecting"," ",e.jsx("strong",{className:"font-medium text-foreground",children:d}),". Choose the organization to connect it to:"]}),e.jsxs(V,{value:c,onValueChange:t=>{k(null),h(t)},children:[e.jsx(q,{children:e.jsx(M,{placeholder:"Select an organization"})}),e.jsxs(Y,{children:[n.orgs.map(t=>e.jsxs(E,{value:t.slug,children:[t.name,t.isPersonal&&e.jsx("span",{className:"ml-1 text-muted-foreground",children:"(personal)"})]},t.id)),e.jsx(E,{value:C,children:"+ New organization"})]})]}),c===C&&e.jsx(B,{autoFocus:!0,value:g,onChange:t=>O(t.target.value),placeholder:"New organization name","aria-label":"New organization name"}),_&&e.jsx("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:_}),j&&(()=>{const t=j.existing.orgName??j.existing.orgSlug??"another organization";return j.kind==="already_connected_elsewhere"?e.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-muted/40 px-3 py-3",children:[e.jsxs("p",{className:"text-sm text-foreground",children:[d," is already connected in"," ",e.jsx("strong",{className:"font-medium",children:t}),". Move it here?"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{className:"flex-1",onClick:()=>U(!0),disabled:x,children:x?e.jsxs(e.Fragment,{children:[e.jsx(N,{size:"lg"}),e.jsx("span",{className:"ml-2",children:"Moving…"})]}):"Move it here"}),e.jsx(f,{className:"flex-1",variant:"outline",onClick:()=>k(null),disabled:x,children:"Cancel"})]})]}):e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:["This ",u?`${u} `:"","Enterprise Grid is already connected in"," ",e.jsx("strong",{className:"font-medium",children:t}),"; ","connecting this ",m," here may change how its messages route. Contact support to move it."]})})(),e.jsx(f,{className:"w-full",onClick:()=>U(),disabled:x||j!==null||!c||c===C&&!g.trim(),children:x?e.jsxs(e.Fragment,{children:[e.jsx(N,{size:"lg"}),e.jsx("span",{className:"ml-2",children:"Connecting…"})]}):`Connect ${d}`})]})})()]})]})})})}export{de as component};
|
|
2
|
+
//# sourceMappingURL=connection-CVeHmDLs.js.map
|