agenttwin 0.3.30 → 0.3.31
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/api.js +1742 -722
- package/dist/dashboard/assets/next/static/chunks/{1ea884a0-6818287fac0ec05c.js → 0e5ce63c-707674e8817dc2e1.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/{4420.2441fa8cd44d835a.js → 1018.4871a8dd0f112c38.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/1255-d4ec8dbb0865c655.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/1937-6c86fddc443de922.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/2743-a0efd6f4aeb11cc5.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/{6873.a1a49381240b52fe.js → 4055.1056568a41510e92.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/424-83736cfafc224fc6.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/4343.023a18f52318dbad.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/{aebece07-770806e0a96e6d1a.js → 4bd1b696-f785427dddbba9fb.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/5258-3d0060b41be9ad97.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/6751.613adb085c9a5b06.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/6787-c85d7f794360b672.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/{3184-58f1813266829219.js → 7772-f2d773cd3e94eea6.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/{5361.3484c495efb7fd7d.js → 8975.5be81ec8b09e3b45.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/{3619.50dfe4e6fa916c52.js → 9013.0f2be1cc70029afa.js} +2 -2
- package/dist/dashboard/assets/next/static/chunks/{5203.7a7ffc7f10d89929.js → 9675.d833ca9b2d89cf8a.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/_not-found/page-5d1ba67144da5868.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/about/page-b09a2d8452522c20.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/account/password/{page-5775ac3aa5e4562f.js → page-b9ca284314cace59.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/api-policy/page-94d508052ae30dcb.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/auth/page-94d508052ae30dcb.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-mockoon/{page-9f75918bfb87ef66.js → page-11a5fdc2662ff51d.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-pact/{page-9f75918bfb87ef66.js → page-11a5fdc2662ff51d.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-testcontainers/{page-9f75918bfb87ef66.js → page-11a5fdc2662ff51d.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/agenttwin-vs-wiremock/{page-9f75918bfb87ef66.js → page-11a5fdc2662ff51d.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/choose-first-agent-workflow-test/page-11a5fdc2662ff51d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/blog/clean-baseline-before-fault-injection/page-11a5fdc2662ff51d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/blog/idempotency-keys-and-safe-retries/page-11a5fdc2662ff51d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/blog/keep-real-service-tests-with-digital-twins/page-11a5fdc2662ff51d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/blog/keploy-alternatives-for-database-and-payment-workflows/page-11a5fdc2662ff51d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/blog/layout-b095a34d742bd1fd.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/blog/page-11a5fdc2662ff51d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/blog/read-workflow-test-receipts/page-11a5fdc2662ff51d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/blog/reset-test-environment-between-runs/page-11a5fdc2662ff51d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/blog/simulate-timeouts-and-duplicate-events/page-11a5fdc2662ff51d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/blog/test-boundaries-for-ai-agents/page-11a5fdc2662ff51d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/blog/workflow-testing-evaluation-checklist/page-11a5fdc2662ff51d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/blog/write-better-workflow-assertions/page-11a5fdc2662ff51d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/compare/page-94d508052ae30dcb.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/contact/page-94d508052ae30dcb.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-820e83f47c1bfe08.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/page-8b436163bc85e182.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/demo/page-ef75632088a6ea0b.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/developers/page-94d508052ae30dcb.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-c25a8cab5ab065c4.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/dpa/page-94d508052ae30dcb.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/enterprise/page-91c6176f28dfdccd.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/guides/page-94d508052ae30dcb.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/layout-be64d3e50db4b7a9.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/login/page-7ee25051f2743d68.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/not-found-94d508052ae30dcb.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-26b963fb1dc02cc7.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/page-ede77810f4904ea5.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/{about/page-f24aa0d77f7fa73c.js → pricing/page-535834810dc4bee1.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/privacy/page-94d508052ae30dcb.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/sandbox/page-94d508052ae30dcb.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/scoreboard/page-94d508052ae30dcb.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/security/page-94d508052ae30dcb.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/signup/page-7ee25051f2743d68.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/sitemap.xml/route-11a5fdc2662ff51d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/status/{page-7ce6f0e1c434b71e.js → page-569ae36bd08d867c.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/subprocessors/page-94d508052ae30dcb.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/terms/page-94d508052ae30dcb.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/layout-b92ad482b0164f93.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/page-b1341267b2478360.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/layout-edb84faba63372b4.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/login/page-bfbe86a28adc6d30.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-79cd80f87d39230d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/page-1391f1ae01a91dc0.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/signup/page-bfbe86a28adc6d30.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/what-is-agenttwin/page-94d508052ae30dcb.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/{2db4c2cd.95079e665828175d.js → b468fba8.437b212aae4abcf8.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/framework-e54b663a2888b5de.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/main-5aa70aa3d6a46aa0.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/main-app-b4faf61f2e1c2b6d.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/pages/_app-6c8c2371b16a04b8.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/pages/_error-94812ad32cad7365.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/webpack-1d489f41fe167959.js +1 -0
- package/dist/dashboard/assets/next/static/css/542f5281c59de6ae.css +1 -0
- package/dist/dashboard/assets/next/static/css/605ac70c9cf7a260.css +1 -0
- package/dist/dashboard/assets/next/static/css/734b61a26b31f1d1.css +1 -0
- package/dist/dashboard/assets/next/static/m3owxChJUGxcTX3zU04al/_buildManifest.js +1 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/engine.js +5513 -1836
- package/dist/gateway.js +1740 -720
- package/dist/twins/catalog.json +115 -115
- package/dist/twins/packs/slack/NOTICE +1 -1
- package/dist/twins/packs/slack/index.mjs +8 -8
- package/dist/twins/packs/stripe/NOTICE +1 -1
- package/dist/twins/packs/stripe/index.mjs +8 -8
- package/dist/worker.js +1239 -478
- package/dist/world-host.js +1381 -519
- package/package.json +2 -1
- package/dist/dashboard/assets/next/static/c1e-XsXauzTgZ5LPHO9qr/_buildManifest.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/3023-f8f4e462320a2292.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/3054-936b20c5b915b68e.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/3269.db5e9e84abf99c14.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/5153-306b5cc29af7b739.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/5301-889a97570ecc1207.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/709.2c0acddce9cffa19.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/7796-dcf7d396bd4449c0.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/9029-e0ae3088a6980a25.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/_not-found/page-abd7b06b013b863e.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/api-policy/page-4a176798090a08d6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/auth/page-4a176798090a08d6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/choose-first-agent-workflow-test/page-9f75918bfb87ef66.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/clean-baseline-before-fault-injection/page-9f75918bfb87ef66.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/idempotency-keys-and-safe-retries/page-9f75918bfb87ef66.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/keep-real-service-tests-with-digital-twins/page-9f75918bfb87ef66.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/keploy-alternatives-for-database-and-payment-workflows/page-9f75918bfb87ef66.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/layout-c4d11b2d8403020d.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/page-9f75918bfb87ef66.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/read-workflow-test-receipts/page-9f75918bfb87ef66.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/reset-test-environment-between-runs/page-9f75918bfb87ef66.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/simulate-timeouts-and-duplicate-events/page-9f75918bfb87ef66.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/test-boundaries-for-ai-agents/page-9f75918bfb87ef66.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/workflow-testing-evaluation-checklist/page-9f75918bfb87ef66.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/write-better-workflow-assertions/page-9f75918bfb87ef66.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/compare/page-4a176798090a08d6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/contact/page-4a176798090a08d6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-039b7665231d6e02.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/page-651d698c70c4751d.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/demo/page-823ab04e4ce3d98d.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/developers/page-4a176798090a08d6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-257fb2b60b9c51ea.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/dpa/page-4a176798090a08d6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/enterprise/page-3b10665bd391180f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/guides/page-4a176798090a08d6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/layout-d5b27156a3186b08.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/login/page-b7e1d396e6b8f1e5.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/not-found-4a176798090a08d6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-3a50aee18c830bd9.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/page-f8bd9dabf8d184f0.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/pricing/page-832b691ac0762fc1.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/privacy/page-4a176798090a08d6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/sandbox/page-4a176798090a08d6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/security/page-4a176798090a08d6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/signup/page-b7e1d396e6b8f1e5.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/sitemap.xml/route-9f75918bfb87ef66.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/subprocessors/page-4a176798090a08d6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/terms/page-4a176798090a08d6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/layout-3578b0057d2de8c7.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/page-7bb4b6860280b5cc.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/layout-fbf2197ee73a9b94.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/login/page-830a35428306a169.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-8f78f1d869d1c720.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/page-e538ea410a189bb5.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/signup/page-830a35428306a169.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/what-is-agenttwin/page-4a176798090a08d6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/framework-7f628fc50ede2b81.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/main-app-c4d1f57d693643d5.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/main-b1bb212229d52cfe.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/pages/_app-76810ca023f9add6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/pages/_error-81ac1dd3015ead4e.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/webpack-cf0b56829d9b93b8.js +0 -1
- package/dist/dashboard/assets/next/static/css/83930ae013ae9eac.css +0 -1
- package/dist/dashboard/assets/next/static/css/846a3ee2626b9e08.css +0 -1
- /package/dist/dashboard/assets/next/static/{c1e-XsXauzTgZ5LPHO9qr → m3owxChJUGxcTX3zU04al}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9013],{1102:(e,t,r)=>{r.d(t,{B:()=>function e(t,r=!1){for(let n in t){if(void 0===t[n]&&delete t[n],!r)continue;let o=t[n];if("object"==typeof o&&null!==o){e(o,r);continue}if(Array.isArray(o))for(let t of o)e(t,r)}return t}})},1223:(e,t,r)=>{function n(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function o(e){let t="string"==typeof e?function(e){let t=e.trim();if(0===t.length)return null;let r=Array.from(new Set(t.split(/\s+/).map(e=>e.trim()).filter(Boolean)));if(0===r.length)return null;let o=r.map(n).join("|");return RegExp(`(${o})`,"gi")}(e):e;return{highlight(e){if(!t)return[{type:"text",content:e}];let r=[],n=0;for(let o of e.matchAll(t))n<o.index&&r.push({type:"text",content:e.substring(n,o.index)}),r.push({type:"text",content:o[0],styles:{highlight:!0}}),n=o.index+o[0].length;return n<e.length&&r.push({type:"text",content:e.substring(n)}),r}}}r.d(t,{r:()=>o})},9013:(e,t,r)=>{r.d(t,{search:()=>tT});var n=r(1102),o=r(1223);let i={arabic:"ar",armenian:"am",bulgarian:"bg",czech:"cz",danish:"dk",dutch:"nl",english:"en",finnish:"fi",french:"fr",german:"de",greek:"gr",hungarian:"hu",indian:"in",indonesian:"id",irish:"ie",italian:"it",lithuanian:"lt",nepali:"np",norwegian:"no",portuguese:"pt",romanian:"ro",russian:"ru",serbian:"rs",slovenian:"ru",spanish:"es",swedish:"se",tamil:"ta",turkish:"tr",ukrainian:"uk",sanskrit:"sk"},s={dutch:/[^A-Za-zàèéìòóù0-9_'-]+/gim,english:/[^A-Za-zàèéìòóù0-9_'-]+/gim,french:/[^a-z0-9äâàéèëêïîöôùüûœç-]+/gim,italian:/[^A-Za-zàèéìòóù0-9_'-]+/gim,norwegian:/[^a-z0-9_æøåÆØÅäÄöÖüÜ]+/gim,portuguese:/[^a-z0-9à-úÀ-Ú]/gim,russian:/[^a-z0-9а-яА-ЯёЁ]+/gim,spanish:/[^a-z0-9A-Zá-úÁ-ÚñÑüÜ]+/gim,swedish:/[^a-z0-9_åÅäÄöÖüÜ-]+/gim,german:/[^a-z0-9A-ZäöüÄÖÜß]+/gim,finnish:/[^a-z0-9äöÄÖ]+/gim,danish:/[^a-z0-9æøåÆØÅ]+/gim,hungarian:/[^a-z0-9áéíóöőúüűÁÉÍÓÖŐÚÜŰ]+/gim,romanian:/[^a-z0-9ăâîșțĂÂÎȘȚ]+/gim,serbian:/[^a-z0-9čćžšđČĆŽŠĐ]+/gim,turkish:/[^a-z0-9çÇğĞıİöÖşŞüÜ]+/gim,lithuanian:/[^a-z0-9ąčęėįšųūžĄČĘĖĮŠŲŪŽ]+/gim,arabic:/[^a-z0-9أ-ي]+/gim,nepali:/[^a-z0-9अ-ह]+/gim,irish:/[^a-z0-9áéíóúÁÉÍÓÚ]+/gim,indian:/[^a-z0-9अ-ह]+/gim,armenian:/[^a-z0-9ա-ֆ]+/gim,greek:/[^a-z0-9α-ωά-ώ]+/gim,indonesian:/[^a-z0-9]+/gim,ukrainian:/[^a-z0-9а-яА-ЯіїєІЇЄ]+/gim,slovenian:/[^a-z0-9螚ȎŠ]+/gim,bulgarian:/[^a-z0-9а-яА-Я]+/gim,tamil:/[^a-z0-9அ-ஹ]+/gim,sanskrit:/[^a-z0-9A-Zāīūṛḷṃṁḥśṣṭḍṇṅñḻḹṝ]+/gim,czech:/[^A-Z0-9a-zěščřžýáíéúůóťďĚŠČŘŽÝÁÍÉÓÚŮŤĎ-]+/gim},l=Object.keys(i);var a=r(5704);let u=Date.now().toString().slice(5),c=0,f=BigInt(1e3),d=BigInt(1e6),h=BigInt(1e9);function p(e,t){if(t.length<65535)Array.prototype.push.apply(e,t);else{let r=t.length;for(let n=0;n<r;n+=65535)Array.prototype.push.apply(e,t.slice(n,n+65535))}}function g(){return BigInt(Math.floor(1e6*performance.now()))}function m(e){return("number"==typeof e&&(e=BigInt(e)),e<f)?`${e}ns`:e<d?`${e/f}μs`:e<h?`${e/d}ms`:`${e/h}s`}function y(){return"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?g():void 0!==a&&a.release&&"node"===a.release.name||void 0!==a&&"function"==typeof a?.hrtime?.bigint?a.hrtime.bigint():"undefined"!=typeof performance?g():BigInt(0)}function b(){return`${u}-${c++}`}function S(e,t){return void 0===Object.hasOwn?Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0:Object.hasOwn(e,t)?e[t]:void 0}function I(e,t){return t[1]===e[1]?e[0]-t[0]:t[1]-e[1]}function w(e,t){let r={},n=t.length;for(let o=0;o<n;o++){let n=t[o],i=n.split("."),s=e,l=i.length;for(let e=0;e<l;e++)if("object"==typeof(s=s[i[e]])){if(null!==s&&"lat"in s&&"lon"in s&&"number"==typeof s.lat&&"number"==typeof s.lon){s=r[n]=s;break}else if(!Array.isArray(s)&&null!==s&&e===l-1){s=void 0;break}}else if((null===s||"object"!=typeof s)&&e<l-1){s=void 0;break}void 0!==s&&(r[n]=s)}return r}function O(e,t){return w(e,[t])[t]}let N={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344};function T(e,t){let r=N[t];if(void 0===r)throw Error(M("INVALID_DISTANCE_SUFFIX",e).message);return e*r}function v(e,t){e.hits=e.hits.map(e=>({...e,document:{...e.document,...t.reduce((e,t)=>{let r=t.split("."),n=r.pop(),o=e;for(let e of r)o[e]=o[e]??{},o=o[e];return o[n]=null,e},e.document)}}))}function _(e){return Array.isArray(e)?e.some(e=>_(e)):e?.constructor?.name==="AsyncFunction"}let D="intersection"in new Set;function A(...e){if(0===e.length)return new Set;if(1===e.length)return e[0];if(2===e.length){let t=e[0],r=e[1];if(D)return t.intersection(r);let n=new Set,o=t.size<r.size?t:r,i=o===t?r:t;for(let e of o)i.has(e)&&n.add(e);return n}let t={index:0,size:e[0].size};for(let r=1;r<e.length;r++)e[r].size<t.size&&(t.index=r,t.size=e[r].size);if(D){let r=e[t.index];for(let n=0;n<e.length;n++)n!==t.index&&(r=r.intersection(e[n]));return r}let r=e[t.index];for(let n=0;n<e.length;n++){if(n===t.index)continue;let o=e[n];for(let e of r)o.has(e)||r.delete(e)}return r}let E="union"in new Set;function k(e,t){return E?e?e.union(t):t:new Set(e?[...e,...t]:t)}let P=l.join("\n - "),R={NO_LANGUAGE_WITH_CUSTOM_TOKENIZER:"Do not pass the language option to create when using a custom tokenizer.",LANGUAGE_NOT_SUPPORTED:`Language "%s" is not supported.
|
|
2
2
|
Supported languages are:
|
|
3
3
|
- ${P}`,INVALID_STEMMER_FUNCTION_TYPE:"config.stemmer property must be a function.",MISSING_STEMMER:'As of version 1.0.0 @orama/orama does not ship non English stemmers by default. To solve this, please explicitly import and specify the "%s" stemmer from the package @orama/stemmers. See https://docs.orama.com/docs/orama-js/text-analysis/stemming for more information.',CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY:"Custom stop words array must only contain strings.",UNSUPPORTED_COMPONENT:'Unsupported component "%s".',COMPONENT_MUST_BE_FUNCTION:'The component "%s" must be a function.',COMPONENT_MUST_BE_FUNCTION_OR_ARRAY_FUNCTIONS:'The component "%s" must be a function or an array of functions.',INVALID_SCHEMA_TYPE:'Unsupported schema type "%s" at "%s". Expected "string", "boolean" or "number" or array of them.',DOCUMENT_ID_MUST_BE_STRING:'Document id must be of type "string". Got "%s" instead.',DOCUMENT_ALREADY_EXISTS:'A document with id "%s" already exists.',DOCUMENT_DOES_NOT_EXIST:'A document with id "%s" does not exists.',MISSING_DOCUMENT_PROPERTY:'Missing searchable property "%s".',INVALID_DOCUMENT_PROPERTY:'Invalid document property "%s": expected "%s", got "%s"',UNKNOWN_INDEX:'Invalid property name "%s". Expected a wildcard string ("*") or array containing one of the following properties: %s',INVALID_BOOST_VALUE:"Boost value must be a number greater than, or less than 0.",INVALID_FILTER_OPERATION:"You can only use one operation per filter, you requested %d.",SCHEMA_VALIDATION_FAILURE:'Cannot insert document due schema validation failure on "%s" property.',INVALID_SORT_SCHEMA_TYPE:'Unsupported sort schema type "%s" at "%s". Expected "string" or "number".',CANNOT_SORT_BY_ARRAY:'Cannot configure sort for "%s" because it is an array (%s).',UNABLE_TO_SORT_ON_UNKNOWN_FIELD:'Unable to sort on unknown field "%s". Allowed fields: %s',SORT_DISABLED:"Sort is disabled. Please read the documentation at https://docs.orama.com/docs/orama-js for more information.",UNKNOWN_GROUP_BY_PROPERTY:'Unknown groupBy property "%s".',INVALID_GROUP_BY_PROPERTY:'Invalid groupBy property "%s". Allowed types: "%s", but given "%s".',UNKNOWN_FILTER_PROPERTY:'Unknown filter property "%s".',UNKNOWN_VECTOR_PROPERTY:'Unknown vector property "%s". Make sure the property exists in the schema and is configured as a vector.',INVALID_VECTOR_SIZE:'Vector size must be a number greater than 0. Got "%s" instead.',INVALID_VECTOR_VALUE:'Vector value must be a number greater than 0. Got "%s" instead.',INVALID_INPUT_VECTOR:`Property "%s" was declared as a %s-dimensional vector, but got a %s-dimensional vector instead.
|
|
4
4
|
Input vectors must be of the size declared in the schema, as calculating similarity between vectors of different sizes can lead to unexpected results.`,WRONG_SEARCH_PROPERTY_TYPE:'Property "%s" is not searchable. Only "string" properties are searchable.',FACET_NOT_SUPPORTED:'Facet doens\'t support the type "%s".',INVALID_DISTANCE_SUFFIX:'Invalid distance suffix "%s". Valid suffixes are: cm, m, km, mi, yd, ft.',INVALID_SEARCH_MODE:'Invalid search mode "%s". Valid modes are: "fulltext", "vector", "hybrid".',MISSING_VECTOR_AND_SECURE_PROXY:"No vector was provided and no secure proxy was configured. Please provide a vector or configure an Orama Secure Proxy to perform hybrid search.",MISSING_TERM:'"term" is a required parameter when performing hybrid search. Please provide a search term.',INVALID_VECTOR_INPUT:'Invalid "vector" property. Expected an object with "value" and "property" properties, but got "%s" instead.',PLUGIN_CRASHED:"A plugin crashed during initialization. Please check the error message for more information:",PLUGIN_SECURE_PROXY_NOT_FOUND:`Could not find '@orama/secure-proxy-plugin' installed in your Orama instance.
|
|
@@ -7,4 +7,4 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
7
7
|
`,PLUGIN_SECURE_PROXY_MISSING_CHAT_MODEL:`Could not find a chat model defined in the secure proxy plugin configuration.
|
|
8
8
|
Please provide a chat model before proceeding with creating an answer session.
|
|
9
9
|
Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#plugin-secure-proxy
|
|
10
|
-
`,ANSWER_SESSION_LAST_MESSAGE_IS_NOT_ASSISTANT:"The last message in the session is not an assistant message. Cannot regenerate non-assistant messages.",PLUGIN_COMPONENT_CONFLICT:'The component "%s" is already defined. The plugin "%s" is trying to redefine it.'};function M(e,...t){let r=Error(function(e,...t){return e.replace(/%(?:(?<position>\d+)\$)?(?<width>-?\d*\.?\d*)(?<type>[dfs])/g,function(...e){let{width:r,type:n,position:o}=e[e.length-1],i=o?t[Number.parseInt(o)-1]:t.shift(),s=""===r?0:Number.parseInt(r);switch(n){case"d":return i.toString().padStart(s,"0");case"f":{let e=i,[t,n]=r.split(".").map(e=>Number.parseFloat(e));return"number"==typeof n&&n>=0&&(e=e.toFixed(n)),"number"==typeof t&&t>=0?e.toString().padStart(s,"0"):e.toString()}case"s":return s<0?i.toString().padEnd(-s," "):i.toString().padStart(s," ");default:return i}})}(R[e]??`Unsupported Orama Error code: ${e}`,...t));return r.code=e,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}function x(e){return{raw:Number(e),formatted:m(e)}}function C(e){if(e.id){if("string"!=typeof e.id)throw M("DOCUMENT_ID_MUST_BE_STRING",typeof e.id);return e.id}return b()}let U={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},z={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"};function L(e){return"string"==typeof e&&/^vector\[\d+\]$/.test(e)}function B(e){return"string"==typeof e&&U[e]}function V(e){let t=Number(e.slice(7,-1));switch(!0){case isNaN(t):throw M("INVALID_VECTOR_VALUE",e);case t<=0:throw M("INVALID_VECTOR_SIZE",e);default:return t}}function W(e){return{internalIdToId:e.internalIdToId}}function j(e,t){let{internalIdToId:r}=t;e.internalDocumentIDStore.idToInternalId.clear(),e.internalDocumentIDStore.internalIdToId=[];let n=r.length;for(let t=0;t<n;t++){let n=r[t];e.internalDocumentIDStore.idToInternalId.set(n,t+1),e.internalDocumentIDStore.internalIdToId.push(n)}}function F(e,t){if("string"==typeof t){let r=e.idToInternalId.get(t);if(r)return r;let n=e.idToInternalId.size+1;return e.idToInternalId.set(t,n),e.internalIdToId.push(t),n}return t>e.internalIdToId.length?F(e,t.toString()):t}function $(e,t){if(e.internalIdToId.length<t)throw Error(`Invalid internalId ${t}`);return e.internalIdToId[t-1]}function G(e,t){return{sharedInternalDocumentStore:t,docs:{},count:0}}function J(e,t){let r=F(e.sharedInternalDocumentStore,t);return e.docs[r]}function Y(e,t){let r=t.length,n=Array.from({length:r});for(let o=0;o<r;o++){let r=F(e.sharedInternalDocumentStore,t[o]);n[o]=e.docs[r]}return n}function H(e){return e.docs}function K(e,t,r,n){return void 0===e.docs[r]&&(e.docs[r]=n,e.count++,!0)}function q(e,t){let r=F(e.sharedInternalDocumentStore,t);return void 0!==e.docs[r]&&(delete e.docs[r],e.count--,!0)}function X(e){return e.count}function Z(e,t){return{docs:t.docs,count:t.count,sharedInternalDocumentStore:e}}function Q(e){return{docs:e.docs,count:e.count}}let ee=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeUpsert","afterUpsert","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeUpsertMultiple","afterUpsertMultiple","beforeLoad","afterLoad","afterCreate"],et=["tokenizer","index","documentsStore","sorter","pinning"],er=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"];function en(e,t,r,n,o){if(e.some(_))return(async()=>{for(let i of e)await i(t,r,n,o)})();for(let i of e)i(t,r,n,o)}function eo(e,t,r,n){if(e.some(_))return(async()=>{for(let o of e)await o(t,r,n)})();for(let o of e)o(t,r,n)}class ei{k;v;l=null;r=null;h=1;constructor(e,t){this.k=e,this.v=new Set(t)}updateHeight(){this.h=Math.max(ei.getHeight(this.l),ei.getHeight(this.r))+1}static getHeight(e){return e?e.h:0}getBalanceFactor(){return ei.getHeight(this.l)-ei.getHeight(this.r)}rotateLeft(){let e=this.r;return this.r=e.l,e.l=this,this.updateHeight(),e.updateHeight(),e}rotateRight(){let e=this.l;return this.l=e.r,e.r=this,this.updateHeight(),e.updateHeight(),e}toJSON(){return{k:this.k,v:Array.from(this.v),l:this.l?this.l.toJSON():null,r:this.r?this.r.toJSON():null,h:this.h}}static fromJSON(e){let t=new ei(e.k,e.v);return t.l=e.l?ei.fromJSON(e.l):null,t.r=e.r?ei.fromJSON(e.r):null,t.h=e.h,t}}class es{root=null;insertCount=0;constructor(e,t){void 0!==e&&void 0!==t&&(this.root=new ei(e,t))}insert(e,t,r=1e3){this.root=this.insertNode(this.root,e,t,r)}insertMultiple(e,t,r=1e3){for(let n of t)this.insert(e,n,r)}rebalance(){this.root&&(this.root=this.rebalanceNode(this.root))}toJSON(){return{root:this.root?this.root.toJSON():null,insertCount:this.insertCount}}static fromJSON(e){let t=new es;return t.root=e.root?ei.fromJSON(e.root):null,t.insertCount=e.insertCount||0,t}insertNode(e,t,r,n){if(null===e)return new ei(t,[r]);let o=[],i=e,s=null;for(;null!==i;)if(o.push({parent:s,node:i}),t<i.k)if(null===i.l){i.l=new ei(t,[r]),o.push({parent:i,node:i.l});break}else s=i,i=i.l;else if(!(t>i.k))return i.v.add(r),e;else if(null===i.r){i.r=new ei(t,[r]),o.push({parent:i,node:i.r});break}else s=i,i=i.r;let l=!1;this.insertCount++%n==0&&(l=!0);for(let t=o.length-1;t>=0;t--){let{parent:r,node:n}=o[t];if(n.updateHeight(),l){let t=this.rebalanceNode(n);r?r.l===n?r.l=t:r.r===n&&(r.r=t):e=t}}return e}rebalanceNode(e){let t=e.getBalanceFactor();if(t>1){if(e.l&&e.l.getBalanceFactor()>=0)return e.rotateRight();else if(e.l)return e.l=e.l.rotateLeft(),e.rotateRight()}if(t<-1){if(e.r&&0>=e.r.getBalanceFactor())return e.rotateLeft();else if(e.r)return e.r=e.r.rotateRight(),e.rotateLeft()}return e}find(e){let t=this.findNodeByKey(e);return t?t.v:null}contains(e){return null!==this.find(e)}getSize(){let e=0,t=[],r=this.root;for(;r||t.length>0;){for(;r;)t.push(r),r=r.l;r=t.pop(),e++,r=r.r}return e}isBalanced(){if(!this.root)return!0;let e=[this.root];for(;e.length>0;){let t=e.pop();if(Math.abs(t.getBalanceFactor())>1)return!1;t.l&&e.push(t.l),t.r&&e.push(t.r)}return!0}remove(e){this.root=this.removeNode(this.root,e)}removeDocument(e,t){let r=this.findNodeByKey(e);r&&(1===r.v.size?this.root=this.removeNode(this.root,e):r.v=new Set([...r.v.values()].filter(e=>e!==t)))}findNodeByKey(e){let t=this.root;for(;t;)if(e<t.k)t=t.l;else{if(!(e>t.k))return t;t=t.r}return null}removeNode(e,t){if(null===e)return null;let r=[],n=e;for(;null!==n&&n.k!==t;)r.push(n),n=t<n.k?n.l:n.r;if(null===n)return e;if(null===n.l||null===n.r){let t=n.l?n.l:n.r;if(0===r.length)e=t;else{let e=r[r.length-1];e.l===n?e.l=t:e.r=t}}else{let e=n,t=n.r;for(;null!==t.l;)e=t,t=t.l;n.k=t.k,n.v=t.v,e.l===t?e.l=t.r:e.r=t.r,n=e}r.push(n);for(let t=r.length-1;t>=0;t--){let n=r[t];n.updateHeight();let o=this.rebalanceNode(n);if(t>0){let e=r[t-1];e.l===n?e.l=o:e.r===n&&(e.r=o)}else e=o}return e}rangeSearch(e,t){let r=new Set,n=[],o=this.root;for(;o||n.length>0;){for(;o;)n.push(o),o=o.l;if((o=n.pop()).k>=e&&o.k<=t)for(let e of o.v)r.add(e);if(o.k>t)break;o=o.r}return r}greaterThan(e,t=!1){let r=new Set,n=[],o=this.root;for(;o||n.length>0;){for(;o;)n.push(o),o=o.r;if(o=n.pop(),t&&o.k>=e||!t&&o.k>e)for(let e of o.v)r.add(e);else if(o.k<=e)break;o=o.l}return r}lessThan(e,t=!1){let r=new Set,n=[],o=this.root;for(;o||n.length>0;){for(;o;)n.push(o),o=o.l;if(o=n.pop(),t&&o.k<=e||!t&&o.k<e)for(let e of o.v)r.add(e);else if(o.k>e)break;o=o.r}return r}}class el{numberToDocumentId;constructor(){this.numberToDocumentId=new Map}insert(e,t){this.numberToDocumentId.has(e)?this.numberToDocumentId.get(e).add(t):this.numberToDocumentId.set(e,new Set([t]))}find(e){let t=this.numberToDocumentId.get(e);return t?Array.from(t):null}remove(e){this.numberToDocumentId.delete(e)}removeDocument(e,t){let r=this.numberToDocumentId.get(t);r&&(r.delete(e),0===r.size&&this.numberToDocumentId.delete(t))}contains(e){return this.numberToDocumentId.has(e)}getSize(){let e=0;for(let t of this.numberToDocumentId.values())e+=t.size;return e}filter(e){let t=Object.keys(e);if(1!==t.length)throw Error("Invalid operation");let r=t[0];switch(r){case"eq":{let t=e[r],n=this.numberToDocumentId.get(t);return n?Array.from(n):[]}case"in":{let t=e[r],n=new Set;for(let e of t){let t=this.numberToDocumentId.get(e);if(t)for(let e of t)n.add(e)}return Array.from(n)}case"nin":{let t=new Set(e[r]),n=new Set;for(let[e,r]of this.numberToDocumentId.entries())if(!t.has(e))for(let e of r)n.add(e);return Array.from(n)}default:throw Error("Invalid operation")}}filterArr(e){let t=Object.keys(e);if(1!==t.length)throw Error("Invalid operation");let r=t[0];switch(r){case"containsAll":{let t=e[r].map(e=>this.numberToDocumentId.get(e)??new Set);if(0===t.length)return[];return Array.from(t.reduce((e,t)=>new Set([...e].filter(e=>t.has(e)))))}case"containsAny":{let t=e[r].map(e=>this.numberToDocumentId.get(e)??new Set);if(0===t.length)return[];return Array.from(t.reduce((e,t)=>new Set([...e,...t])))}default:throw Error("Invalid operation")}}static fromJSON(e){if(!e.numberToDocumentId)throw Error("Invalid Flat Tree JSON");let t=new el;for(let[r,n]of e.numberToDocumentId)t.numberToDocumentId.set(r,new Set(n));return t}toJSON(){return{numberToDocumentId:Array.from(this.numberToDocumentId.entries()).map(([e,t])=>[e,Array.from(t)])}}}function ea(e,t,r){let n=function(e,t,r){if(r<0)return -1;if(e===t)return 0;let n=e.length,o=t.length;if(0===n)return o<=r?o:-1;if(0===o)return n<=r?n:-1;let i=Math.abs(n-o);if(e.startsWith(t))return i<=r?i:-1;if(t.startsWith(e))return 0;if(i>r)return -1;let s=[];for(let e=0;e<=n;e++){s[e]=[e];for(let t=1;t<=o;t++)s[e][t]=0===e?t:0}for(let i=1;i<=n;i++){let n=1/0;for(let r=1;r<=o;r++)e[i-1]===t[r-1]?s[i][r]=s[i-1][r-1]:s[i][r]=Math.min(s[i-1][r]+1,s[i][r-1]+1,s[i-1][r-1]+1),n=Math.min(n,s[i][r]);if(n>r)return -1}return s[n][o]<=r?s[n][o]:-1}(e,t,r);return{distance:n,isBounded:n>=0}}class eu{k;s;c=new Map;d=new Set;e;w="";constructor(e,t,r){this.k=e,this.s=t,this.e=r}updateParent(e){this.w=e.w+this.s}addDocument(e){this.d.add(e)}removeDocument(e){return this.d.delete(e)}findAllWords(e,t,r,n){let o=[this];for(;o.length>0;){let i=o.pop();if(i.e){let{w:o,d:s}=i;if(r&&o!==t)continue;if(null!==S(e,o))if(n){if(!(Math.abs(t.length-o.length)<=n)||!ea(t,o,n).isBounded)continue;e[o]=[]}else e[o]=[];if(null!=S(e,o)&&s.size>0){let t=e[o];for(let e of s)t.includes(e)||t.push(e)}}i.c.size>0&&o.push(...i.c.values())}return e}insert(e,t){let r=this,n=0,o=e.length;for(;n<o;){let i=e[n],s=r.c.get(i);if(s){let i=s.s,l=i.length,a=0;for(;a<l&&n+a<o&&i[a]===e[n+a];)a++;if(a===l){if(r=s,(n+=a)===o){s.e||(s.e=!0),s.addDocument(t);return}continue}let u=i.slice(0,a),c=i.slice(a),f=e.slice(n+a),d=new eu(u[0],u,!1);if(r.c.set(u[0],d),d.updateParent(r),s.s=c,s.k=c[0],d.c.set(c[0],s),s.updateParent(d),f){let e=new eu(f[0],f,!0);e.addDocument(t),d.c.set(f[0],e),e.updateParent(d)}else d.e=!0,d.addDocument(t);return}{let o=new eu(i,e.slice(n),!0);o.addDocument(t),r.c.set(i,o),o.updateParent(r);return}}r.e||(r.e=!0),r.addDocument(t)}_findLevenshtein(e,t,r,n,o){let i=[{node:this,index:t,tolerance:r}];for(;i.length>0;){let{node:t,index:r,tolerance:s}=i.pop();if(t.w.startsWith(e)){t.findAllWords(o,e,!1,0);continue}if(s<0)continue;if(t.e){let{w:r,d:i}=t;if(r&&(ea(e,r,n).isBounded&&(o[r]=[]),void 0!==S(o,r)&&i.size>0)){let e=new Set(o[r]);for(let t of i)e.add(t);o[r]=Array.from(e)}}if(r>=e.length)continue;let l=e[r];if(t.c.has(l)){let e=t.c.get(l);i.push({node:e,index:r+1,tolerance:s})}for(let[e,n]of(i.push({node:t,index:r+1,tolerance:s-1}),t.c))i.push({node:n,index:r,tolerance:s-1}),e!==l&&i.push({node:n,index:r+1,tolerance:s-1})}}find(e){let{term:t,exact:r,tolerance:n}=e;if(n&&!r){let e={};return this._findLevenshtein(t,0,n,n,e),e}{let e=this,o=0,i=t.length;for(;o<i;){let s=t[o],l=e.c.get(s);if(!l)return{};{let s=l.s,a=s.length,u=0;for(;u<a&&o+u<i&&s[u]===t[o+u];)u++;if(u===a)e=l,o+=u;else{if(o+u!==i||u!==i-o||r)return{};let e={};return l.findAllWords(e,t,r,n),e}}}let s={};return e.findAllWords(s,t,r,n),s}}contains(e){let t=this,r=0,n=e.length;for(;r<n;){let o=e[r],i=t.c.get(o);if(!i)return!1;{let o=i.s,s=o.length,l=0;for(;l<s&&r+l<n&&o[l]===e[r+l];)l++;if(l<s)return!1;r+=s,t=i}}return!0}removeWord(e){if(!e)return!1;let t=this,r=e.length,n=[];for(let o=0;o<r;o++){let r=e[o];if(!t.c.has(r))return!1;{let e=t.c.get(r);n.push({parent:t,character:r}),o+=e.s.length-1,t=e}}for(t.d.clear(),t.e=!1;n.length>0&&0===t.c.size&&!t.e&&0===t.d.size;){let{parent:e,character:r}=n.pop();e.c.delete(r),t=e}return!0}removeDocumentByWord(e,t,r=!0){if(!e)return!0;let n=this,o=e.length;for(let i=0;i<o;i++){let o=e[i];if(!n.c.has(o))return!1;{let s=n.c.get(o);i+=s.s.length-1,n=s,r&&n.w!==e||n.removeDocument(t)}}return!0}static getCommonPrefix(e,t){let r=Math.min(e.length,t.length),n=0;for(;n<r&&e.charCodeAt(n)===t.charCodeAt(n);)n++;return e.slice(0,n)}toJSON(){return{w:this.w,s:this.s,e:this.e,k:this.k,d:Array.from(this.d),c:Array.from(this.c?.entries())?.map(([e,t])=>[e,t.toJSON()])}}static fromJSON(e){let t=new eu(e.k,e.s,e.e);return t.w=e.w,t.d=new Set(e.d),t.c=new Map(e?.c?.map(([e,t])=>[e,eu.fromJSON(t)])||[]),t}}class ec extends eu{constructor(){super("","",!1)}static fromJSON(e){let t=new ec;return t.w=e.w,t.s=e.s,t.e=e.e,t.k=e.k,t.d=new Set(e.d),t.c=new Map(e?.c?.map(([e,t])=>[e,eu.fromJSON(t)])||[]),t}toJSON(){return super.toJSON()}}class ef{point;docIDs;left;right;parent;constructor(e,t){this.point=e,this.docIDs=new Set(t),this.left=null,this.right=null,this.parent=null}toJSON(){return{point:this.point,docIDs:Array.from(this.docIDs),left:this.left?this.left.toJSON():null,right:this.right?this.right.toJSON():null}}static fromJSON(e,t=null){let r=new ef(e.point,e.docIDs);return r.parent=t,e.left&&(r.left=ef.fromJSON(e.left,r)),e.right&&(r.right=ef.fromJSON(e.right,r)),r}}class ed{root;nodeMap;constructor(){this.root=null,this.nodeMap=new Map}getPointKey(e){return`${e.lon},${e.lat}`}insert(e,t){let r=this.getPointKey(e),n=this.nodeMap.get(r);if(n)return void t.forEach(e=>n.docIDs.add(e));let o=new ef(e,t);if(this.nodeMap.set(r,o),null==this.root){this.root=o;return}let i=this.root,s=0;for(;;){if(0==s%2)if(e.lon<i.point.lon){if(null==i.left){i.left=o,o.parent=i;return}i=i.left}else{if(null==i.right){i.right=o,o.parent=i;return}i=i.right}else if(e.lat<i.point.lat){if(null==i.left){i.left=o,o.parent=i;return}i=i.left}else{if(null==i.right){i.right=o,o.parent=i;return}i=i.right}s++}}contains(e){let t=this.getPointKey(e);return this.nodeMap.has(t)}getDocIDsByCoordinates(e){let t=this.getPointKey(e),r=this.nodeMap.get(t);return r?Array.from(r.docIDs):null}removeDocByID(e,t){let r=this.getPointKey(e),n=this.nodeMap.get(r);n&&(n.docIDs.delete(t),0===n.docIDs.size&&(this.nodeMap.delete(r),this.deleteNode(n)))}deleteNode(e){let t=e.parent,r=e.left?e.left:e.right;r&&(r.parent=t),t?t.left===e?t.left=r:t.right===e&&(t.right=r):(this.root=r,this.root&&(this.root.parent=null))}searchByRadius(e,t,r=!0,n="asc",o=!1){let i=o?ed.vincentyDistance:ed.haversineDistance,s=[{node:this.root,depth:0}],l=[];for(;s.length>0;){let{node:n,depth:o}=s.pop();if(null==n)continue;let a=i(e,n.point);(r?a<=t:a>t)&&l.push({point:n.point,docIDs:Array.from(n.docIDs)}),null!=n.left&&s.push({node:n.left,depth:o+1}),null!=n.right&&s.push({node:n.right,depth:o+1})}return n&&l.sort((t,r)=>{let o=i(e,t.point),s=i(e,r.point);return"asc"===n.toLowerCase()?o-s:s-o}),l}searchByPolygon(e,t=!0,r=null,n=!1){let o=[{node:this.root,depth:0}],i=[];for(;o.length>0;){let{node:r,depth:n}=o.pop();if(null==r)continue;null!=r.left&&o.push({node:r.left,depth:n+1}),null!=r.right&&o.push({node:r.right,depth:n+1});let s=ed.isPointInPolygon(e,r.point);(s&&t||!s&&!t)&&i.push({point:r.point,docIDs:Array.from(r.docIDs)})}let s=ed.calculatePolygonCentroid(e);if(r){let e=n?ed.vincentyDistance:ed.haversineDistance;i.sort((t,n)=>{let o=e(s,t.point),i=e(s,n.point);return"asc"===r.toLowerCase()?o-i:i-o})}return i}toJSON(){return{root:this.root?this.root.toJSON():null}}static fromJSON(e){let t=new ed;return e.root&&(t.root=ef.fromJSON(e.root),t.buildNodeMap(t.root)),t}buildNodeMap(e){if(null==e)return;let t=this.getPointKey(e.point);this.nodeMap.set(t,e),e.left&&this.buildNodeMap(e.left),e.right&&this.buildNodeMap(e.right)}static calculatePolygonCentroid(e){let t=0,r=0,n=0,o=e.length;for(let i=0,s=o-1;i<o;s=i++){let o=e[i].lon,l=e[i].lat,a=e[s].lon,u=e[s].lat,c=o*u-a*l;t+=c,r+=(o+a)*c,n+=(l+u)*c}let i=6*(t/=2);return{lon:r/=i,lat:n/=i}}static isPointInPolygon(e,t){let r=!1,n=t.lon,o=t.lat,i=e.length;for(let t=0,s=i-1;t<i;s=t++){let i=e[t].lon,l=e[t].lat,a=e[s].lon,u=e[s].lat;l>o!=u>o&&n<(a-i)*(o-l)/(u-l)+i&&(r=!r)}return r}static haversineDistance(e,t){let r=Math.PI/180,n=e.lat*r,o=t.lat*r,i=(t.lat-e.lat)*r,s=(t.lon-e.lon)*r,l=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(o)*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l))*6371e3}static vincentyDistance(e,t){let r,n,o,i,s,l,a,u=1/298.257223563,c=(1-1/298.257223563)*6378137,f=Math.PI/180,d=e.lat*f,h=t.lat*f,p=(t.lon-e.lon)*f,g=Math.atan((1-u)*Math.tan(d)),m=Math.atan((1-u)*Math.tan(h)),y=Math.sin(g),b=Math.cos(g),S=Math.sin(m),I=Math.cos(m),w=p,O=1e3;do{let e=Math.sin(w),t=Math.cos(w);if(0===(n=Math.sqrt(I*e*(I*e)+(b*S-y*I*t)*(b*S-y*I*t))))return 0;i=Math.atan2(n,o=y*S+b*I*t),isNaN(a=o-2*y*S/(l=1-(s=b*I*e/n)*s))&&(a=0);let c=u/16*l*(4+u*(4-3*l));r=w,w=p+(1-c)*u*s*(i+c*n*(a+c*o*(-1+2*a*a)))}while(Math.abs(w-r)>1e-12&&--O>0);if(0===O)return NaN;let N=l*(0x24ffb2985f71-c*c)/(c*c),T=1+N/16384*(4096+N*(-768+N*(320-175*N))),v=N/1024*(256+N*(-128+N*(74-47*N)));return c*T*(i-v*n*(a+v/4*(o*(-1+2*a*a)-v/6*a*(-3+4*n*n)*(-3+4*a*a))))}}class eh{true;false;constructor(){this.true=new Set,this.false=new Set}insert(e,t){t?this.true.add(e):this.false.add(e)}delete(e,t){t?this.true.delete(e):this.false.delete(e)}getSize(){return this.true.size+this.false.size}toJSON(){return{true:Array.from(this.true),false:Array.from(this.false)}}static fromJSON(e){let t=new eh;return t.true=new Set(e.true),t.false=new Set(e.false),t}}class ep{size;vectors=new Map;constructor(e){this.size=e}add(e,t){t instanceof Float32Array||(t=new Float32Array(t));let r=eg(t,this.size);this.vectors.set(e,[r,t])}remove(e){this.vectors.delete(e)}find(e,t,r){return e instanceof Float32Array||(e=new Float32Array(e)),function(e,t,r,n,o){let i=eg(e,n),s=[];for(let l of t||r.keys()){let t=r.get(l);if(!t)continue;let a=t[0],u=t[1],c=0;for(let t=0;t<n;t++)c+=e[t]*u[t];let f=c/(i*a);f>=o&&s.push([l,f])}return s}(e,r,this.vectors,this.size,t)}toJSON(){let e=[];for(let[t,[r,n]]of this.vectors)e.push([t,[r,Array.from(n)]]);return{size:this.size,vectors:e}}static fromJSON(e){let t=new ep(e.size);for(let[r,[n,o]]of e.vectors)t.vectors.set(r,[n,new Float32Array(o)]);return t}}function eg(e,t){let r=0;for(let n=0;n<t;n++)r+=e[n]*e[n];return Math.sqrt(r)}function em(e,t,r,n,o){let i=F(e.sharedInternalDocumentStore,r);e.avgFieldLength[t]=((e.avgFieldLength[t]??0)*(o-1)+n.length)/o,e.fieldLengths[t][i]=n.length,e.frequencies[t][i]={}}function ey(e,t,r,n,o){let i=0;for(let e of n)e===o&&i++;let s=F(e.sharedInternalDocumentStore,r),l=i/n.length;e.frequencies[t][s][o]=l,o in e.tokenOccurrences[t]||(e.tokenOccurrences[t][o]=0),e.tokenOccurrences[t][o]=(e.tokenOccurrences[t][o]??0)+1}function eb(e,t,r,n){let o=F(e.sharedInternalDocumentStore,r);n>1?e.avgFieldLength[t]=(e.avgFieldLength[t]*n-e.fieldLengths[t][o])/(n-1):e.avgFieldLength[t]=void 0,e.fieldLengths[t][o]=void 0,e.frequencies[t][o]=void 0}function eS(e,t,r){e.tokenOccurrences[t][r]--}function eI(e,t,r,n,o,i,s,l,a,u,c){if(L(s)){var f,d,h,p;return f=t,d=r,h=i,p=o,void f.vectorIndexes[d].node.add(p,h)}let g=n=>{let{type:i,node:s}=t.indexes[r];switch(i){case"Bool":s[n?"true":"false"].add(o);break;case"AVL":{let e=c?.avlRebalanceThreshold??1;s.insert(n,o,e);break}case"Radix":{let i=a.tokenize(n,l,r,!1);for(let n of(e.insertDocumentScoreParameters(t,r,o,i,u),i))e.insertTokenScoreParameters(t,r,o,i,n),s.insert(n,o);break}case"Flat":s.insert(n,o);break;case"BKD":s.insert(n,[o])}};if(!B(s))return g(i);let m=i.length;for(let e=0;e<m;e++)g(i[e])}function ew(e,t,r,n,o,i,s,l,a,u){if(L(s))return t.vectorIndexes[r].node.remove(o),!0;let{type:c,node:f}=t.indexes[r];switch(c){case"AVL":return f.removeDocument(i,o),!0;case"Bool":return f[i?"true":"false"].delete(o),!0;case"Radix":{let s=a.tokenize(i,l,r);for(let i of(e.removeDocumentScoreParameters(t,r,n,u),s))e.removeTokenScoreParameters(t,r,i),f.removeDocumentByWord(i,o);return!0}case"Flat":return f.removeDocument(o,i),!0;case"BKD":return f.removeDocByID(i,o),!1}}function eO(e,t,r,n,o,i,s,l,a,u){if(!B(s))return ew(e,t,r,n,o,i,s,l,a,u);let c=z[s],f=i.length;for(let s=0;s<f;s++)ew(e,t,r,n,o,i[s],c,l,a,u);return!0}function eN(e,t,r,n,o,i,s,l,a,u){let c=Array.from(n),f=e.avgFieldLength[t],d=e.fieldLengths[t],h=e.tokenOccurrences[t],p=e.frequencies[t],g="number"==typeof h[r]?h[r]??0:0,m=c.length;for(let e=0;e<m;e++){let n=c[e];if(a&&!a.has(n))continue;u.has(n)||u.set(n,new Map);let h=u.get(n);h.set(t,(h.get(t)||0)+1);let m=function(e,t,r,n,o,{k:i,b:s,d:l}){return Math.log(1+(r-t+.5)/(t+.5))*(l+e*(i+1))/(e+i*(1-s+s*n/o))}(p?.[n]?.[r]??0,g,o,d[n],f,i);s.has(n)?s.set(n,s.get(n)+m*l):s.set(n,m*l)}}function eT(e,t,r,n,o,i,s,l,a,u,c,f=0){let d=r.tokenize(t,n),h=d.length||1,p=new Map,g=new Map,m=new Map;for(let r of o){if(!(r in e.indexes))continue;let n=e.indexes[r],{type:o}=n;if("Radix"!==o)throw M("WRONG_SEARCH_PROPERTY_TYPE",r);let f=l[r]??1;if(f<=0)throw M("INVALID_BOOST_VALUE",f);0!==d.length||t||d.push("");let h=d.length;for(let t=0;t<h;t++){let o=d[t],l=n.node.find({term:o,exact:i,tolerance:s}),h=Object.keys(l);h.length>0&&g.set(o,!0);let y=h.length;for(let t=0;t<y;t++){let n=h[t],o=l[n];eN(e,r,n,o,u,a,m,f,c,p)}}}let y=Array.from(m.entries()).map(([e,t])=>[e,t]).sort((e,t)=>t[1]-e[1]);if(0===y.length)return[];if(1===f)return y;if(0===f){if(1===h)return y;for(let e of d)if(!g.get(e))return[];return y.filter(([e])=>{let t=p.get(e);return!!t&&Array.from(t.values()).some(e=>e===h)})}let b=y.filter(([e])=>{let t=p.get(e);return!!t&&Array.from(t.values()).some(e=>e===h)});if(b.length>0){let e=y.filter(([e])=>!b.some(([t])=>t===e)),t=Math.ceil(e.length*f);return[...b,...e.slice(0,t)]}return y}function ev(e){return e.searchableProperties}function e_(e){return e.searchablePropertiesWithTypes}function eD(e,t){let{indexes:r,vectorIndexes:n,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:s,tokenOccurrences:l,avgFieldLength:a,fieldLengths:u}=t,c={},f={};for(let e of Object.keys(r)){let{node:t,type:n,isArray:o}=r[e];switch(n){case"Radix":c[e]={type:"Radix",node:ec.fromJSON(t),isArray:o};break;case"Flat":c[e]={type:"Flat",node:el.fromJSON(t),isArray:o};break;case"AVL":c[e]={type:"AVL",node:es.fromJSON(t),isArray:o};break;case"BKD":c[e]={type:"BKD",node:ed.fromJSON(t),isArray:o};break;case"Bool":c[e]={type:"Bool",node:eh.fromJSON(t),isArray:o};break;default:c[e]=r[e]}}for(let e of Object.keys(n))f[e]={type:"Vector",isArray:!1,node:ep.fromJSON(n[e])};return{sharedInternalDocumentStore:e,indexes:c,vectorIndexes:f,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:s,tokenOccurrences:l,avgFieldLength:a,fieldLengths:u}}function eA(e){let{indexes:t,vectorIndexes:r,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:s,avgFieldLength:l,fieldLengths:a}=e,u={};for(let e of Object.keys(r))u[e]=r[e].node.toJSON();let c={};for(let e of Object.keys(t)){let{type:r,node:n,isArray:o}=t[e];"Flat"===r||"Radix"===r||"AVL"===r||"BKD"===r||"Bool"===r?c[e]={type:r,node:n.toJSON(),isArray:o}:(c[e]=t[e],c[e].node=c[e].node.toJSON())}return{indexes:c,vectorIndexes:u,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:s,avgFieldLength:l,fieldLengths:a}}function eE(e,t){e||(e=new Set);let r=t.length;for(let n=0;n<r;n++){let r=t[n].docIDs,o=r.length;for(let t=0;t<o;t++)e.add(r[t])}return e}function ek(e,t,r=!1){let n=r?ed.vincentyDistance:ed.haversineDistance,o=[],i=[];for(let{point:r}of e)i.push(n(t,r));let s=Math.max(...i),l=0;for(let{docIDs:t}of e){let e=s-i[l]+1;for(let r of t)o.push([r,e]);l++}return o.sort((e,t)=>t[1]-e[1]),o}function eP(e,t,r,n){return n?.enabled===!1?{disabled:!0}:function e(t,r,n,o,i){let s={language:t.tokenizer.language,sharedInternalDocumentStore:r,enabled:!0,isSorted:!0,sortableProperties:[],sortablePropertiesWithTypes:{},sorts:{}};for(let[l,a]of Object.entries(n)){let n=`${i}${i?".":""}${l}`;if(!o.includes(n)){if("object"==typeof a&&!Array.isArray(a)){let i=e(t,r,a,o,n);p(s.sortableProperties,i.sortableProperties),s.sorts={...s.sorts,...i.sorts},s.sortablePropertiesWithTypes={...s.sortablePropertiesWithTypes,...i.sortablePropertiesWithTypes};continue}if(!L(a))switch(a){case"boolean":case"number":case"string":s.sortableProperties.push(n),s.sortablePropertiesWithTypes[n]=a,s.sorts[n]={docs:new Map,orderedDocsToRemove:new Map,orderedDocs:[],type:a};break;case"geopoint":case"enum":case"enum[]":case"boolean[]":case"number[]":case"string[]":continue;default:throw M("INVALID_SORT_SCHEMA_TYPE",Array.isArray(a)?"array":a,n)}}}return s}(e,t,r,(n||{}).unsortableProperties||[],"")}function eR(e,t,r,n){if(!e.enabled)return;e.isSorted=!1;let o=F(e.sharedInternalDocumentStore,r),i=e.sorts[t];i.orderedDocsToRemove.has(o)&&ez(e,t),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function eM(e){if(!e.isSorted&&e.enabled){for(let t of Object.keys(e.sorts))!function(e,t){let r,n=e.sorts[t];switch(n.type){case"string":r=ex.bind(null,e.language);break;case"number":r=eC.bind(null);break;case"boolean":r=eU.bind(null)}n.orderedDocs.sort(r);let o=n.orderedDocs.length;for(let e=0;e<o;e++){let t=n.orderedDocs[e][0];n.docs.set(t,e)}}(e,t);e.isSorted=!0}}function ex(e,t,r){return t[1].localeCompare(r[1],void 0!==e&&l.includes(e)?i[e]:void 0)}function eC(e,t){return e[1]-t[1]}function eU(e,t){return t[1]?-1:1}function ez(e,t){let r=e.sorts[t];r.orderedDocsToRemove.size&&(r.orderedDocs=r.orderedDocs.filter(e=>!r.orderedDocsToRemove.has(e[0])),r.orderedDocsToRemove.clear())}function eL(e,t,r){if(!e.enabled)return;let n=e.sorts[t],o=F(e.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function eB(e,t,r){if(!e.enabled)throw M("SORT_DISABLED");let n=r.property,o="DESC"===r.order,i=e.sorts[n];if(!i)throw M("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,e.sortableProperties.join(", "));return ez(e,n),eM(e),t.sort((t,r)=>{let n=i.docs.get(F(e.sharedInternalDocumentStore,t[0])),s=i.docs.get(F(e.sharedInternalDocumentStore,r[0])),l=void 0!==n,a=void 0!==s;return l||a?l?a?o?s-n:n-s:-1:1:0}),t}function eV(e){return e.enabled?e.sortableProperties:[]}function eW(e){return e.enabled?e.sortablePropertiesWithTypes:{}}function ej(e,t){if(!t.enabled)return{enabled:!1};let r=Object.keys(t.sorts).reduce((e,r)=>{let{docs:n,orderedDocs:o,type:i}=t.sorts[r];return e[r]={docs:new Map(Object.entries(n).map(([e,t])=>[+e,t])),orderedDocsToRemove:new Map,orderedDocs:o,type:i},e},{});return{sharedInternalDocumentStore:e,language:t.language,sortableProperties:t.sortableProperties,sortablePropertiesWithTypes:t.sortablePropertiesWithTypes,sorts:r,enabled:!0,isSorted:t.isSorted}}function eF(e){if(!e.enabled)return{enabled:!1};for(let t of Object.keys(e.sorts))ez(e,t);eM(e);let t=Object.keys(e.sorts).reduce((t,r)=>{let{docs:n,orderedDocs:o,type:i}=e.sorts[r];return t[r]={docs:Object.fromEntries(n.entries()),orderedDocs:o,type:i},t},{});return{language:e.language,sortableProperties:e.sortableProperties,sortablePropertiesWithTypes:e.sortablePropertiesWithTypes,sorts:t,enabled:e.enabled,isSorted:e.isSorted}}let e$=[65,65,65,65,65,65,65,67,69,69,69,69,73,73,73,73,69,78,79,79,79,79,79,null,79,85,85,85,85,89,80,115,97,97,97,97,97,97,97,99,101,101,101,101,105,105,105,105,101,110,111,111,111,111,111,null,111,117,117,117,117,121,112,121,65,97,65,97,65,97,67,99,67,99,67,99,67,99,68,100,68,100,69,101,69,101,69,101,69,101,69,101,71,103,71,103,71,103,71,103,72,104,72,104,73,105,73,105,73,105,73,105,73,105,73,105,74,106,75,107,107,76,108,76,108,76,108,76,108,76,108,78,110,78,110,78,110,110,78,110,79,111,79,111,79,111,79,111,82,114,82,114,82,114,83,115,83,115,83,115,83,115,84,116,84,116,84,116,85,117,85,117,85,117,85,117,85,117,85,117,87,119,89,121,89,90,122,90,122,90,122,115],eG={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},eJ={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},eY="[aeiouy]",eH="[^aeiou][^aeiouy]*",eK=eY+"[aeiou]*",eq="^("+eH+")?"+eK+eH,eX="^("+eH+")?"+eK+eH+"("+eK+")?$",eZ="^("+eH+")?"+eK+eH+eK+eH,eQ="^("+eH+")?"+eY;function e0(e){let t,r,n,o,i,s;if(e.length<3)return e;let l=e.substring(0,1);if("y"==l&&(e=l.toUpperCase()+e.substring(1)),o=/^(.+?)([^s])s$/,(n=/^(.+?)(ss|i)es$/).test(e)?e=e.replace(n,"$1$2"):o.test(e)&&(e=e.replace(o,"$1$2")),o=/^(.+?)(ed|ing)$/,(n=/^(.+?)eed$/).test(e)){let t=n.exec(e);(n=new RegExp(eq)).test(t[1])&&(n=/.$/,e=e.replace(n,""))}else o.test(e)&&(t=o.exec(e)[1],(o=new RegExp(eQ)).test(t)&&(e=t,o=/(at|bl|iz)$/,i=RegExp("([^aeiouylsz])\\1$"),s=RegExp("^"+eH+eY+"[^aeiouwxy]$"),o.test(e)?e+="e":i.test(e)?(n=/.$/,e=e.replace(n,"")):s.test(e)&&(e+="e")));if((n=/^(.+?)y$/).test(e)){let r=n.exec(e);t=r?.[1],n=new RegExp(eQ),t&&n.test(t)&&(e=t+"i")}if((n=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/).test(e)){let o=n.exec(e);t=o?.[1],r=o?.[2],n=new RegExp(eq),t&&n.test(t)&&(e=t+eG[r])}if((n=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/).test(e)){let o=n.exec(e);t=o?.[1],r=o?.[2],n=new RegExp(eq),t&&n.test(t)&&(e=t+eJ[r])}if(o=/^(.+?)(s|t)(ion)$/,(n=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/).test(e)){let r=n.exec(e);t=r?.[1],n=new RegExp(eZ),t&&n.test(t)&&(e=t)}else if(o.test(e)){let r=o.exec(e);t=r?.[1]??""+r?.[2]??"",(o=new RegExp(eZ)).test(t)&&(e=t)}if((n=/^(.+?)e$/).test(e)){let r=n.exec(e);t=r?.[1],n=new RegExp(eZ),o=new RegExp(eX),i=RegExp("^"+eH+eY+"[^aeiouwxy]$"),t&&(n.test(t)||o.test(t)&&!i.test(t))&&(e=t)}return n=/ll$/,o=new RegExp(eZ),n.test(e)&&o.test(e)&&(n=/.$/,e=e.replace(n,"")),"y"==l&&(e=l.toLowerCase()+e.substring(1)),e}function e1(e,t,r=!0){let n=`${this.language}:${e}:${t}`;return r&&this.normalizationCache.has(n)?this.normalizationCache.get(n):this.stopWords?.includes(t)?(r&&this.normalizationCache.set(n,""),""):(this.stemmer&&!this.stemmerSkipProperties.has(e)&&(t=this.stemmer(t)),t=function(e){let t=[];for(let n=0;n<e.length;n++){var r;t[n]=(r=e.charCodeAt(n))<192||r>383?r:e$[r-192]||r}return String.fromCharCode(...t)}(t),r&&this.normalizationCache.set(n,t),t)}function e9(e,t,r,n=!0){let o;if(t&&t!==this.language)throw M("LANGUAGE_NOT_SUPPORTED",t);if("string"!=typeof e)return[e];let i=this.normalizeToken.bind(this,r??"");if(r&&this.tokenizeSkipProperties.has(r))o=[i(e,n)];else{let t=s[this.language];o=e.toLowerCase().split(t).map(e=>i(e,n)).filter(Boolean)}let l=function(e){for(;""===e[e.length-1];)e.pop();for(;""===e[0];)e.shift();return e}(o);return this.allowDuplicates?l:Array.from(new Set(l))}function e7(e={}){let t,r;if(e.language){if(!l.includes(e.language))throw M("LANGUAGE_NOT_SUPPORTED",e.language)}else e.language="english";if(e.stemming||e.stemmer&&!("stemming"in e))if(e.stemmer){if("function"!=typeof e.stemmer)throw M("INVALID_STEMMER_FUNCTION_TYPE");t=e.stemmer}else if("english"===e.language)t=e0;else throw M("MISSING_STEMMER",e.language);if(!1!==e.stopWords){if(r=[],Array.isArray(e.stopWords))r=e.stopWords;else if("function"==typeof e.stopWords)r=e.stopWords(r);else if(e.stopWords)throw M("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw M("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let e of r)if("string"!=typeof e)throw M("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:e9,language:e.language,stemmer:t,stemmerSkipProperties:new Set(e.stemmerSkipProperties?[e.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(e.tokenizeSkipProperties?[e.tokenizeSkipProperties].flat():[]),stopWords:r,allowDuplicates:!!e.allowDuplicates,normalizeToken:e1,normalizationCache:new Map};return n.tokenize=e9.bind(n),n.normalizeToken=e1,n}function e5(e){return{sharedInternalDocumentStore:e,rules:new Map}}function e6(e,t){if(e.rules.has(t.id))throw Error(`PINNING_RULE_ALREADY_EXISTS: A pinning rule with id "${t.id}" already exists. Use updateRule to modify it.`);e.rules.set(t.id,t)}function e2(e,t){if(!e.rules.has(t.id))throw Error(`PINNING_RULE_NOT_FOUND: Cannot update pinning rule with id "${t.id}" because it does not exist. Use addRule to create it.`);e.rules.set(t.id,t)}function e3(e,t){return e.rules.delete(t)}function e8(e,t){return e.rules.get(t)}function e4(e){return Array.from(e.rules.values())}function te(e,t){if(!t)return[];let r=[];for(let n of e.rules.values())(function(e,t){return!!e&&t.conditions.every(t=>(function(e,t){let r=e.toLowerCase().trim(),n=t.pattern.toLowerCase().trim();switch(t.anchoring){case"is":return r===n;case"starts_with":return r.startsWith(n);case"contains":return r.includes(n);default:return!1}})(e,t))})(t,n)&&r.push(n);return r}function tt(e,t){return{sharedInternalDocumentStore:e,rules:new Map(t?.rules??[])}}function tr(e){return{rules:Array.from(e.rules.entries())}}let tn="fulltext";function to(e,t){return e[1]-t[1]}function ti(e,t){return t[1]-e[1]}function ts(e,t,r){let n={},o=t.map(([e])=>e),i=e.documentsStore.getMultiple(e.data.docs,o),s=Object.keys(r),l=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e of s){let t;if("number"===l[e]){let{ranges:n}=r[e],o=n.length,i=Array.from({length:o});for(let e=0;e<o;e++){let t=n[e];i[e]=[`${t.from}-${t.to}`,0]}t=Object.fromEntries(i)}n[e]={count:0,values:t??{}}}let a=i.length;for(let e=0;e<a;e++){let t=i[e];for(let e of s){let o=e.includes(".")?O(t,e):t[e],i=l[e],s=n[e].values;switch(i){case"number":tl(r[e].ranges,s)(o);break;case"number[]":{let t=new Set,n=tl(r[e].ranges,s,t);for(let e of o)n(e);break}case"boolean":case"enum":case"string":ta(s,i)(o);break;case"boolean[]":case"enum[]":case"string[]":{let e=ta(s,"boolean[]"===i?"boolean":"string",new Set);for(let t of o)e(t);break}default:throw M("FACET_NOT_SUPPORTED",i)}}}for(let e of s){let t=n[e];if(t.count=Object.keys(t.values).length,"string"===l[e]){let n=r[e],o=function(e="desc"){return"asc"===e.toLowerCase()?to:ti}(n.sort);t.values=Object.fromEntries(Object.entries(t.values).sort(o).slice(n.offset??0,n.limit??10))}}return n}function tl(e,t,r){return n=>{for(let o of e){let e=`${o.from}-${o.to}`;!r?.has(e)&&n>=o.from&&n<=o.to&&(void 0===t[e]?t[e]=1:(t[e]++,r?.add(e)))}}}function ta(e,t,r){let n="boolean"===t?"false":"";return t=>{let o=t?.toString()??n;r?.has(o)||(e[o]=(e[o]??0)+1,r?.add(o))}}let tu={reducer:(e,t,r,n)=>(t[n]=r,t),getInitialValue:e=>Array.from({length:e})},tc=["string","number","boolean"];function tf(e,t,r){let n=r.properties,o=n.length,i=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e=0;e<o;e++){let t=n[e];if(void 0===i[t])throw M("UNKNOWN_GROUP_BY_PROPERTY",t);if(!tc.includes(i[t]))throw M("INVALID_GROUP_BY_PROPERTY",t,tc.join(", "),i[t])}let s=t.map(([t])=>$(e.internalDocumentIDStore,t)),l=e.documentsStore.getMultiple(e.data.docs,s),a=l.length,u=r.maxResult||Number.MAX_SAFE_INTEGER,c=[],f={};for(let e=0;e<o;e++){let t=n[e],r={property:t,perValue:{}},o=new Set;for(let e=0;e<a;e++){let n=O(l[e],t);if(void 0===n)continue;let i="boolean"!=typeof n?n:""+n,s=r.perValue[i]??{indexes:[],count:0};s.count>=u||(s.indexes.push(e),s.count++,r.perValue[i]=s,o.add(n))}c.push(Array.from(o)),f[t]=r}let d=function e(t,r=0){if(r+1===t.length)return t[r].map(e=>[e]);let n=t[r],o=e(t,r+1),i=[];for(let e of n)for(let t of o){let r=[e];p(r,t),i.push(r)}return i}(c),h=d.length,g=[];for(let e=0;e<h;e++){let t=d[e],r=t.length,o={values:[],indexes:[]},i=[];for(let e=0;e<r;e++){let r=t[e],s=n[e];i.push(f[s].perValue["boolean"!=typeof r?r:""+r].indexes),o.values.push(r)}o.indexes=(function(e){if(0===e.length)return[];if(1===e.length)return e[0];for(let t=1;t<e.length;t++)if(e[t].length<e[0].length){let r=e[0];e[0]=e[t],e[t]=r}let t=new Map;for(let r of e[0])t.set(r,1);for(let r=1;r<e.length;r++){let n=0;for(let o of e[r]){let e=t.get(o);e===r&&(t.set(o,e+1),n++)}if(0===n)return[]}return e[0].filter(r=>{let n=t.get(r);return void 0!==n&&t.set(r,0),n===e.length})})(i).sort((e,t)=>e-t),0!==o.indexes.length&&g.push(o)}let m=g.length,y=Array.from({length:m});for(let e=0;e<m;e++){let n=g[e],o=r.reduce||tu,i=n.indexes.map(e=>({id:s[e],score:t[e][1],document:l[e]})),a=o.reducer.bind(null,n.values),u=o.getInitialValue(n.indexes.length),c=i.reduce(a,u);y[e]={values:n.values,result:c}}return y}function td(e,t,r,n){let o=te(t,n);if(0===o.length)return r;let i=o.flatMap(e=>e.consequence.promote);i.sort((e,t)=>e.position-t.position);let s=new Set,l=new Map,a=new Set;for(let t of i){let r=F(e.internalDocumentIDStore,t.doc_id);if(void 0!==r){if(l.has(r)){let e=l.get(r);t.position<e&&l.set(r,t.position);continue}a.has(t.position)||(s.add(r),l.set(r,t.position),a.add(t.position))}}if(0===l.size)return r;let u=r.filter(([e])=>!s.has(e)),c=[];for(let[t,n]of l.entries())r.find(([e])=>e===t)?c.push([t,1e6-n]):e.documentsStore.get(e.data.docs,t)&&c.push([t,0]);c.sort((e,t)=>(l.get(e[0])??1/0)-(l.get(t[0])??1/0));let f=[],d=new Map;for(let e of c){let t=l.get(e[0]);d.set(t,e)}let h=0,p=0;for(;p<u.length+c.length;)if(d.has(p))f.push(d.get(p)),p++;else if(h<u.length)f.push(u[h]),h++,p++;else break;for(let[e,t]of d.entries())e>=f.length&&f.push(t);return f}function th(e,t,r){let n,o,{term:i,properties:s}=t,l=e.data.index,a=e.caches.propertiesToSearch;if(!a){let t=e.index.getSearchablePropertiesWithTypes(l);a=(a=e.index.getSearchableProperties(l)).filter(e=>t[e].startsWith("string")),e.caches.propertiesToSearch=a}if(s&&"*"!==s){for(let e of s)if(!a.includes(e))throw M("UNKNOWN_INDEX",e,a.join(", "));a=a.filter(e=>s.includes(e))}let u=Object.keys(t.where??{}).length>0;u&&(n=e.index.searchByWhereClause(l,e.tokenizer,t.where,r));let c=void 0!==t.threshold&&null!==t.threshold?t.threshold:1;if(i||s){let s=e.documentsStore.count(e.data.docs);if(o=e.index.search(l,i||"",e.tokenizer,r,a,t.exact||!1,t.tolerance||0,t.boost||{},function(e){let t=e??{};return t.k=t.k??tp.k,t.b=t.b??tp.b,t.d=t.d??tp.d,t}(t.relevance),s,n,c),t.exact&&i){let t=i.trim().split(/\s+/);o=o.filter(([r])=>{let n=e.documentsStore.get(e.data.docs,r);if(!n)return!1;for(let e of a){let r=function(e,t){let r=t.split("."),n=e;for(let e of r)if(!n||"object"!=typeof n||!(e in n))return;else n=n[e];return n}(n,e);if("string"==typeof r&&t.every(e=>RegExp(`\\b${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(r)))return!0}return!1})}}else if(u){let e=function(e,t){let r,n=function(e,t){let r=Object.keys(e);if(1!==r.length)return{isGeoOnly:!1};let n=r[0],o=e[n];if(void 0===t.indexes[n])return{isGeoOnly:!1};let{type:i}=t.indexes[n];return"BKD"===i&&o&&("radius"in o||"polygon"in o)?{isGeoOnly:!0,geoProperty:n,geoOperation:o}:{isGeoOnly:!1}}(t,e);if(!n.isGeoOnly||!n.geoProperty||!n.geoOperation)return null;let{node:o}=e.indexes[n.geoProperty],i=n.geoOperation;if("radius"in i){let{value:e,coordinates:t,unit:n="m",inside:s=!0,highPrecision:l=!1}=i.radius,a=T(e,n);return ek(r=o.searchByRadius(t,a,s,"asc",l),t,l)}if("polygon"in i){let{coordinates:e,inside:t=!0,highPrecision:n=!1}=i.polygon;return ek(r=o.searchByPolygon(e,t,"asc",n),ed.calculatePolygonCentroid(e),n)}return null}(l,t.where);o=e||(n?Array.from(n):[]).map(e=>[+e,0])}else o=Object.keys(e.documentsStore.getAll(e.data.docs)).map(e=>[+e,0]);return o}let tp={k:1.2,b:.75,d:.5};function tg(e,t,r){let n,o=t.vector;if(o&&(!("value"in o)||!("property"in o)))throw M("INVALID_VECTOR_INPUT",Object.keys(o).join(", "));let i=e.data.index.vectorIndexes[o.property];if(!i)throw M("UNKNOWN_VECTOR_PROPERTY",o.property);let s=i.node.size;if(o?.value.length!==s){if(o?.property===void 0||o?.value.length===void 0)throw M("INVALID_INPUT_VECTOR","undefined",s,"undefined");throw M("INVALID_INPUT_VECTOR",o.property,s,o.value.length)}let l=e.data.index;return Object.keys(t.where??{}).length>0&&(n=e.index.searchByWhereClause(l,e.tokenizer,t.where,r)),i.node.find(o.value,t.similarity??.8,n)}function tm(e){return e[1]}function ty(e,t,r){let n=t.mode??tn;if(n===tn){let n=y();function o(){let o,i=Object.keys(e.data.index.vectorIndexes),s=t.facets&&Object.keys(t.facets).length>0,{limit:l=10,offset:a=0,distinctOn:u,includeVectors:c=!1}=t,f=!0===t.preflight,d=th(e,t,r);if(t.sortBy)if("function"==typeof t.sortBy){let r=d.map(([e])=>e),n=e.documentsStore.getMultiple(e.data.docs,r).map((e,t)=>[d[t][0],d[t][1],e]);n.sort(t.sortBy),d=n.map(([e,t])=>[e,t])}else d=e.sorter.sortBy(e.data.sorting,d,t.sortBy).map(([t,r])=>[F(e.internalDocumentIDStore,t),r]);else d=d.sort(I);d=td(e,e.data.pinning,d,t.term),f||(o=u?function(e,t,r,n,o){let i=e.data.docs,s=new Map,l=[],a=new Set,u=t.length,c=0;for(let f=0;f<u;f++){let u=t[f];if(void 0===u)continue;let[d,h]=u;if(a.has(d))continue;let p=e.documentsStore.get(i,d),g=O(p,o);if(!(void 0===g||s.has(g))&&(s.set(g,!0),!(++c<=r)&&(l.push({id:$(e.internalDocumentIDStore,d),score:h,document:p}),a.add(d),c>=r+n)))break}return l}(e,d,a,l,u):tb(e,d,a,l));let h={elapsed:{formatted:"",raw:0},hits:[],count:d.length};return void 0!==o&&(h.hits=o.filter(Boolean),c||v(h,i)),s&&(h.facets=ts(e,d,t.facets)),t.groupBy&&(h.groups=tf(e,d,t.groupBy)),h.elapsed=e.formatElapsedTime(y()-n),h}async function i(){e.beforeSearch&&await eo(e.beforeSearch,e,t,r);let n=o();return e.afterSearch&&await en(e.afterSearch,e,t,r,n),n}return e.beforeSearch?.length||e.afterSearch?.length?i():o()}if("vector"===n)return function(e,t,r="english"){let n=y();function o(){let o=tg(e,t,r).sort(I);o=td(e,e.data.pinning,o,void 0);let i=[];t.facets&&Object.keys(t.facets).length>0&&(i=ts(e,o,t.facets));let s=t.vector.property,l=t.includeVectors??!1,a=t.limit??10,u=t.offset??0,c=Array.from({length:a});for(let t=0;t<a;t++){let r=o[t+u];if(!r)break;let n=e.data.docs.docs[r[0]];if(n){l||(n[s]=null);let o={id:$(e.internalDocumentIDStore,r[0]),score:r[1],document:n};c[t]=o}}let f=[];t.groupBy&&(f=tf(e,o,t.groupBy));let d=y()-n;return{count:o.length,hits:c.filter(Boolean),elapsed:{raw:Number(d),formatted:m(d)},...i?{facets:i}:{},...f?{groups:f}:{}}}async function i(){e.beforeSearch&&await eo(e.beforeSearch,e,t,r);let n=o();return e.afterSearch&&await en(e.afterSearch,e,t,r,n),n}return e.beforeSearch?.length||e.afterSearch?.length?i():o()}(e,t);if("hybrid"===n)return function(e,t,r){let n=y();function o(){let r,o,i=function(e,t,r){let n=function(e){let t=Math.max.apply(Math,e.map(tm));return e.map(([e,r])=>[e,r/t])}(th(e,t,r)),o=tg(e,t,r),i=t.hybridWeights;return function(e,t,r,n){let o=Math.max.apply(Math,e.map(tm)),i=Math.max.apply(Math,t.map(tm)),{text:s,vector:l}=n&&n.text&&n.vector?n:{text:.5,vector:.5},a=new Map,u=e.length,c=(e,t)=>e*s+t*l;for(let t=0;t<u;t++){let[r,n]=e[t],i=c(n/o,0);a.set(r,i)}let f=t.length;for(let e=0;e<f;e++){let[r,n]=t[e],o=n/i,s=a.get(r)??0;a.set(r,s+c(0,o))}return[...a].sort((e,t)=>t[1]-e[1])}(n,o,t.term??"",i)}(e,t,void 0);i=td(e,e.data.pinning,i,t.term),t.facets&&Object.keys(t.facets).length>0&&(r=ts(e,i,t.facets)),t.groupBy&&(o=tf(e,i,t.groupBy));let s=tb(e,i,t.offset??0,t.limit??10).filter(Boolean),l=y(),a={count:i.length,elapsed:{raw:Number(l-n),formatted:m(l-n)},hits:s,...r?{facets:r}:{},...o?{groups:o}:{}};return t.includeVectors||v(a,Object.keys(e.data.index.vectorIndexes)),a}async function i(){e.beforeSearch&&await eo(e.beforeSearch,e,t,void 0);let n=o();return e.afterSearch&&await en(e.afterSearch,e,t,r,n),n}return e.beforeSearch?.length||e.afterSearch?.length?i():o()}(e,t);throw M("INVALID_SEARCH_MODE",n)}function tb(e,t,r,n){let o=e.data.docs,i=Array.from({length:n}),s=new Set;for(let l=r;l<n+r;l++){let r=t[l];if(void 0===r)break;let[n,a]=r;if(!s.has(n)){let t=e.documentsStore.get(o,n);i[l]={id:$(e.internalDocumentIDStore,n),score:a,document:t},s.add(n)}}return i}function tS(e,t){e.internalDocumentIDStore.load(e,t.internalDocumentIDStore),e.data.index=e.index.load(e.internalDocumentIDStore,t.index),e.data.docs=e.documentsStore.load(e.internalDocumentIDStore,t.docs),e.data.sorting=e.sorter.load(e.internalDocumentIDStore,t.sorting),e.data.pinning=e.pinning.load(e.internalDocumentIDStore,t.pinning),e.tokenizer.language=t.language}async function tI(e,t,r={}){let n=(0,o.r)(t);return(await ty(e,{term:t,tolerance:1,...r,boost:{title:2,..."boost"in r?r.boost:void 0}})).hits.map(e=>({type:"page",content:e.document.title,breadcrumbs:e.document.breadcrumbs,contentWithHighlights:n.highlight(e.document.title),id:e.document.url,url:e.document.url}))}async function tw(e,t,r=[],{mode:i="fulltext",...s}={}){"string"==typeof r&&(r=[r]);let l={...s,mode:i,where:(0,n.B)({tags:r.length>0?{containsAll:r}:void 0,...s.where}),groupBy:{properties:["page_id"],maxResult:8,...s.groupBy}};t.length>0&&(l={...l,term:t,properties:"fulltext"===i?["content"]:["content","embeddings"]});let a=(0,o.r)(t),u=await ty(e,l),c=[];for(let t of u.groups??[]){let r=t.values[0],n=e.documentsStore.get(e.data.docs,r);if(n)for(let e of(c.push({id:r,type:"page",content:n.content,breadcrumbs:n.breadcrumbs,contentWithHighlights:a.highlight(n.content),url:n.url}),t.result))"page"!==e.document.type&&c.push({id:e.document.id.toString(),content:e.document.content,breadcrumbs:e.document.breadcrumbs,contentWithHighlights:a.highlight(e.document.content),type:e.document.type,url:e.document.url})}return c}Symbol("orama.insertions"),Symbol("orama.removals"),r(1564);var tO=new Map;async function tN({from:e="/api/search",initOrama:t=e=>(function({schema:e,sort:t,language:r,components:n,id:o,plugins:i}){for(let t of(n||(n={}),i??[])){if(!("getComponents"in t)||"function"!=typeof t.getComponents)continue;let r=t.getComponents(e);for(let e of Object.keys(r))if(n[e])throw M("PLUGIN_COMPONENT_CONFLICT",e,t.name);n={...n,...r}}o||(o=b());let s=n.tokenizer,l=n.index,a=n.documentsStore,u=n.sorter,c=n.pinning;if(s=s?s.tokenize?s:e7(s):e7({language:r??"english"}),n.tokenizer&&r)throw M("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let f={idToInternalId:new Map,internalIdToId:[],save:W,load:j};l||={create:function e(t,r,n,o,i=""){for(let[s,l]of(o||(o={sharedInternalDocumentStore:r,indexes:{},vectorIndexes:{},searchableProperties:[],searchablePropertiesWithTypes:{},frequencies:{},tokenOccurrences:{},avgFieldLength:{},fieldLengths:{}}),Object.entries(n))){let n=`${i}${i?".":""}${s}`;if("object"==typeof l&&!Array.isArray(l)){e(t,r,l,o,n);continue}if(L(l))o.searchableProperties.push(n),o.searchablePropertiesWithTypes[n]=l,o.vectorIndexes[n]={type:"Vector",node:new ep(V(l)),isArray:!1};else{let e=/\[/.test(l);switch(l){case"boolean":case"boolean[]":o.indexes[n]={type:"Bool",node:new eh,isArray:e};break;case"number":case"number[]":o.indexes[n]={type:"AVL",node:new es(0,[]),isArray:e};break;case"string":case"string[]":o.indexes[n]={type:"Radix",node:new ec,isArray:e},o.avgFieldLength[n]=0,o.frequencies[n]={},o.tokenOccurrences[n]={},o.fieldLengths[n]={};break;case"enum":case"enum[]":o.indexes[n]={type:"Flat",node:new el,isArray:e};break;case"geopoint":o.indexes[n]={type:"BKD",node:new ed,isArray:e};break;default:throw M("INVALID_SCHEMA_TYPE",Array.isArray(l)?"array":l,n)}o.searchableProperties.push(n),o.searchablePropertiesWithTypes[n]=l}}return o},insert:eI,remove:eO,insertDocumentScoreParameters:em,insertTokenScoreParameters:ey,removeDocumentScoreParameters:eb,removeTokenScoreParameters:eS,calculateResultScores:eN,search:eT,searchByWhereClause:function e(t,r,n,o){if("and"in n&&n.and&&Array.isArray(n.and)){let i=n.and;return 0===i.length?new Set:A(...i.map(n=>e(t,r,n,o)))}if("or"in n&&n.or&&Array.isArray(n.or)){let i=n.or;return 0===i.length?new Set:i.map(n=>e(t,r,n,o)).reduce((e,t)=>k(e,t),new Set)}if("not"in n&&n.not){let i=n.not,s=new Set,l=t.sharedInternalDocumentStore;for(let e=1;e<=l.internalIdToId.length;e++)s.add(e);let a=e(t,r,i,o),u=new Set;for(let e of s)a.has(e)||u.add(e);return u}let i=Object.keys(n),s=i.reduce((e,t)=>({[t]:new Set,...e}),{});for(let e of i){let i=n[e];if(void 0===t.indexes[e])throw M("UNKNOWN_FILTER_PROPERTY",e);let{node:l,type:a,isArray:u}=t.indexes[e];if("Bool"===a){let t=i?l.true:l.false;s[e]=k(s[e],t);continue}if("BKD"===a){let t;if("radius"in i)t="radius";else if("polygon"in i)t="polygon";else throw Error(`Invalid operation ${i}`);if("radius"===t){let{value:r,coordinates:n,unit:o="m",inside:a=!0,highPrecision:u=!1}=i[t],c=T(r,o),f=l.searchByRadius(n,c,a,void 0,u);s[e]=eE(s[e],f)}else{let{coordinates:r,inside:n=!0,highPrecision:o=!1}=i[t],a=l.searchByPolygon(r,n,void 0,o);s[e]=eE(s[e],a)}continue}if("Radix"===a&&("string"==typeof i||Array.isArray(i))){for(let t of[i].flat())for(let n of r.tokenize(t,o,e)){let t=l.find({term:n,exact:!0});s[e]=function(e,t){e||(e=new Set);let r=Object.keys(t),n=r.length;for(let o=0;o<n;o++){let n=t[r[o]],i=n.length;for(let t=0;t<i;t++)e.add(n[t])}return e}(s[e],t)}continue}let c=Object.keys(i);if(c.length>1)throw M("INVALID_FILTER_OPERATION",c.length);if("Flat"===a){let t=new Set(u?l.filterArr(i):l.filter(i));s[e]=k(s[e],t);continue}if("AVL"===a){let t,r=c[0],n=i[r];switch(r){case"gt":t=l.greaterThan(n,!1);break;case"gte":t=l.greaterThan(n,!0);break;case"lt":t=l.lessThan(n,!1);break;case"lte":t=l.lessThan(n,!0);break;case"eq":t=l.find(n)??new Set;break;case"between":{let[e,r]=n;t=l.rangeSearch(e,r);break}default:throw M("INVALID_FILTER_OPERATION",r)}s[e]=k(s[e],t)}}return A(...Object.values(s))},getSearchableProperties:ev,getSearchablePropertiesWithTypes:e_,load:eD,save:eA},u||={create:eP,insert:eR,remove:eL,save:eF,load:ej,sortBy:eB,getSortableProperties:eV,getSortablePropertiesWithTypes:eW},a||={create:G,get:J,getMultiple:Y,getAll:H,store:K,remove:q,count:X,load:Z,save:Q},c||={create:e5,addRule:e6,updateRule:e2,removeRule:e3,getRule:e8,getAllRules:e4,getMatchingRules:te,load:tt,save:tr};var d=n;let h={formatElapsedTime:x,getDocumentIndexId:C,getDocumentProperties:w,validateSchema:function e(t,r){for(let[n,o]of Object.entries(r)){let r=t[n];if(void 0!==r&&("geopoint"!==o||"object"!=typeof r||"number"!=typeof r.lon||"number"!=typeof r.lat)&&("enum"!==o||"string"!=typeof r&&"number"!=typeof r)){if("enum[]"===o&&Array.isArray(r)){let e=r.length;for(let t=0;t<e;t++)if("string"!=typeof r[t]&&"number"!=typeof r[t])return n+"."+t;continue}if(L(o)){let e=V(o);if(!Array.isArray(r)||r.length!==e)throw M("INVALID_INPUT_VECTOR",n,e,r.length);continue}if(B(o)){if(!Array.isArray(r))return n;let e=z[o],t=r.length;for(let o=0;o<t;o++)if(typeof r[o]!==e)return n+"."+o;continue}if("object"==typeof o){if(!r||"object"!=typeof r)return n;let t=e(r,o);if(t)return n+"."+t;continue}if(typeof r!==o)return n}}}};for(let e of er)if(d[e]){if("function"!=typeof d[e])throw M("COMPONENT_MUST_BE_FUNCTION",e)}else d[e]=h[e];for(let e of Object.keys(d))if(!et.includes(e)&&!er.includes(e))throw M("UNSUPPORTED_COMPONENT",e);let{getDocumentProperties:p,getDocumentIndexId:g,validateSchema:m,formatElapsedTime:y}=n,S={data:{},caches:{},schema:e,tokenizer:s,index:l,sorter:u,documentsStore:a,pinning:c,internalDocumentIDStore:f,getDocumentProperties:p,getDocumentIndexId:g,validateSchema:m,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeUpsert:[],afterUpsert:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],beforeUpdateMultiple:[],afterUpdateMultiple:[],beforeUpsertMultiple:[],afterUpsertMultiple:[],afterCreate:[],formatElapsedTime:y,id:o,plugins:i,version:"{{VERSION}}"};for(let r of(S.data={index:S.index.create(S,f,e),docs:S.documentsStore.create(S,f),sorting:S.sorter.create(S,f,e,t),pinning:S.pinning.create(f)},ee))S[r]=(S[r]??[]).concat(function(e,t){let r=[],n=e.plugins?.length;if(!n)return r;for(let o=0;o<n;o++)try{let n=e.plugins[o];"function"==typeof n[t]&&r.push(n[t])}catch(e){throw console.error("Caught error in getAllPluginsByHook:",e),M("PLUGIN_CRASHED")}return r}(S,r));let I=S.afterCreate;return I&&function(e,t){if(e.some(_))return(async()=>{for(let r of e)await r(t)})();for(let r of e)r(t)}(I,S),S})({schema:{_:"string"},language:e})}){let r=tO.get(e);if(r)return r;let n=async function(){let r=await fetch(e);if(!r.ok)throw Error(`failed to fetch exported search indexes from ${e}, make sure the search database is exported and available for client.`);let n=await r.json(),o=new Map;if("i18n"===n.type)return await Promise.all(Object.entries(n.data).map(async([e,r])=>{let n=await t(e);tS(n,r),o.set(e,{type:r.type,db:n})})),o;let i=await t();return tS(i,n),o.set("",{type:n.type,db:i}),o}();return tO.set(e,n),n}async function tT(e,t){let{tag:r,locale:n}=t,o=(await tN(t)).get(n??"");return o?"simple"===o.type?tI(o,e):tw(o.db,e,r):[]}},9396:(e,t,r)=>{r.d(t,{B:()=>function e(t,r=!1){for(let n in t){if(void 0===t[n]&&delete t[n],!r)continue;let o=t[n];if("object"==typeof o&&null!==o){e(o,r);continue}if(Array.isArray(o))for(let t of o)e(t,r)}return t}})}}]);
|
|
10
|
+
`,ANSWER_SESSION_LAST_MESSAGE_IS_NOT_ASSISTANT:"The last message in the session is not an assistant message. Cannot regenerate non-assistant messages.",PLUGIN_COMPONENT_CONFLICT:'The component "%s" is already defined. The plugin "%s" is trying to redefine it.'};function M(e,...t){let r=Error(function(e,...t){return e.replace(/%(?:(?<position>\d+)\$)?(?<width>-?\d*\.?\d*)(?<type>[dfs])/g,function(...e){let{width:r,type:n,position:o}=e[e.length-1],i=o?t[Number.parseInt(o)-1]:t.shift(),s=""===r?0:Number.parseInt(r);switch(n){case"d":return i.toString().padStart(s,"0");case"f":{let e=i,[t,n]=r.split(".").map(e=>Number.parseFloat(e));return"number"==typeof n&&n>=0&&(e=e.toFixed(n)),"number"==typeof t&&t>=0?e.toString().padStart(s,"0"):e.toString()}case"s":return s<0?i.toString().padEnd(-s," "):i.toString().padStart(s," ");default:return i}})}(R[e]??`Unsupported Orama Error code: ${e}`,...t));return r.code=e,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}function x(e){return{raw:Number(e),formatted:m(e)}}function C(e){if(e.id){if("string"!=typeof e.id)throw M("DOCUMENT_ID_MUST_BE_STRING",typeof e.id);return e.id}return b()}let U={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},z={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"};function L(e){return"string"==typeof e&&/^vector\[\d+\]$/.test(e)}function B(e){return"string"==typeof e&&U[e]}function V(e){let t=Number(e.slice(7,-1));switch(!0){case isNaN(t):throw M("INVALID_VECTOR_VALUE",e);case t<=0:throw M("INVALID_VECTOR_SIZE",e);default:return t}}function W(e){return{internalIdToId:e.internalIdToId}}function j(e,t){let{internalIdToId:r}=t;e.internalDocumentIDStore.idToInternalId.clear(),e.internalDocumentIDStore.internalIdToId=[];let n=r.length;for(let t=0;t<n;t++){let n=r[t];e.internalDocumentIDStore.idToInternalId.set(n,t+1),e.internalDocumentIDStore.internalIdToId.push(n)}}function F(e,t){if("string"==typeof t){let r=e.idToInternalId.get(t);if(r)return r;let n=e.idToInternalId.size+1;return e.idToInternalId.set(t,n),e.internalIdToId.push(t),n}return t>e.internalIdToId.length?F(e,t.toString()):t}function $(e,t){if(e.internalIdToId.length<t)throw Error(`Invalid internalId ${t}`);return e.internalIdToId[t-1]}function G(e,t){return{sharedInternalDocumentStore:t,docs:{},count:0}}function J(e,t){let r=F(e.sharedInternalDocumentStore,t);return e.docs[r]}function Y(e,t){let r=t.length,n=Array.from({length:r});for(let o=0;o<r;o++){let r=F(e.sharedInternalDocumentStore,t[o]);n[o]=e.docs[r]}return n}function H(e){return e.docs}function K(e,t,r,n){return void 0===e.docs[r]&&(e.docs[r]=n,e.count++,!0)}function q(e,t){let r=F(e.sharedInternalDocumentStore,t);return void 0!==e.docs[r]&&(delete e.docs[r],e.count--,!0)}function X(e){return e.count}function Z(e,t){return{docs:t.docs,count:t.count,sharedInternalDocumentStore:e}}function Q(e){return{docs:e.docs,count:e.count}}let ee=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeUpsert","afterUpsert","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeUpsertMultiple","afterUpsertMultiple","beforeLoad","afterLoad","afterCreate"],et=["tokenizer","index","documentsStore","sorter","pinning"],er=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"];function en(e,t,r,n,o){if(e.some(_))return(async()=>{for(let i of e)await i(t,r,n,o)})();for(let i of e)i(t,r,n,o)}function eo(e,t,r,n){if(e.some(_))return(async()=>{for(let o of e)await o(t,r,n)})();for(let o of e)o(t,r,n)}class ei{k;v;l=null;r=null;h=1;constructor(e,t){this.k=e,this.v=new Set(t)}updateHeight(){this.h=Math.max(ei.getHeight(this.l),ei.getHeight(this.r))+1}static getHeight(e){return e?e.h:0}getBalanceFactor(){return ei.getHeight(this.l)-ei.getHeight(this.r)}rotateLeft(){let e=this.r;return this.r=e.l,e.l=this,this.updateHeight(),e.updateHeight(),e}rotateRight(){let e=this.l;return this.l=e.r,e.r=this,this.updateHeight(),e.updateHeight(),e}toJSON(){return{k:this.k,v:Array.from(this.v),l:this.l?this.l.toJSON():null,r:this.r?this.r.toJSON():null,h:this.h}}static fromJSON(e){let t=new ei(e.k,e.v);return t.l=e.l?ei.fromJSON(e.l):null,t.r=e.r?ei.fromJSON(e.r):null,t.h=e.h,t}}class es{root=null;insertCount=0;constructor(e,t){void 0!==e&&void 0!==t&&(this.root=new ei(e,t))}insert(e,t,r=1e3){this.root=this.insertNode(this.root,e,t,r)}insertMultiple(e,t,r=1e3){for(let n of t)this.insert(e,n,r)}rebalance(){this.root&&(this.root=this.rebalanceNode(this.root))}toJSON(){return{root:this.root?this.root.toJSON():null,insertCount:this.insertCount}}static fromJSON(e){let t=new es;return t.root=e.root?ei.fromJSON(e.root):null,t.insertCount=e.insertCount||0,t}insertNode(e,t,r,n){if(null===e)return new ei(t,[r]);let o=[],i=e,s=null;for(;null!==i;)if(o.push({parent:s,node:i}),t<i.k)if(null===i.l){i.l=new ei(t,[r]),o.push({parent:i,node:i.l});break}else s=i,i=i.l;else if(!(t>i.k))return i.v.add(r),e;else if(null===i.r){i.r=new ei(t,[r]),o.push({parent:i,node:i.r});break}else s=i,i=i.r;let l=!1;this.insertCount++%n==0&&(l=!0);for(let t=o.length-1;t>=0;t--){let{parent:r,node:n}=o[t];if(n.updateHeight(),l){let t=this.rebalanceNode(n);r?r.l===n?r.l=t:r.r===n&&(r.r=t):e=t}}return e}rebalanceNode(e){let t=e.getBalanceFactor();if(t>1){if(e.l&&e.l.getBalanceFactor()>=0)return e.rotateRight();else if(e.l)return e.l=e.l.rotateLeft(),e.rotateRight()}if(t<-1){if(e.r&&0>=e.r.getBalanceFactor())return e.rotateLeft();else if(e.r)return e.r=e.r.rotateRight(),e.rotateLeft()}return e}find(e){let t=this.findNodeByKey(e);return t?t.v:null}contains(e){return null!==this.find(e)}getSize(){let e=0,t=[],r=this.root;for(;r||t.length>0;){for(;r;)t.push(r),r=r.l;r=t.pop(),e++,r=r.r}return e}isBalanced(){if(!this.root)return!0;let e=[this.root];for(;e.length>0;){let t=e.pop();if(Math.abs(t.getBalanceFactor())>1)return!1;t.l&&e.push(t.l),t.r&&e.push(t.r)}return!0}remove(e){this.root=this.removeNode(this.root,e)}removeDocument(e,t){let r=this.findNodeByKey(e);r&&(1===r.v.size?this.root=this.removeNode(this.root,e):r.v=new Set([...r.v.values()].filter(e=>e!==t)))}findNodeByKey(e){let t=this.root;for(;t;)if(e<t.k)t=t.l;else{if(!(e>t.k))return t;t=t.r}return null}removeNode(e,t){if(null===e)return null;let r=[],n=e;for(;null!==n&&n.k!==t;)r.push(n),n=t<n.k?n.l:n.r;if(null===n)return e;if(null===n.l||null===n.r){let t=n.l?n.l:n.r;if(0===r.length)e=t;else{let e=r[r.length-1];e.l===n?e.l=t:e.r=t}}else{let e=n,t=n.r;for(;null!==t.l;)e=t,t=t.l;n.k=t.k,n.v=t.v,e.l===t?e.l=t.r:e.r=t.r,n=e}r.push(n);for(let t=r.length-1;t>=0;t--){let n=r[t];n.updateHeight();let o=this.rebalanceNode(n);if(t>0){let e=r[t-1];e.l===n?e.l=o:e.r===n&&(e.r=o)}else e=o}return e}rangeSearch(e,t){let r=new Set,n=[],o=this.root;for(;o||n.length>0;){for(;o;)n.push(o),o=o.l;if((o=n.pop()).k>=e&&o.k<=t)for(let e of o.v)r.add(e);if(o.k>t)break;o=o.r}return r}greaterThan(e,t=!1){let r=new Set,n=[],o=this.root;for(;o||n.length>0;){for(;o;)n.push(o),o=o.r;if(o=n.pop(),t&&o.k>=e||!t&&o.k>e)for(let e of o.v)r.add(e);else if(o.k<=e)break;o=o.l}return r}lessThan(e,t=!1){let r=new Set,n=[],o=this.root;for(;o||n.length>0;){for(;o;)n.push(o),o=o.l;if(o=n.pop(),t&&o.k<=e||!t&&o.k<e)for(let e of o.v)r.add(e);else if(o.k>e)break;o=o.r}return r}}class el{numberToDocumentId;constructor(){this.numberToDocumentId=new Map}insert(e,t){this.numberToDocumentId.has(e)?this.numberToDocumentId.get(e).add(t):this.numberToDocumentId.set(e,new Set([t]))}find(e){let t=this.numberToDocumentId.get(e);return t?Array.from(t):null}remove(e){this.numberToDocumentId.delete(e)}removeDocument(e,t){let r=this.numberToDocumentId.get(t);r&&(r.delete(e),0===r.size&&this.numberToDocumentId.delete(t))}contains(e){return this.numberToDocumentId.has(e)}getSize(){let e=0;for(let t of this.numberToDocumentId.values())e+=t.size;return e}filter(e){let t=Object.keys(e);if(1!==t.length)throw Error("Invalid operation");let r=t[0];switch(r){case"eq":{let t=e[r],n=this.numberToDocumentId.get(t);return n?Array.from(n):[]}case"in":{let t=e[r],n=new Set;for(let e of t){let t=this.numberToDocumentId.get(e);if(t)for(let e of t)n.add(e)}return Array.from(n)}case"nin":{let t=new Set(e[r]),n=new Set;for(let[e,r]of this.numberToDocumentId.entries())if(!t.has(e))for(let e of r)n.add(e);return Array.from(n)}default:throw Error("Invalid operation")}}filterArr(e){let t=Object.keys(e);if(1!==t.length)throw Error("Invalid operation");let r=t[0];switch(r){case"containsAll":{let t=e[r].map(e=>this.numberToDocumentId.get(e)??new Set);if(0===t.length)return[];return Array.from(t.reduce((e,t)=>new Set([...e].filter(e=>t.has(e)))))}case"containsAny":{let t=e[r].map(e=>this.numberToDocumentId.get(e)??new Set);if(0===t.length)return[];return Array.from(t.reduce((e,t)=>new Set([...e,...t])))}default:throw Error("Invalid operation")}}static fromJSON(e){if(!e.numberToDocumentId)throw Error("Invalid Flat Tree JSON");let t=new el;for(let[r,n]of e.numberToDocumentId)t.numberToDocumentId.set(r,new Set(n));return t}toJSON(){return{numberToDocumentId:Array.from(this.numberToDocumentId.entries()).map(([e,t])=>[e,Array.from(t)])}}}function ea(e,t,r){let n=function(e,t,r){if(r<0)return -1;if(e===t)return 0;let n=e.length,o=t.length;if(0===n)return o<=r?o:-1;if(0===o)return n<=r?n:-1;let i=Math.abs(n-o);if(e.startsWith(t))return i<=r?i:-1;if(t.startsWith(e))return 0;if(i>r)return -1;let s=[];for(let e=0;e<=n;e++){s[e]=[e];for(let t=1;t<=o;t++)s[e][t]=0===e?t:0}for(let i=1;i<=n;i++){let n=1/0;for(let r=1;r<=o;r++)e[i-1]===t[r-1]?s[i][r]=s[i-1][r-1]:s[i][r]=Math.min(s[i-1][r]+1,s[i][r-1]+1,s[i-1][r-1]+1),n=Math.min(n,s[i][r]);if(n>r)return -1}return s[n][o]<=r?s[n][o]:-1}(e,t,r);return{distance:n,isBounded:n>=0}}class eu{k;s;c=new Map;d=new Set;e;w="";constructor(e,t,r){this.k=e,this.s=t,this.e=r}updateParent(e){this.w=e.w+this.s}addDocument(e){this.d.add(e)}removeDocument(e){return this.d.delete(e)}findAllWords(e,t,r,n){let o=[this];for(;o.length>0;){let i=o.pop();if(i.e){let{w:o,d:s}=i;if(r&&o!==t)continue;if(null!==S(e,o))if(n){if(!(Math.abs(t.length-o.length)<=n)||!ea(t,o,n).isBounded)continue;e[o]=[]}else e[o]=[];if(null!=S(e,o)&&s.size>0){let t=e[o];for(let e of s)t.includes(e)||t.push(e)}}i.c.size>0&&o.push(...i.c.values())}return e}insert(e,t){let r=this,n=0,o=e.length;for(;n<o;){let i=e[n],s=r.c.get(i);if(s){let i=s.s,l=i.length,a=0;for(;a<l&&n+a<o&&i[a]===e[n+a];)a++;if(a===l){if(r=s,(n+=a)===o){s.e||(s.e=!0),s.addDocument(t);return}continue}let u=i.slice(0,a),c=i.slice(a),f=e.slice(n+a),d=new eu(u[0],u,!1);if(r.c.set(u[0],d),d.updateParent(r),s.s=c,s.k=c[0],d.c.set(c[0],s),s.updateParent(d),f){let e=new eu(f[0],f,!0);e.addDocument(t),d.c.set(f[0],e),e.updateParent(d)}else d.e=!0,d.addDocument(t);return}{let o=new eu(i,e.slice(n),!0);o.addDocument(t),r.c.set(i,o),o.updateParent(r);return}}r.e||(r.e=!0),r.addDocument(t)}_findLevenshtein(e,t,r,n,o){let i=[{node:this,index:t,tolerance:r}];for(;i.length>0;){let{node:t,index:r,tolerance:s}=i.pop();if(t.w.startsWith(e)){t.findAllWords(o,e,!1,0);continue}if(s<0)continue;if(t.e){let{w:r,d:i}=t;if(r&&(ea(e,r,n).isBounded&&(o[r]=[]),void 0!==S(o,r)&&i.size>0)){let e=new Set(o[r]);for(let t of i)e.add(t);o[r]=Array.from(e)}}if(r>=e.length)continue;let l=e[r];if(t.c.has(l)){let e=t.c.get(l);i.push({node:e,index:r+1,tolerance:s})}for(let[e,n]of(i.push({node:t,index:r+1,tolerance:s-1}),t.c))i.push({node:n,index:r,tolerance:s-1}),e!==l&&i.push({node:n,index:r+1,tolerance:s-1})}}find(e){let{term:t,exact:r,tolerance:n}=e;if(n&&!r){let e={};return this._findLevenshtein(t,0,n,n,e),e}{let e=this,o=0,i=t.length;for(;o<i;){let s=t[o],l=e.c.get(s);if(!l)return{};{let s=l.s,a=s.length,u=0;for(;u<a&&o+u<i&&s[u]===t[o+u];)u++;if(u===a)e=l,o+=u;else{if(o+u!==i||u!==i-o||r)return{};let e={};return l.findAllWords(e,t,r,n),e}}}let s={};return e.findAllWords(s,t,r,n),s}}contains(e){let t=this,r=0,n=e.length;for(;r<n;){let o=e[r],i=t.c.get(o);if(!i)return!1;{let o=i.s,s=o.length,l=0;for(;l<s&&r+l<n&&o[l]===e[r+l];)l++;if(l<s)return!1;r+=s,t=i}}return!0}removeWord(e){if(!e)return!1;let t=this,r=e.length,n=[];for(let o=0;o<r;o++){let r=e[o];if(!t.c.has(r))return!1;{let e=t.c.get(r);n.push({parent:t,character:r}),o+=e.s.length-1,t=e}}for(t.d.clear(),t.e=!1;n.length>0&&0===t.c.size&&!t.e&&0===t.d.size;){let{parent:e,character:r}=n.pop();e.c.delete(r),t=e}return!0}removeDocumentByWord(e,t,r=!0){if(!e)return!0;let n=this,o=e.length;for(let i=0;i<o;i++){let o=e[i];if(!n.c.has(o))return!1;{let s=n.c.get(o);i+=s.s.length-1,n=s,r&&n.w!==e||n.removeDocument(t)}}return!0}static getCommonPrefix(e,t){let r=Math.min(e.length,t.length),n=0;for(;n<r&&e.charCodeAt(n)===t.charCodeAt(n);)n++;return e.slice(0,n)}toJSON(){return{w:this.w,s:this.s,e:this.e,k:this.k,d:Array.from(this.d),c:Array.from(this.c?.entries())?.map(([e,t])=>[e,t.toJSON()])}}static fromJSON(e){let t=new eu(e.k,e.s,e.e);return t.w=e.w,t.d=new Set(e.d),t.c=new Map(e?.c?.map(([e,t])=>[e,eu.fromJSON(t)])||[]),t}}class ec extends eu{constructor(){super("","",!1)}static fromJSON(e){let t=new ec;return t.w=e.w,t.s=e.s,t.e=e.e,t.k=e.k,t.d=new Set(e.d),t.c=new Map(e?.c?.map(([e,t])=>[e,eu.fromJSON(t)])||[]),t}toJSON(){return super.toJSON()}}class ef{point;docIDs;left;right;parent;constructor(e,t){this.point=e,this.docIDs=new Set(t),this.left=null,this.right=null,this.parent=null}toJSON(){return{point:this.point,docIDs:Array.from(this.docIDs),left:this.left?this.left.toJSON():null,right:this.right?this.right.toJSON():null}}static fromJSON(e,t=null){let r=new ef(e.point,e.docIDs);return r.parent=t,e.left&&(r.left=ef.fromJSON(e.left,r)),e.right&&(r.right=ef.fromJSON(e.right,r)),r}}class ed{root;nodeMap;constructor(){this.root=null,this.nodeMap=new Map}getPointKey(e){return`${e.lon},${e.lat}`}insert(e,t){let r=this.getPointKey(e),n=this.nodeMap.get(r);if(n)return void t.forEach(e=>n.docIDs.add(e));let o=new ef(e,t);if(this.nodeMap.set(r,o),null==this.root){this.root=o;return}let i=this.root,s=0;for(;;){if(0==s%2)if(e.lon<i.point.lon){if(null==i.left){i.left=o,o.parent=i;return}i=i.left}else{if(null==i.right){i.right=o,o.parent=i;return}i=i.right}else if(e.lat<i.point.lat){if(null==i.left){i.left=o,o.parent=i;return}i=i.left}else{if(null==i.right){i.right=o,o.parent=i;return}i=i.right}s++}}contains(e){let t=this.getPointKey(e);return this.nodeMap.has(t)}getDocIDsByCoordinates(e){let t=this.getPointKey(e),r=this.nodeMap.get(t);return r?Array.from(r.docIDs):null}removeDocByID(e,t){let r=this.getPointKey(e),n=this.nodeMap.get(r);n&&(n.docIDs.delete(t),0===n.docIDs.size&&(this.nodeMap.delete(r),this.deleteNode(n)))}deleteNode(e){let t=e.parent,r=e.left?e.left:e.right;r&&(r.parent=t),t?t.left===e?t.left=r:t.right===e&&(t.right=r):(this.root=r,this.root&&(this.root.parent=null))}searchByRadius(e,t,r=!0,n="asc",o=!1){let i=o?ed.vincentyDistance:ed.haversineDistance,s=[{node:this.root,depth:0}],l=[];for(;s.length>0;){let{node:n,depth:o}=s.pop();if(null==n)continue;let a=i(e,n.point);(r?a<=t:a>t)&&l.push({point:n.point,docIDs:Array.from(n.docIDs)}),null!=n.left&&s.push({node:n.left,depth:o+1}),null!=n.right&&s.push({node:n.right,depth:o+1})}return n&&l.sort((t,r)=>{let o=i(e,t.point),s=i(e,r.point);return"asc"===n.toLowerCase()?o-s:s-o}),l}searchByPolygon(e,t=!0,r=null,n=!1){let o=[{node:this.root,depth:0}],i=[];for(;o.length>0;){let{node:r,depth:n}=o.pop();if(null==r)continue;null!=r.left&&o.push({node:r.left,depth:n+1}),null!=r.right&&o.push({node:r.right,depth:n+1});let s=ed.isPointInPolygon(e,r.point);(s&&t||!s&&!t)&&i.push({point:r.point,docIDs:Array.from(r.docIDs)})}let s=ed.calculatePolygonCentroid(e);if(r){let e=n?ed.vincentyDistance:ed.haversineDistance;i.sort((t,n)=>{let o=e(s,t.point),i=e(s,n.point);return"asc"===r.toLowerCase()?o-i:i-o})}return i}toJSON(){return{root:this.root?this.root.toJSON():null}}static fromJSON(e){let t=new ed;return e.root&&(t.root=ef.fromJSON(e.root),t.buildNodeMap(t.root)),t}buildNodeMap(e){if(null==e)return;let t=this.getPointKey(e.point);this.nodeMap.set(t,e),e.left&&this.buildNodeMap(e.left),e.right&&this.buildNodeMap(e.right)}static calculatePolygonCentroid(e){let t=0,r=0,n=0,o=e.length;for(let i=0,s=o-1;i<o;s=i++){let o=e[i].lon,l=e[i].lat,a=e[s].lon,u=e[s].lat,c=o*u-a*l;t+=c,r+=(o+a)*c,n+=(l+u)*c}let i=6*(t/=2);return{lon:r/=i,lat:n/=i}}static isPointInPolygon(e,t){let r=!1,n=t.lon,o=t.lat,i=e.length;for(let t=0,s=i-1;t<i;s=t++){let i=e[t].lon,l=e[t].lat,a=e[s].lon,u=e[s].lat;l>o!=u>o&&n<(a-i)*(o-l)/(u-l)+i&&(r=!r)}return r}static haversineDistance(e,t){let r=Math.PI/180,n=e.lat*r,o=t.lat*r,i=(t.lat-e.lat)*r,s=(t.lon-e.lon)*r,l=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(o)*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l))*6371e3}static vincentyDistance(e,t){let r,n,o,i,s,l,a,u=1/298.257223563,c=(1-1/298.257223563)*6378137,f=Math.PI/180,d=e.lat*f,h=t.lat*f,p=(t.lon-e.lon)*f,g=Math.atan((1-u)*Math.tan(d)),m=Math.atan((1-u)*Math.tan(h)),y=Math.sin(g),b=Math.cos(g),S=Math.sin(m),I=Math.cos(m),w=p,O=1e3;do{let e=Math.sin(w),t=Math.cos(w);if(0===(n=Math.sqrt(I*e*(I*e)+(b*S-y*I*t)*(b*S-y*I*t))))return 0;i=Math.atan2(n,o=y*S+b*I*t),isNaN(a=o-2*y*S/(l=1-(s=b*I*e/n)*s))&&(a=0);let c=u/16*l*(4+u*(4-3*l));r=w,w=p+(1-c)*u*s*(i+c*n*(a+c*o*(-1+2*a*a)))}while(Math.abs(w-r)>1e-12&&--O>0);if(0===O)return NaN;let N=l*(0x24ffb2985f71-c*c)/(c*c),T=1+N/16384*(4096+N*(-768+N*(320-175*N))),v=N/1024*(256+N*(-128+N*(74-47*N)));return c*T*(i-v*n*(a+v/4*(o*(-1+2*a*a)-v/6*a*(-3+4*n*n)*(-3+4*a*a))))}}class eh{true;false;constructor(){this.true=new Set,this.false=new Set}insert(e,t){t?this.true.add(e):this.false.add(e)}delete(e,t){t?this.true.delete(e):this.false.delete(e)}getSize(){return this.true.size+this.false.size}toJSON(){return{true:Array.from(this.true),false:Array.from(this.false)}}static fromJSON(e){let t=new eh;return t.true=new Set(e.true),t.false=new Set(e.false),t}}class ep{size;vectors=new Map;constructor(e){this.size=e}add(e,t){t instanceof Float32Array||(t=new Float32Array(t));let r=eg(t,this.size);this.vectors.set(e,[r,t])}remove(e){this.vectors.delete(e)}find(e,t,r){return e instanceof Float32Array||(e=new Float32Array(e)),function(e,t,r,n,o){let i=eg(e,n),s=[];for(let l of t||r.keys()){let t=r.get(l);if(!t)continue;let a=t[0],u=t[1],c=0;for(let t=0;t<n;t++)c+=e[t]*u[t];let f=c/(i*a);f>=o&&s.push([l,f])}return s}(e,r,this.vectors,this.size,t)}toJSON(){let e=[];for(let[t,[r,n]]of this.vectors)e.push([t,[r,Array.from(n)]]);return{size:this.size,vectors:e}}static fromJSON(e){let t=new ep(e.size);for(let[r,[n,o]]of e.vectors)t.vectors.set(r,[n,new Float32Array(o)]);return t}}function eg(e,t){let r=0;for(let n=0;n<t;n++)r+=e[n]*e[n];return Math.sqrt(r)}function em(e,t,r,n,o){let i=F(e.sharedInternalDocumentStore,r);e.avgFieldLength[t]=((e.avgFieldLength[t]??0)*(o-1)+n.length)/o,e.fieldLengths[t][i]=n.length,e.frequencies[t][i]={}}function ey(e,t,r,n,o){let i=0;for(let e of n)e===o&&i++;let s=F(e.sharedInternalDocumentStore,r),l=i/n.length;e.frequencies[t][s][o]=l,o in e.tokenOccurrences[t]||(e.tokenOccurrences[t][o]=0),e.tokenOccurrences[t][o]=(e.tokenOccurrences[t][o]??0)+1}function eb(e,t,r,n){let o=F(e.sharedInternalDocumentStore,r);n>1?e.avgFieldLength[t]=(e.avgFieldLength[t]*n-e.fieldLengths[t][o])/(n-1):e.avgFieldLength[t]=void 0,e.fieldLengths[t][o]=void 0,e.frequencies[t][o]=void 0}function eS(e,t,r){e.tokenOccurrences[t][r]--}function eI(e,t,r,n,o,i,s,l,a,u,c){if(L(s)){var f,d,h,p;return f=t,d=r,h=i,p=o,void f.vectorIndexes[d].node.add(p,h)}let g=n=>{let{type:i,node:s}=t.indexes[r];switch(i){case"Bool":s[n?"true":"false"].add(o);break;case"AVL":{let e=c?.avlRebalanceThreshold??1;s.insert(n,o,e);break}case"Radix":{let i=a.tokenize(n,l,r,!1);for(let n of(e.insertDocumentScoreParameters(t,r,o,i,u),i))e.insertTokenScoreParameters(t,r,o,i,n),s.insert(n,o);break}case"Flat":s.insert(n,o);break;case"BKD":s.insert(n,[o])}};if(!B(s))return g(i);let m=i.length;for(let e=0;e<m;e++)g(i[e])}function ew(e,t,r,n,o,i,s,l,a,u){if(L(s))return t.vectorIndexes[r].node.remove(o),!0;let{type:c,node:f}=t.indexes[r];switch(c){case"AVL":return f.removeDocument(i,o),!0;case"Bool":return f[i?"true":"false"].delete(o),!0;case"Radix":{let s=a.tokenize(i,l,r);for(let i of(e.removeDocumentScoreParameters(t,r,n,u),s))e.removeTokenScoreParameters(t,r,i),f.removeDocumentByWord(i,o);return!0}case"Flat":return f.removeDocument(o,i),!0;case"BKD":return f.removeDocByID(i,o),!1}}function eO(e,t,r,n,o,i,s,l,a,u){if(!B(s))return ew(e,t,r,n,o,i,s,l,a,u);let c=z[s],f=i.length;for(let s=0;s<f;s++)ew(e,t,r,n,o,i[s],c,l,a,u);return!0}function eN(e,t,r,n,o,i,s,l,a,u){let c=Array.from(n),f=e.avgFieldLength[t],d=e.fieldLengths[t],h=e.tokenOccurrences[t],p=e.frequencies[t],g="number"==typeof h[r]?h[r]??0:0,m=c.length;for(let e=0;e<m;e++){let n=c[e];if(a&&!a.has(n))continue;u.has(n)||u.set(n,new Map);let h=u.get(n);h.set(t,(h.get(t)||0)+1);let m=function(e,t,r,n,o,{k:i,b:s,d:l}){return Math.log(1+(r-t+.5)/(t+.5))*(l+e*(i+1))/(e+i*(1-s+s*n/o))}(p?.[n]?.[r]??0,g,o,d[n],f,i);s.has(n)?s.set(n,s.get(n)+m*l):s.set(n,m*l)}}function eT(e,t,r,n,o,i,s,l,a,u,c,f=0){let d=r.tokenize(t,n),h=d.length||1,p=new Map,g=new Map,m=new Map;for(let r of o){if(!(r in e.indexes))continue;let n=e.indexes[r],{type:o}=n;if("Radix"!==o)throw M("WRONG_SEARCH_PROPERTY_TYPE",r);let f=l[r]??1;if(f<=0)throw M("INVALID_BOOST_VALUE",f);0!==d.length||t||d.push("");let h=d.length;for(let t=0;t<h;t++){let o=d[t],l=n.node.find({term:o,exact:i,tolerance:s}),h=Object.keys(l);h.length>0&&g.set(o,!0);let y=h.length;for(let t=0;t<y;t++){let n=h[t],o=l[n];eN(e,r,n,o,u,a,m,f,c,p)}}}let y=Array.from(m.entries()).map(([e,t])=>[e,t]).sort((e,t)=>t[1]-e[1]);if(0===y.length)return[];if(1===f)return y;if(0===f){if(1===h)return y;for(let e of d)if(!g.get(e))return[];return y.filter(([e])=>{let t=p.get(e);return!!t&&Array.from(t.values()).some(e=>e===h)})}let b=y.filter(([e])=>{let t=p.get(e);return!!t&&Array.from(t.values()).some(e=>e===h)});if(b.length>0){let e=y.filter(([e])=>!b.some(([t])=>t===e)),t=Math.ceil(e.length*f);return[...b,...e.slice(0,t)]}return y}function ev(e){return e.searchableProperties}function e_(e){return e.searchablePropertiesWithTypes}function eD(e,t){let{indexes:r,vectorIndexes:n,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:s,tokenOccurrences:l,avgFieldLength:a,fieldLengths:u}=t,c={},f={};for(let e of Object.keys(r)){let{node:t,type:n,isArray:o}=r[e];switch(n){case"Radix":c[e]={type:"Radix",node:ec.fromJSON(t),isArray:o};break;case"Flat":c[e]={type:"Flat",node:el.fromJSON(t),isArray:o};break;case"AVL":c[e]={type:"AVL",node:es.fromJSON(t),isArray:o};break;case"BKD":c[e]={type:"BKD",node:ed.fromJSON(t),isArray:o};break;case"Bool":c[e]={type:"Bool",node:eh.fromJSON(t),isArray:o};break;default:c[e]=r[e]}}for(let e of Object.keys(n))f[e]={type:"Vector",isArray:!1,node:ep.fromJSON(n[e])};return{sharedInternalDocumentStore:e,indexes:c,vectorIndexes:f,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:s,tokenOccurrences:l,avgFieldLength:a,fieldLengths:u}}function eA(e){let{indexes:t,vectorIndexes:r,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:s,avgFieldLength:l,fieldLengths:a}=e,u={};for(let e of Object.keys(r))u[e]=r[e].node.toJSON();let c={};for(let e of Object.keys(t)){let{type:r,node:n,isArray:o}=t[e];"Flat"===r||"Radix"===r||"AVL"===r||"BKD"===r||"Bool"===r?c[e]={type:r,node:n.toJSON(),isArray:o}:(c[e]=t[e],c[e].node=c[e].node.toJSON())}return{indexes:c,vectorIndexes:u,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:s,avgFieldLength:l,fieldLengths:a}}function eE(e,t){e||(e=new Set);let r=t.length;for(let n=0;n<r;n++){let r=t[n].docIDs,o=r.length;for(let t=0;t<o;t++)e.add(r[t])}return e}function ek(e,t,r=!1){let n=r?ed.vincentyDistance:ed.haversineDistance,o=[],i=[];for(let{point:r}of e)i.push(n(t,r));let s=Math.max(...i),l=0;for(let{docIDs:t}of e){let e=s-i[l]+1;for(let r of t)o.push([r,e]);l++}return o.sort((e,t)=>t[1]-e[1]),o}function eP(e,t,r,n){return n?.enabled===!1?{disabled:!0}:function e(t,r,n,o,i){let s={language:t.tokenizer.language,sharedInternalDocumentStore:r,enabled:!0,isSorted:!0,sortableProperties:[],sortablePropertiesWithTypes:{},sorts:{}};for(let[l,a]of Object.entries(n)){let n=`${i}${i?".":""}${l}`;if(!o.includes(n)){if("object"==typeof a&&!Array.isArray(a)){let i=e(t,r,a,o,n);p(s.sortableProperties,i.sortableProperties),s.sorts={...s.sorts,...i.sorts},s.sortablePropertiesWithTypes={...s.sortablePropertiesWithTypes,...i.sortablePropertiesWithTypes};continue}if(!L(a))switch(a){case"boolean":case"number":case"string":s.sortableProperties.push(n),s.sortablePropertiesWithTypes[n]=a,s.sorts[n]={docs:new Map,orderedDocsToRemove:new Map,orderedDocs:[],type:a};break;case"geopoint":case"enum":case"enum[]":case"boolean[]":case"number[]":case"string[]":continue;default:throw M("INVALID_SORT_SCHEMA_TYPE",Array.isArray(a)?"array":a,n)}}}return s}(e,t,r,(n||{}).unsortableProperties||[],"")}function eR(e,t,r,n){if(!e.enabled)return;e.isSorted=!1;let o=F(e.sharedInternalDocumentStore,r),i=e.sorts[t];i.orderedDocsToRemove.has(o)&&ez(e,t),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function eM(e){if(!e.isSorted&&e.enabled){for(let t of Object.keys(e.sorts))!function(e,t){let r,n=e.sorts[t];switch(n.type){case"string":r=ex.bind(null,e.language);break;case"number":r=eC.bind(null);break;case"boolean":r=eU.bind(null)}n.orderedDocs.sort(r);let o=n.orderedDocs.length;for(let e=0;e<o;e++){let t=n.orderedDocs[e][0];n.docs.set(t,e)}}(e,t);e.isSorted=!0}}function ex(e,t,r){return t[1].localeCompare(r[1],void 0!==e&&l.includes(e)?i[e]:void 0)}function eC(e,t){return e[1]-t[1]}function eU(e,t){return t[1]?-1:1}function ez(e,t){let r=e.sorts[t];r.orderedDocsToRemove.size&&(r.orderedDocs=r.orderedDocs.filter(e=>!r.orderedDocsToRemove.has(e[0])),r.orderedDocsToRemove.clear())}function eL(e,t,r){if(!e.enabled)return;let n=e.sorts[t],o=F(e.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function eB(e,t,r){if(!e.enabled)throw M("SORT_DISABLED");let n=r.property,o="DESC"===r.order,i=e.sorts[n];if(!i)throw M("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,e.sortableProperties.join(", "));return ez(e,n),eM(e),t.sort((t,r)=>{let n=i.docs.get(F(e.sharedInternalDocumentStore,t[0])),s=i.docs.get(F(e.sharedInternalDocumentStore,r[0])),l=void 0!==n,a=void 0!==s;return l||a?l?a?o?s-n:n-s:-1:1:0}),t}function eV(e){return e.enabled?e.sortableProperties:[]}function eW(e){return e.enabled?e.sortablePropertiesWithTypes:{}}function ej(e,t){if(!t.enabled)return{enabled:!1};let r=Object.keys(t.sorts).reduce((e,r)=>{let{docs:n,orderedDocs:o,type:i}=t.sorts[r];return e[r]={docs:new Map(Object.entries(n).map(([e,t])=>[+e,t])),orderedDocsToRemove:new Map,orderedDocs:o,type:i},e},{});return{sharedInternalDocumentStore:e,language:t.language,sortableProperties:t.sortableProperties,sortablePropertiesWithTypes:t.sortablePropertiesWithTypes,sorts:r,enabled:!0,isSorted:t.isSorted}}function eF(e){if(!e.enabled)return{enabled:!1};for(let t of Object.keys(e.sorts))ez(e,t);eM(e);let t=Object.keys(e.sorts).reduce((t,r)=>{let{docs:n,orderedDocs:o,type:i}=e.sorts[r];return t[r]={docs:Object.fromEntries(n.entries()),orderedDocs:o,type:i},t},{});return{language:e.language,sortableProperties:e.sortableProperties,sortablePropertiesWithTypes:e.sortablePropertiesWithTypes,sorts:t,enabled:e.enabled,isSorted:e.isSorted}}let e$=[65,65,65,65,65,65,65,67,69,69,69,69,73,73,73,73,69,78,79,79,79,79,79,null,79,85,85,85,85,89,80,115,97,97,97,97,97,97,97,99,101,101,101,101,105,105,105,105,101,110,111,111,111,111,111,null,111,117,117,117,117,121,112,121,65,97,65,97,65,97,67,99,67,99,67,99,67,99,68,100,68,100,69,101,69,101,69,101,69,101,69,101,71,103,71,103,71,103,71,103,72,104,72,104,73,105,73,105,73,105,73,105,73,105,73,105,74,106,75,107,107,76,108,76,108,76,108,76,108,76,108,78,110,78,110,78,110,110,78,110,79,111,79,111,79,111,79,111,82,114,82,114,82,114,83,115,83,115,83,115,83,115,84,116,84,116,84,116,85,117,85,117,85,117,85,117,85,117,85,117,87,119,89,121,89,90,122,90,122,90,122,115],eG={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},eJ={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},eY="[aeiouy]",eH="[^aeiou][^aeiouy]*",eK=eY+"[aeiou]*",eq="^("+eH+")?"+eK+eH,eX="^("+eH+")?"+eK+eH+"("+eK+")?$",eZ="^("+eH+")?"+eK+eH+eK+eH,eQ="^("+eH+")?"+eY;function e0(e){let t,r,n,o,i,s;if(e.length<3)return e;let l=e.substring(0,1);if("y"==l&&(e=l.toUpperCase()+e.substring(1)),o=/^(.+?)([^s])s$/,(n=/^(.+?)(ss|i)es$/).test(e)?e=e.replace(n,"$1$2"):o.test(e)&&(e=e.replace(o,"$1$2")),o=/^(.+?)(ed|ing)$/,(n=/^(.+?)eed$/).test(e)){let t=n.exec(e);(n=new RegExp(eq)).test(t[1])&&(n=/.$/,e=e.replace(n,""))}else o.test(e)&&(t=o.exec(e)[1],(o=new RegExp(eQ)).test(t)&&(e=t,o=/(at|bl|iz)$/,i=RegExp("([^aeiouylsz])\\1$"),s=RegExp("^"+eH+eY+"[^aeiouwxy]$"),o.test(e)?e+="e":i.test(e)?(n=/.$/,e=e.replace(n,"")):s.test(e)&&(e+="e")));if((n=/^(.+?)y$/).test(e)){let r=n.exec(e);t=r?.[1],n=new RegExp(eQ),t&&n.test(t)&&(e=t+"i")}if((n=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/).test(e)){let o=n.exec(e);t=o?.[1],r=o?.[2],n=new RegExp(eq),t&&n.test(t)&&(e=t+eG[r])}if((n=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/).test(e)){let o=n.exec(e);t=o?.[1],r=o?.[2],n=new RegExp(eq),t&&n.test(t)&&(e=t+eJ[r])}if(o=/^(.+?)(s|t)(ion)$/,(n=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/).test(e)){let r=n.exec(e);t=r?.[1],n=new RegExp(eZ),t&&n.test(t)&&(e=t)}else if(o.test(e)){let r=o.exec(e);t=r?.[1]??""+r?.[2]??"",(o=new RegExp(eZ)).test(t)&&(e=t)}if((n=/^(.+?)e$/).test(e)){let r=n.exec(e);t=r?.[1],n=new RegExp(eZ),o=new RegExp(eX),i=RegExp("^"+eH+eY+"[^aeiouwxy]$"),t&&(n.test(t)||o.test(t)&&!i.test(t))&&(e=t)}return n=/ll$/,o=new RegExp(eZ),n.test(e)&&o.test(e)&&(n=/.$/,e=e.replace(n,"")),"y"==l&&(e=l.toLowerCase()+e.substring(1)),e}function e1(e,t,r=!0){let n=`${this.language}:${e}:${t}`;return r&&this.normalizationCache.has(n)?this.normalizationCache.get(n):this.stopWords?.includes(t)?(r&&this.normalizationCache.set(n,""),""):(this.stemmer&&!this.stemmerSkipProperties.has(e)&&(t=this.stemmer(t)),t=function(e){let t=[];for(let n=0;n<e.length;n++){var r;t[n]=(r=e.charCodeAt(n))<192||r>383?r:e$[r-192]||r}return String.fromCharCode(...t)}(t),r&&this.normalizationCache.set(n,t),t)}function e9(e,t,r,n=!0){let o;if(t&&t!==this.language)throw M("LANGUAGE_NOT_SUPPORTED",t);if("string"!=typeof e)return[e];let i=this.normalizeToken.bind(this,r??"");if(r&&this.tokenizeSkipProperties.has(r))o=[i(e,n)];else{let t=s[this.language];o=e.toLowerCase().split(t).map(e=>i(e,n)).filter(Boolean)}let l=function(e){for(;""===e[e.length-1];)e.pop();for(;""===e[0];)e.shift();return e}(o);return this.allowDuplicates?l:Array.from(new Set(l))}function e7(e={}){let t,r;if(e.language){if(!l.includes(e.language))throw M("LANGUAGE_NOT_SUPPORTED",e.language)}else e.language="english";if(e.stemming||e.stemmer&&!("stemming"in e))if(e.stemmer){if("function"!=typeof e.stemmer)throw M("INVALID_STEMMER_FUNCTION_TYPE");t=e.stemmer}else if("english"===e.language)t=e0;else throw M("MISSING_STEMMER",e.language);if(!1!==e.stopWords){if(r=[],Array.isArray(e.stopWords))r=e.stopWords;else if("function"==typeof e.stopWords)r=e.stopWords(r);else if(e.stopWords)throw M("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw M("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let e of r)if("string"!=typeof e)throw M("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:e9,language:e.language,stemmer:t,stemmerSkipProperties:new Set(e.stemmerSkipProperties?[e.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(e.tokenizeSkipProperties?[e.tokenizeSkipProperties].flat():[]),stopWords:r,allowDuplicates:!!e.allowDuplicates,normalizeToken:e1,normalizationCache:new Map};return n.tokenize=e9.bind(n),n.normalizeToken=e1,n}function e2(e){return{sharedInternalDocumentStore:e,rules:new Map}}function e5(e,t){if(e.rules.has(t.id))throw Error(`PINNING_RULE_ALREADY_EXISTS: A pinning rule with id "${t.id}" already exists. Use updateRule to modify it.`);e.rules.set(t.id,t)}function e3(e,t){if(!e.rules.has(t.id))throw Error(`PINNING_RULE_NOT_FOUND: Cannot update pinning rule with id "${t.id}" because it does not exist. Use addRule to create it.`);e.rules.set(t.id,t)}function e6(e,t){return e.rules.delete(t)}function e8(e,t){return e.rules.get(t)}function e4(e){return Array.from(e.rules.values())}function te(e,t){if(!t)return[];let r=[];for(let n of e.rules.values())(function(e,t){return!!e&&t.conditions.every(t=>(function(e,t){let r=e.toLowerCase().trim(),n=t.pattern.toLowerCase().trim();switch(t.anchoring){case"is":return r===n;case"starts_with":return r.startsWith(n);case"contains":return r.includes(n);default:return!1}})(e,t))})(t,n)&&r.push(n);return r}function tt(e,t){return{sharedInternalDocumentStore:e,rules:new Map(t?.rules??[])}}function tr(e){return{rules:Array.from(e.rules.entries())}}let tn="fulltext";function to(e,t){return e[1]-t[1]}function ti(e,t){return t[1]-e[1]}function ts(e,t,r){let n={},o=t.map(([e])=>e),i=e.documentsStore.getMultiple(e.data.docs,o),s=Object.keys(r),l=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e of s){let t;if("number"===l[e]){let{ranges:n}=r[e],o=n.length,i=Array.from({length:o});for(let e=0;e<o;e++){let t=n[e];i[e]=[`${t.from}-${t.to}`,0]}t=Object.fromEntries(i)}n[e]={count:0,values:t??{}}}let a=i.length;for(let e=0;e<a;e++){let t=i[e];for(let e of s){let o=e.includes(".")?O(t,e):t[e],i=l[e],s=n[e].values;switch(i){case"number":tl(r[e].ranges,s)(o);break;case"number[]":{let t=new Set,n=tl(r[e].ranges,s,t);for(let e of o)n(e);break}case"boolean":case"enum":case"string":ta(s,i)(o);break;case"boolean[]":case"enum[]":case"string[]":{let e=ta(s,"boolean[]"===i?"boolean":"string",new Set);for(let t of o)e(t);break}default:throw M("FACET_NOT_SUPPORTED",i)}}}for(let e of s){let t=n[e];if(t.count=Object.keys(t.values).length,"string"===l[e]){let n=r[e],o=function(e="desc"){return"asc"===e.toLowerCase()?to:ti}(n.sort);t.values=Object.fromEntries(Object.entries(t.values).sort(o).slice(n.offset??0,n.limit??10))}}return n}function tl(e,t,r){return n=>{for(let o of e){let e=`${o.from}-${o.to}`;!r?.has(e)&&n>=o.from&&n<=o.to&&(void 0===t[e]?t[e]=1:(t[e]++,r?.add(e)))}}}function ta(e,t,r){let n="boolean"===t?"false":"";return t=>{let o=t?.toString()??n;r?.has(o)||(e[o]=(e[o]??0)+1,r?.add(o))}}let tu={reducer:(e,t,r,n)=>(t[n]=r,t),getInitialValue:e=>Array.from({length:e})},tc=["string","number","boolean"];function tf(e,t,r){let n=r.properties,o=n.length,i=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e=0;e<o;e++){let t=n[e];if(void 0===i[t])throw M("UNKNOWN_GROUP_BY_PROPERTY",t);if(!tc.includes(i[t]))throw M("INVALID_GROUP_BY_PROPERTY",t,tc.join(", "),i[t])}let s=t.map(([t])=>$(e.internalDocumentIDStore,t)),l=e.documentsStore.getMultiple(e.data.docs,s),a=l.length,u=r.maxResult||Number.MAX_SAFE_INTEGER,c=[],f={};for(let e=0;e<o;e++){let t=n[e],r={property:t,perValue:{}},o=new Set;for(let e=0;e<a;e++){let n=O(l[e],t);if(void 0===n)continue;let i="boolean"!=typeof n?n:""+n,s=r.perValue[i]??{indexes:[],count:0};s.count>=u||(s.indexes.push(e),s.count++,r.perValue[i]=s,o.add(n))}c.push(Array.from(o)),f[t]=r}let d=function e(t,r=0){if(r+1===t.length)return t[r].map(e=>[e]);let n=t[r],o=e(t,r+1),i=[];for(let e of n)for(let t of o){let r=[e];p(r,t),i.push(r)}return i}(c),h=d.length,g=[];for(let e=0;e<h;e++){let t=d[e],r=t.length,o={values:[],indexes:[]},i=[];for(let e=0;e<r;e++){let r=t[e],s=n[e];i.push(f[s].perValue["boolean"!=typeof r?r:""+r].indexes),o.values.push(r)}o.indexes=(function(e){if(0===e.length)return[];if(1===e.length)return e[0];for(let t=1;t<e.length;t++)if(e[t].length<e[0].length){let r=e[0];e[0]=e[t],e[t]=r}let t=new Map;for(let r of e[0])t.set(r,1);for(let r=1;r<e.length;r++){let n=0;for(let o of e[r]){let e=t.get(o);e===r&&(t.set(o,e+1),n++)}if(0===n)return[]}return e[0].filter(r=>{let n=t.get(r);return void 0!==n&&t.set(r,0),n===e.length})})(i).sort((e,t)=>e-t),0!==o.indexes.length&&g.push(o)}let m=g.length,y=Array.from({length:m});for(let e=0;e<m;e++){let n=g[e],o=r.reduce||tu,i=n.indexes.map(e=>({id:s[e],score:t[e][1],document:l[e]})),a=o.reducer.bind(null,n.values),u=o.getInitialValue(n.indexes.length),c=i.reduce(a,u);y[e]={values:n.values,result:c}}return y}function td(e,t,r,n){let o=te(t,n);if(0===o.length)return r;let i=o.flatMap(e=>e.consequence.promote);i.sort((e,t)=>e.position-t.position);let s=new Set,l=new Map,a=new Set;for(let t of i){let r=F(e.internalDocumentIDStore,t.doc_id);if(void 0!==r){if(l.has(r)){let e=l.get(r);t.position<e&&l.set(r,t.position);continue}a.has(t.position)||(s.add(r),l.set(r,t.position),a.add(t.position))}}if(0===l.size)return r;let u=r.filter(([e])=>!s.has(e)),c=[];for(let[t,n]of l.entries())r.find(([e])=>e===t)?c.push([t,1e6-n]):e.documentsStore.get(e.data.docs,t)&&c.push([t,0]);c.sort((e,t)=>(l.get(e[0])??1/0)-(l.get(t[0])??1/0));let f=[],d=new Map;for(let e of c){let t=l.get(e[0]);d.set(t,e)}let h=0,p=0;for(;p<u.length+c.length;)if(d.has(p))f.push(d.get(p)),p++;else if(h<u.length)f.push(u[h]),h++,p++;else break;for(let[e,t]of d.entries())e>=f.length&&f.push(t);return f}function th(e,t,r){let n,o,{term:i,properties:s}=t,l=e.data.index,a=e.caches.propertiesToSearch;if(!a){let t=e.index.getSearchablePropertiesWithTypes(l);a=(a=e.index.getSearchableProperties(l)).filter(e=>t[e].startsWith("string")),e.caches.propertiesToSearch=a}if(s&&"*"!==s){for(let e of s)if(!a.includes(e))throw M("UNKNOWN_INDEX",e,a.join(", "));a=a.filter(e=>s.includes(e))}let u=Object.keys(t.where??{}).length>0;u&&(n=e.index.searchByWhereClause(l,e.tokenizer,t.where,r));let c=void 0!==t.threshold&&null!==t.threshold?t.threshold:1;if(i||s){let s=e.documentsStore.count(e.data.docs);if(o=e.index.search(l,i||"",e.tokenizer,r,a,t.exact||!1,t.tolerance||0,t.boost||{},function(e){let t=e??{};return t.k=t.k??tp.k,t.b=t.b??tp.b,t.d=t.d??tp.d,t}(t.relevance),s,n,c),t.exact&&i){let t=i.trim().split(/\s+/);o=o.filter(([r])=>{let n=e.documentsStore.get(e.data.docs,r);if(!n)return!1;for(let e of a){let r=function(e,t){let r=t.split("."),n=e;for(let e of r)if(!n||"object"!=typeof n||!(e in n))return;else n=n[e];return n}(n,e);if("string"==typeof r&&t.every(e=>RegExp(`\\b${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(r)))return!0}return!1})}}else if(u){let e=function(e,t){let r,n=function(e,t){let r=Object.keys(e);if(1!==r.length)return{isGeoOnly:!1};let n=r[0],o=e[n];if(void 0===t.indexes[n])return{isGeoOnly:!1};let{type:i}=t.indexes[n];return"BKD"===i&&o&&("radius"in o||"polygon"in o)?{isGeoOnly:!0,geoProperty:n,geoOperation:o}:{isGeoOnly:!1}}(t,e);if(!n.isGeoOnly||!n.geoProperty||!n.geoOperation)return null;let{node:o}=e.indexes[n.geoProperty],i=n.geoOperation;if("radius"in i){let{value:e,coordinates:t,unit:n="m",inside:s=!0,highPrecision:l=!1}=i.radius,a=T(e,n);return ek(r=o.searchByRadius(t,a,s,"asc",l),t,l)}if("polygon"in i){let{coordinates:e,inside:t=!0,highPrecision:n=!1}=i.polygon;return ek(r=o.searchByPolygon(e,t,"asc",n),ed.calculatePolygonCentroid(e),n)}return null}(l,t.where);o=e||(n?Array.from(n):[]).map(e=>[+e,0])}else o=Object.keys(e.documentsStore.getAll(e.data.docs)).map(e=>[+e,0]);return o}let tp={k:1.2,b:.75,d:.5};function tg(e,t,r){let n,o=t.vector;if(o&&(!("value"in o)||!("property"in o)))throw M("INVALID_VECTOR_INPUT",Object.keys(o).join(", "));let i=e.data.index.vectorIndexes[o.property];if(!i)throw M("UNKNOWN_VECTOR_PROPERTY",o.property);let s=i.node.size;if(o?.value.length!==s){if(o?.property===void 0||o?.value.length===void 0)throw M("INVALID_INPUT_VECTOR","undefined",s,"undefined");throw M("INVALID_INPUT_VECTOR",o.property,s,o.value.length)}let l=e.data.index;return Object.keys(t.where??{}).length>0&&(n=e.index.searchByWhereClause(l,e.tokenizer,t.where,r)),i.node.find(o.value,t.similarity??.8,n)}function tm(e){return e[1]}function ty(e,t,r){let n=t.mode??tn;if(n===tn){let n=y();function o(){let o,i=Object.keys(e.data.index.vectorIndexes),s=t.facets&&Object.keys(t.facets).length>0,{limit:l=10,offset:a=0,distinctOn:u,includeVectors:c=!1}=t,f=!0===t.preflight,d=th(e,t,r);if(t.sortBy)if("function"==typeof t.sortBy){let r=d.map(([e])=>e),n=e.documentsStore.getMultiple(e.data.docs,r).map((e,t)=>[d[t][0],d[t][1],e]);n.sort(t.sortBy),d=n.map(([e,t])=>[e,t])}else d=e.sorter.sortBy(e.data.sorting,d,t.sortBy).map(([t,r])=>[F(e.internalDocumentIDStore,t),r]);else d=d.sort(I);d=td(e,e.data.pinning,d,t.term),f||(o=u?function(e,t,r,n,o){let i=e.data.docs,s=new Map,l=[],a=new Set,u=t.length,c=0;for(let f=0;f<u;f++){let u=t[f];if(void 0===u)continue;let[d,h]=u;if(a.has(d))continue;let p=e.documentsStore.get(i,d),g=O(p,o);if(!(void 0===g||s.has(g))&&(s.set(g,!0),!(++c<=r)&&(l.push({id:$(e.internalDocumentIDStore,d),score:h,document:p}),a.add(d),c>=r+n)))break}return l}(e,d,a,l,u):tb(e,d,a,l));let h={elapsed:{formatted:"",raw:0},hits:[],count:d.length};return void 0!==o&&(h.hits=o.filter(Boolean),c||v(h,i)),s&&(h.facets=ts(e,d,t.facets)),t.groupBy&&(h.groups=tf(e,d,t.groupBy)),h.elapsed=e.formatElapsedTime(y()-n),h}async function i(){e.beforeSearch&&await eo(e.beforeSearch,e,t,r);let n=o();return e.afterSearch&&await en(e.afterSearch,e,t,r,n),n}return e.beforeSearch?.length||e.afterSearch?.length?i():o()}if("vector"===n)return function(e,t,r="english"){let n=y();function o(){let o=tg(e,t,r).sort(I);o=td(e,e.data.pinning,o,void 0);let i=[];t.facets&&Object.keys(t.facets).length>0&&(i=ts(e,o,t.facets));let s=t.vector.property,l=t.includeVectors??!1,a=t.limit??10,u=t.offset??0,c=Array.from({length:a});for(let t=0;t<a;t++){let r=o[t+u];if(!r)break;let n=e.data.docs.docs[r[0]];if(n){l||(n[s]=null);let o={id:$(e.internalDocumentIDStore,r[0]),score:r[1],document:n};c[t]=o}}let f=[];t.groupBy&&(f=tf(e,o,t.groupBy));let d=y()-n;return{count:o.length,hits:c.filter(Boolean),elapsed:{raw:Number(d),formatted:m(d)},...i?{facets:i}:{},...f?{groups:f}:{}}}async function i(){e.beforeSearch&&await eo(e.beforeSearch,e,t,r);let n=o();return e.afterSearch&&await en(e.afterSearch,e,t,r,n),n}return e.beforeSearch?.length||e.afterSearch?.length?i():o()}(e,t);if("hybrid"===n)return function(e,t,r){let n=y();function o(){let r,o,i=function(e,t,r){let n=function(e){let t=Math.max.apply(Math,e.map(tm));return e.map(([e,r])=>[e,r/t])}(th(e,t,r)),o=tg(e,t,r),i=t.hybridWeights;return function(e,t,r,n){let o=Math.max.apply(Math,e.map(tm)),i=Math.max.apply(Math,t.map(tm)),{text:s,vector:l}=n&&n.text&&n.vector?n:{text:.5,vector:.5},a=new Map,u=e.length,c=(e,t)=>e*s+t*l;for(let t=0;t<u;t++){let[r,n]=e[t],i=c(n/o,0);a.set(r,i)}let f=t.length;for(let e=0;e<f;e++){let[r,n]=t[e],o=n/i,s=a.get(r)??0;a.set(r,s+c(0,o))}return[...a].sort((e,t)=>t[1]-e[1])}(n,o,t.term??"",i)}(e,t,void 0);i=td(e,e.data.pinning,i,t.term),t.facets&&Object.keys(t.facets).length>0&&(r=ts(e,i,t.facets)),t.groupBy&&(o=tf(e,i,t.groupBy));let s=tb(e,i,t.offset??0,t.limit??10).filter(Boolean),l=y(),a={count:i.length,elapsed:{raw:Number(l-n),formatted:m(l-n)},hits:s,...r?{facets:r}:{},...o?{groups:o}:{}};return t.includeVectors||v(a,Object.keys(e.data.index.vectorIndexes)),a}async function i(){e.beforeSearch&&await eo(e.beforeSearch,e,t,void 0);let n=o();return e.afterSearch&&await en(e.afterSearch,e,t,r,n),n}return e.beforeSearch?.length||e.afterSearch?.length?i():o()}(e,t);throw M("INVALID_SEARCH_MODE",n)}function tb(e,t,r,n){let o=e.data.docs,i=Array.from({length:n}),s=new Set;for(let l=r;l<n+r;l++){let r=t[l];if(void 0===r)break;let[n,a]=r;if(!s.has(n)){let t=e.documentsStore.get(o,n);i[l]={id:$(e.internalDocumentIDStore,n),score:a,document:t},s.add(n)}}return i}function tS(e,t){e.internalDocumentIDStore.load(e,t.internalDocumentIDStore),e.data.index=e.index.load(e.internalDocumentIDStore,t.index),e.data.docs=e.documentsStore.load(e.internalDocumentIDStore,t.docs),e.data.sorting=e.sorter.load(e.internalDocumentIDStore,t.sorting),e.data.pinning=e.pinning.load(e.internalDocumentIDStore,t.pinning),e.tokenizer.language=t.language}async function tI(e,t,r={}){let n=(0,o.r)(t);return(await ty(e,{term:t,tolerance:1,...r,boost:{title:2,..."boost"in r?r.boost:void 0}})).hits.map(e=>({type:"page",content:e.document.title,breadcrumbs:e.document.breadcrumbs,contentWithHighlights:n.highlight(e.document.title),id:e.document.url,url:e.document.url}))}async function tw(e,t,r=[],{mode:i="fulltext",...s}={}){"string"==typeof r&&(r=[r]);let l={...s,mode:i,where:(0,n.B)({tags:r.length>0?{containsAll:r}:void 0,...s.where}),groupBy:{properties:["page_id"],maxResult:8,...s.groupBy}};t.length>0&&(l={...l,term:t,properties:"fulltext"===i?["content"]:["content","embeddings"]});let a=(0,o.r)(t),u=await ty(e,l),c=[];for(let t of u.groups??[]){let r=t.values[0],n=e.documentsStore.get(e.data.docs,r);if(n)for(let e of(c.push({id:r,type:"page",content:n.content,breadcrumbs:n.breadcrumbs,contentWithHighlights:a.highlight(n.content),url:n.url}),t.result))"page"!==e.document.type&&c.push({id:e.document.id.toString(),content:e.document.content,breadcrumbs:e.document.breadcrumbs,contentWithHighlights:a.highlight(e.document.content),type:e.document.type,url:e.document.url})}return c}Symbol("orama.insertions"),Symbol("orama.removals"),r(4394);var tO=new Map;async function tN({from:e="/api/search",initOrama:t=e=>(function({schema:e,sort:t,language:r,components:n,id:o,plugins:i}){for(let t of(n||(n={}),i??[])){if(!("getComponents"in t)||"function"!=typeof t.getComponents)continue;let r=t.getComponents(e);for(let e of Object.keys(r))if(n[e])throw M("PLUGIN_COMPONENT_CONFLICT",e,t.name);n={...n,...r}}o||(o=b());let s=n.tokenizer,l=n.index,a=n.documentsStore,u=n.sorter,c=n.pinning;if(s=s?s.tokenize?s:e7(s):e7({language:r??"english"}),n.tokenizer&&r)throw M("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let f={idToInternalId:new Map,internalIdToId:[],save:W,load:j};l||={create:function e(t,r,n,o,i=""){for(let[s,l]of(o||(o={sharedInternalDocumentStore:r,indexes:{},vectorIndexes:{},searchableProperties:[],searchablePropertiesWithTypes:{},frequencies:{},tokenOccurrences:{},avgFieldLength:{},fieldLengths:{}}),Object.entries(n))){let n=`${i}${i?".":""}${s}`;if("object"==typeof l&&!Array.isArray(l)){e(t,r,l,o,n);continue}if(L(l))o.searchableProperties.push(n),o.searchablePropertiesWithTypes[n]=l,o.vectorIndexes[n]={type:"Vector",node:new ep(V(l)),isArray:!1};else{let e=/\[/.test(l);switch(l){case"boolean":case"boolean[]":o.indexes[n]={type:"Bool",node:new eh,isArray:e};break;case"number":case"number[]":o.indexes[n]={type:"AVL",node:new es(0,[]),isArray:e};break;case"string":case"string[]":o.indexes[n]={type:"Radix",node:new ec,isArray:e},o.avgFieldLength[n]=0,o.frequencies[n]={},o.tokenOccurrences[n]={},o.fieldLengths[n]={};break;case"enum":case"enum[]":o.indexes[n]={type:"Flat",node:new el,isArray:e};break;case"geopoint":o.indexes[n]={type:"BKD",node:new ed,isArray:e};break;default:throw M("INVALID_SCHEMA_TYPE",Array.isArray(l)?"array":l,n)}o.searchableProperties.push(n),o.searchablePropertiesWithTypes[n]=l}}return o},insert:eI,remove:eO,insertDocumentScoreParameters:em,insertTokenScoreParameters:ey,removeDocumentScoreParameters:eb,removeTokenScoreParameters:eS,calculateResultScores:eN,search:eT,searchByWhereClause:function e(t,r,n,o){if("and"in n&&n.and&&Array.isArray(n.and)){let i=n.and;return 0===i.length?new Set:A(...i.map(n=>e(t,r,n,o)))}if("or"in n&&n.or&&Array.isArray(n.or)){let i=n.or;return 0===i.length?new Set:i.map(n=>e(t,r,n,o)).reduce((e,t)=>k(e,t),new Set)}if("not"in n&&n.not){let i=n.not,s=new Set,l=t.sharedInternalDocumentStore;for(let e=1;e<=l.internalIdToId.length;e++)s.add(e);let a=e(t,r,i,o),u=new Set;for(let e of s)a.has(e)||u.add(e);return u}let i=Object.keys(n),s=i.reduce((e,t)=>({[t]:new Set,...e}),{});for(let e of i){let i=n[e];if(void 0===t.indexes[e])throw M("UNKNOWN_FILTER_PROPERTY",e);let{node:l,type:a,isArray:u}=t.indexes[e];if("Bool"===a){let t=i?l.true:l.false;s[e]=k(s[e],t);continue}if("BKD"===a){let t;if("radius"in i)t="radius";else if("polygon"in i)t="polygon";else throw Error(`Invalid operation ${i}`);if("radius"===t){let{value:r,coordinates:n,unit:o="m",inside:a=!0,highPrecision:u=!1}=i[t],c=T(r,o),f=l.searchByRadius(n,c,a,void 0,u);s[e]=eE(s[e],f)}else{let{coordinates:r,inside:n=!0,highPrecision:o=!1}=i[t],a=l.searchByPolygon(r,n,void 0,o);s[e]=eE(s[e],a)}continue}if("Radix"===a&&("string"==typeof i||Array.isArray(i))){for(let t of[i].flat())for(let n of r.tokenize(t,o,e)){let t=l.find({term:n,exact:!0});s[e]=function(e,t){e||(e=new Set);let r=Object.keys(t),n=r.length;for(let o=0;o<n;o++){let n=t[r[o]],i=n.length;for(let t=0;t<i;t++)e.add(n[t])}return e}(s[e],t)}continue}let c=Object.keys(i);if(c.length>1)throw M("INVALID_FILTER_OPERATION",c.length);if("Flat"===a){let t=new Set(u?l.filterArr(i):l.filter(i));s[e]=k(s[e],t);continue}if("AVL"===a){let t,r=c[0],n=i[r];switch(r){case"gt":t=l.greaterThan(n,!1);break;case"gte":t=l.greaterThan(n,!0);break;case"lt":t=l.lessThan(n,!1);break;case"lte":t=l.lessThan(n,!0);break;case"eq":t=l.find(n)??new Set;break;case"between":{let[e,r]=n;t=l.rangeSearch(e,r);break}default:throw M("INVALID_FILTER_OPERATION",r)}s[e]=k(s[e],t)}}return A(...Object.values(s))},getSearchableProperties:ev,getSearchablePropertiesWithTypes:e_,load:eD,save:eA},u||={create:eP,insert:eR,remove:eL,save:eF,load:ej,sortBy:eB,getSortableProperties:eV,getSortablePropertiesWithTypes:eW},a||={create:G,get:J,getMultiple:Y,getAll:H,store:K,remove:q,count:X,load:Z,save:Q},c||={create:e2,addRule:e5,updateRule:e3,removeRule:e6,getRule:e8,getAllRules:e4,getMatchingRules:te,load:tt,save:tr};var d=n;let h={formatElapsedTime:x,getDocumentIndexId:C,getDocumentProperties:w,validateSchema:function e(t,r){for(let[n,o]of Object.entries(r)){let r=t[n];if(void 0!==r&&("geopoint"!==o||"object"!=typeof r||"number"!=typeof r.lon||"number"!=typeof r.lat)&&("enum"!==o||"string"!=typeof r&&"number"!=typeof r)){if("enum[]"===o&&Array.isArray(r)){let e=r.length;for(let t=0;t<e;t++)if("string"!=typeof r[t]&&"number"!=typeof r[t])return n+"."+t;continue}if(L(o)){let e=V(o);if(!Array.isArray(r)||r.length!==e)throw M("INVALID_INPUT_VECTOR",n,e,r.length);continue}if(B(o)){if(!Array.isArray(r))return n;let e=z[o],t=r.length;for(let o=0;o<t;o++)if(typeof r[o]!==e)return n+"."+o;continue}if("object"==typeof o){if(!r||"object"!=typeof r)return n;let t=e(r,o);if(t)return n+"."+t;continue}if(typeof r!==o)return n}}}};for(let e of er)if(d[e]){if("function"!=typeof d[e])throw M("COMPONENT_MUST_BE_FUNCTION",e)}else d[e]=h[e];for(let e of Object.keys(d))if(!et.includes(e)&&!er.includes(e))throw M("UNSUPPORTED_COMPONENT",e);let{getDocumentProperties:p,getDocumentIndexId:g,validateSchema:m,formatElapsedTime:y}=n,S={data:{},caches:{},schema:e,tokenizer:s,index:l,sorter:u,documentsStore:a,pinning:c,internalDocumentIDStore:f,getDocumentProperties:p,getDocumentIndexId:g,validateSchema:m,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeUpsert:[],afterUpsert:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],beforeUpdateMultiple:[],afterUpdateMultiple:[],beforeUpsertMultiple:[],afterUpsertMultiple:[],afterCreate:[],formatElapsedTime:y,id:o,plugins:i,version:"{{VERSION}}"};for(let r of(S.data={index:S.index.create(S,f,e),docs:S.documentsStore.create(S,f),sorting:S.sorter.create(S,f,e,t),pinning:S.pinning.create(f)},ee))S[r]=(S[r]??[]).concat(function(e,t){let r=[],n=e.plugins?.length;if(!n)return r;for(let o=0;o<n;o++)try{let n=e.plugins[o];"function"==typeof n[t]&&r.push(n[t])}catch(e){throw console.error("Caught error in getAllPluginsByHook:",e),M("PLUGIN_CRASHED")}return r}(S,r));let I=S.afterCreate;return I&&function(e,t){if(e.some(_))return(async()=>{for(let r of e)await r(t)})();for(let r of e)r(t)}(I,S),S})({schema:{_:"string"},language:e})}){let r=tO.get(e);if(r)return r;let n=async function(){let r=await fetch(e);if(!r.ok)throw Error(`failed to fetch exported search indexes from ${e}, make sure the search database is exported and available for client.`);let n=await r.json(),o=new Map;if("i18n"===n.type)return await Promise.all(Object.entries(n.data).map(async([e,r])=>{let n=await t(e);tS(n,r),o.set(e,{type:r.type,db:n})})),o;let i=await t();return tS(i,n),o.set("",{type:n.type,db:i}),o}();return tO.set(e,n),n}async function tT(e,t){let{tag:r,locale:n}=t,o=(await tN(t)).get(n??"");return o?"simple"===o.type?tI(o,e):tw(o.db,e,r):[]}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5203],{5203:(e,t,s)=>{s.d(t,{DEMO_WORLDS:()=>m,DEMO_WORLDS_BY_SLUG:()=>k});var a=s(7762);let o="c2a9f10b7d3e5f8a9012bc34de56f7a89b0c12de",n=[o,"8e4b2c71fa39d6b05c8e7a1f0d93c5b6e2a8d7f1","41a9d02c7e35b8fa6012bc34de56f7a89b0c9d77","9c3f7e21b8d4056aec2174bdde56f8a89b1c0e44"],r=function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return{id:e,title:t,interface:"api",kind:"service",category:"tool",confidence:"medium",...s}},i=(e,t)=>Array.from({length:t},()=>"0123456789abcdef"[Math.floor(16*e())]).join(""),c=e=>"".concat(i(e,8),"-").concat(i(e,4),"-4").concat(i(e,3),"-a").concat(i(e,3),"-").concat(i(e,12)),l=(e,t)=>t[Math.floor(e()*t.length)],d={stripe:[180,4800],shopify:[90,1400],paypal:[40,900],quickbooks:[500,12e3],coupa:[5e3,8e4],netsuite:[8e3,96e3],sap:[12e3,24e4],bank:[25e3,48e4]},h={stripe:["/v1/refunds","Refunded {$} on charge ch_{n}"],shopify:["/orders","Created order for {$}"],paypal:["/v2/payments/refunds","Refunded {$} on PayPal capture {n}"],quickbooks:["/bills","Recorded bill for {$}"],coupa:["/invoices","Approved invoice for {$}"],netsuite:["/vendorbill","Created vendor bill for {$}"],sap:["/A_SalesOrder","Created sales order for {$}"],bank:["/transfers","Sent transfer of {$}"]},u={github:["/pulls","Opened pull request"],gitlab:["/merge_requests","Opened merge request"],jira:["/issue","Opened Jira issue"],servicenow:["/incident","Opened incident"],pagerduty:["/incidents","Opened incident"],sentry:["/issues","Updated issue"],linear:["/issues","Opened issue"]},p={hubspot:"/contacts",salesforce:"/sobjects/Account",okta:"/users",entra:"/users",workday:"/workers",ehr:"/Encounter",siem:"/alerts",edr:"/hosts",attio:"/records",mixpanel:"/events",marketo:"/leads","google-calendar":"/events",aws:"/resources",docusign:"/envelopes"},f={credit:"Billing",billing:"Billing",escalate:"Escalations",paging:"Incidents",incidents:"Incidents",onboarding:"Onboarding",handoff:"Onboarding",renewals:"Accounts",accounts:"Accounts",access:"Access",kb:"Knowledge base",csat:"Customer feedback",returns:"Returns",exchange:"Returns",refund:"Refunds",address:"Orders",backorder:"Orders",disputes:"Payments",payments:"Payments",loyalty:"Loyalty",risk:"Risk",fraud:"Risk",exports:"Finance",matching:"Approvals",approvals:"Approvals",vendors:"Vendors",close:"Month-end close",expenses:"Expenses",budgets:"Budgets",routing:"Pipeline",signals:"Pipeline",outbound:"Outbound",meetings:"Meetings",hygiene:"Data hygiene",events:"Marketing",compliance:"Compliance",bugs:"Bug fixes",security:"Security",migrations:"Releases",deploy:"Releases",releases:"Releases",ci:"CI",triage:"Triage",ownership:"Triage",comms:"Customer comms",capacity:"Capacity",notes:"Clinical notes",coding:"Medical coding",referrals:"Care coordination",scheduling:"Care coordination",payers:"Payers",phishing:"Email security",containment:"Endpoint",identity:"Identity",secrets:"Cloud",cloud:"Cloud",vulns:"Vulnerabilities"},w=(e,t,s,a,o)=>({id:e,title:t,entrypoint:s,tools:a,summary:o,group:(e=>{var t,s;return e.startsWith("src/twin/faults")?"Fault tests":null!=(s=f[null==(t=/([\w-]+)\.ts#/.exec(e))?void 0:t[1]])?s:"Other workflows"})(s)}),g=new Set(["bank","ehr"]),m=[{slug:"pylon",name:"pylon-support-twin",totalCommits:1284,seed:101,risk:.2,changed:["src/workflows/escalate.ts"],workflows:[w("wf-sla-credit","Issue an SLA breach credit","src/workflows/credit.ts#issueSlaCredit",["stripe","salesforce","slack","datadog"],"An enterprise P1 missed its 4-hour SLA. The agent confirms the breach in Datadog, credits the next Stripe invoice, logs it on the Salesforce account and tells the customer in their shared Slack channel."),w("wf-escalate","Escalate a Slack-reported bug to engineering","src/workflows/escalate.ts#escalateToEngineering",["linear","slack","github","salesforce"],"A customer reports a bug in their shared Slack channel. The agent files a Linear issue with the account’s ARR from Salesforce, links the suspect GitHub commit and replies in the thread with the ticket."),w("wf-seat-refund","Refund a duplicate seat charge","src/workflows/billing.ts#refundDuplicateSeats",["stripe","hubspot","gmail"],"An admin was charged twice for the same seats. The agent refunds the duplicate in Stripe, notes it on the HubSpot company and emails a receipt."),w("wf-onboard","Provision a new customer workspace","src/workflows/onboarding.ts#provisionWorkspace",["okta","slack","notion","salesforce","stripe"],"A deal closes. The agent creates the SSO app in Okta, opens a shared Slack Connect channel, copies the onboarding plan into Notion and starts the Stripe subscription."),w("wf-renewal-risk","Flag a renewal at risk","src/workflows/renewals.ts#flagRenewalRisk",["salesforce","snowflake","slack","gmail"],"Ticket volume for an account doubles 60 days before renewal. The agent pulls usage from Snowflake, marks the Salesforce opportunity at risk and alerts the account owner."),w("wf-kb","Turn a resolved thread into a help article","src/workflows/kb.ts#publishArticle",["notion","slack","openai"],"A tricky question gets solved in Slack. The agent drafts a help-centre article with OpenAI and publishes it to the Notion knowledge base for review."),w("wf-outage-page","Page on-call for an enterprise outage","src/workflows/paging.ts#pageForOutage",["pagerduty","datadog","slack","linear"],"Three enterprise accounts report the same error in ten minutes. The agent checks Datadog, pages the owning team in PagerDuty and opens a Linear incident."),w("wf-csat","Send a CSAT survey after resolution","src/workflows/csat.ts#sendSurvey",["gmail","snowflake","salesforce"],"A ticket closes. The agent emails one survey per requester, stores the score in Snowflake and rolls it up on the Salesforce account."),w("wf-account-merge","Merge accounts after an acquisition","src/workflows/accounts.ts#mergeAccounts",["salesforce","hubspot","stripe","snowflake"],"A customer acquires another customer. The agent merges both Salesforce accounts, moves HubSpot contacts and consolidates the two Stripe subscriptions."),w("wf-offboard-agent","Remove a departed agent’s access","src/workflows/access.ts#offboardAgent",["okta","slack","github","notion"],"A support agent leaves. The agent deactivates them in Okta, removes them from customer Slack channels, GitHub and Notion, and reports what was revoked."),w("wf-twin-dup","Fault: Stripe times out after the credit commits","src/twin/faults.ts#creditTimeout",["stripe","salesforce","slack"],"The Stripe twin saves the credit, then delays its reply past the agent’s timeout. A correct agent checks before retrying; a naive one credits twice.")]},{slug:"intercom",name:"intercom-returns-twin",totalCommits:946,seed:202,risk:.16,changed:["src/workflows/refund.ts"],workflows:[w("wf-return","Approve a return and send the label","src/workflows/returns.ts#approveReturn",["shopify","intercom","gmail","netsuite"],"A shopper asks Fin to return boots bought 12 days ago. The agent checks the return window in Shopify, creates the return, books stock back into NetSuite and emails the prepaid label."),w("wf-refund","Refund a damaged item","src/workflows/refund.ts#refundDamaged",["stripe","shopify","intercom","netsuite"],"A customer sends a photo of a cracked lamp. The agent refunds the line item in Stripe, marks the Shopify order, writes off the unit in NetSuite and closes the Intercom conversation."),w("wf-exchange","Swap a size and reserve stock","src/workflows/exchange.ts#swapSize",["shopify","netsuite","intercom","klaviyo"],"A jacket is too small. The agent reserves the larger size in NetSuite, creates a zero-value exchange order in Shopify and pauses the post-purchase Klaviyo flow."),w("wf-address","Change a delivery address before dispatch","src/workflows/address.ts#changeAddress",["shopify","intercom","twilio"],"A customer moved. The agent updates the Shopify shipping address only if the order has not been picked, then confirms by SMS."),w("wf-paypal","Refund a PayPal order","src/workflows/refund.ts#refundPaypal",["paypal","shopify","intercom"],"An order paid with PayPal is cancelled. The agent refunds through PayPal, not Stripe, and records it on the Shopify order."),w("wf-backorder","Tell customers about a backorder","src/workflows/backorder.ts#notifyBackorder",["klaviyo","shopify","twilio","intercom"],"A best-seller slips three weeks. The agent finds every open order in Shopify and sends one Klaviyo email and one SMS per customer, with a cancel option."),w("wf-chargeback","Respond to a chargeback","src/workflows/disputes.ts#respondToDispute",["stripe","shopify","google-drive","slack"],"Stripe opens a dispute. The agent gathers the tracking proof from Shopify, files the evidence packet to Google Drive, submits it to Stripe and posts to #payments."),w("wf-loyalty","Grant goodwill loyalty points","src/workflows/loyalty.ts#grantPoints",["postgres","klaviyo","intercom"],"A late delivery deserves an apology. The agent adds 500 points in the loyalty database once and updates the Klaviyo profile."),w("wf-fraud-hold","Hold a high-risk return","src/workflows/risk.ts#holdReturn",["shopify","stripe","slack","postgres"],"The fifth return this month from one address. The agent holds the refund, tags the Shopify customer and asks the risk team in Slack."),w("wf-ledger","Send finance the weekly returns ledger","src/workflows/exports.ts#exportReturns",["google-sheets","netsuite","gmail"],"Every Monday the agent reconciles refunds against NetSuite credit memos, writes the ledger to Google Sheets and emails finance."),w("wf-twin-dup","Fault: refund webhook arrives twice","src/twin/faults.ts#duplicateWebhook",["stripe","shopify","intercom"],"The Stripe twin delivers the refund webhook twice. A correct agent ignores the repeat; a naive one refunds again.")]},{slug:"ramp",name:"ramp-ap-twin",totalCommits:2103,seed:303,risk:.3,changed:["src/workflows/payments.ts"],workflows:[w("wf-pay-invoice","Pay a vendor invoice from email","src/workflows/payments.ts#payInvoice",["bank","netsuite","gmail","slack","snowflake"],"An invoice PDF arrives at ap@. The agent extracts it, matches the vendor in NetSuite, schedules the ACH on its due date and posts the payment to #ap-payments."),w("wf-three-way","Three-way match an invoice to its PO","src/workflows/matching.ts#threeWayMatch",["netsuite","coupa","gmail","slack"],"The agent compares the invoice, the Coupa purchase order and the goods receipt. It approves matches and sends quantity or price variances back to the buyer."),w("wf-approval","Route an approval above $50,000","src/workflows/approvals.ts#routeApproval",["coupa","slack","okta","netsuite"],"A large invoice needs a VP. The agent finds the approver through Okta groups, asks in Slack and releases the NetSuite bill only after approval."),w("wf-vendor","Onboard a new vendor","src/workflows/vendors.ts#onboardVendor",["netsuite","docusign","bank","gmail"],"Procurement adds a supplier. The agent sends the W-9 and contract through DocuSign, verifies bank details with a penny test and creates the NetSuite vendor."),w("wf-bank-change","Verify a vendor’s bank-detail change","src/workflows/fraud.ts#verifyBankChange",["bank","netsuite","gmail","slack"],"An email asks to change where a vendor gets paid, a common fraud pattern. The agent freezes payments, calls back the number on file and alerts treasury."),w("wf-close","Reconcile month-end card spend","src/workflows/close.ts#reconcileCards",["netsuite","snowflake","quickbooks","slack"],"At month end the agent matches 4,000 card transactions to receipts, books them to NetSuite and the QuickBooks subsidiary, and lists the missing receipts."),w("wf-reimburse","Reimburse an employee expense","src/workflows/expenses.ts#reimburse",["bank","workday","netsuite","slack"],"An approved travel report is ready. The agent checks the employee in Workday, pays them once by ACH and books the expense."),w("wf-fx","Pay an international supplier in euros","src/workflows/payments.ts#payInEur",["bank","netsuite","gmail"],"A German supplier invoices in EUR. The agent books the FX rate, sends a SEPA transfer and records the realised gain or loss."),w("wf-budget","Warn a team that it is over budget","src/workflows/budgets.ts#warnOverrun",["snowflake","slack","workday"],"Marketing reaches 92% of its quarterly budget. The agent finds the budget owner in Workday and messages them once with the top spend."),w("wf-twin-dup","Fault: the bank times out after the transfer","src/twin/faults.ts#transferTimeout",["bank","netsuite","slack"],"The bank twin sends the wire, then never answers. A correct agent checks the transfer status before retrying; a naive one pays the vendor twice.")]},{slug:"clay",name:"clay-gtm-twin",totalCommits:1740,seed:404,risk:.18,changed:["src/workflows/routing.ts"],workflows:[w("wf-route-lead","Enrich and route an inbound lead","src/workflows/routing.ts#routeLead",["salesforce","openai","slack","snowflake"],"A VP fills in the demo form. The agent enriches the company, scores fit with OpenAI against Snowflake win data, assigns the right rep in Salesforce and pings them in Slack."),w("wf-sequence","Enroll a lead in an outbound sequence","src/workflows/outbound.ts#enroll",["gmail","hubspot","salesforce"],"A target account shows intent. The agent writes a three-step personalised sequence, sends from the rep’s Gmail and logs every touch in HubSpot."),w("wf-book-demo","Book a demo from an email reply","src/workflows/meetings.ts#bookFromReply",["google-calendar","salesforce","gmail","zoom"],"A prospect replies “Thursday works”. The agent finds a free slot on the rep’s calendar, creates the Zoom link, sends the invite and moves the Salesforce stage."),w("wf-dedupe","Deduplicate accounts before territory planning","src/workflows/hygiene.ts#dedupeAccounts",["salesforce","snowflake","google-sheets"],"Before the new fiscal year, the agent finds duplicate Salesforce accounts by domain, merges them and shares the change list in Google Sheets."),w("wf-intent","Alert reps to product-usage intent","src/workflows/signals.ts#usageIntent",["mixpanel","salesforce","slack"],"A free workspace invites its tenth teammate. The agent reads the Mixpanel event, creates a Salesforce task and alerts the owner."),w("wf-closed-won","Hand a closed-won deal to onboarding","src/workflows/handoff.ts#closedWon",["attio","salesforce","slack","gmail"],"A deal closes. The agent creates the customer record in Attio, opens the onboarding channel and sends the welcome email once."),w("wf-webinar","Follow up with webinar attendees","src/workflows/events.ts#webinarFollowUp",["marketo","hubspot","gmail"],"After a webinar the agent splits attendees from no-shows in Marketo and sends each group one follow-up from HubSpot."),w("wf-unsubscribe","Honour an unsubscribe everywhere","src/workflows/compliance.ts#unsubscribe",["hubspot","marketo","salesforce","gmail"],"A prospect asks to be removed. The agent opts them out in HubSpot, Marketo and Salesforce and cancels any queued Gmail sends."),w("wf-twin-dup","Fault: Gmail times out mid-sequence","src/twin/faults.ts#sendTimeout",["gmail","hubspot","salesforce"],"The Gmail twin sends step two, then delays its reply. A correct agent checks the sent folder; a naive one emails the prospect twice.")]},{slug:"cognition",name:"cognition-coding-twin",totalCommits:3421,seed:505,risk:.24,changed:["src/workflows/deploy.ts"],workflows:[w("wf-fix-bug","Fix a Linear bug and open a pull request","src/workflows/bugs.ts#fixAndOpenPr",["github","linear","slack","sentry"],"A bug is assigned to the agent in Linear. It reads the Sentry stack trace, writes the fix and a test, opens one PR and links it on the issue."),w("wf-jira","Pick up a Jira ticket for a customer repo","src/workflows/bugs.ts#fromJira",["jira","gitlab","slack"],"An enterprise customer runs Jira and GitLab. The agent takes the ticket, opens a merge request and moves the ticket to In Review."),w("wf-cve","Upgrade a vulnerable dependency","src/workflows/security.ts#patchCve",["github","linear","slack"],"A critical CVE lands in a transitive dependency. The agent bumps it across 14 repositories, opening one PR each, and tracks them on a Linear project."),w("wf-migration","Ship a database migration safely","src/workflows/migrations.ts#ship",["postgres","github","datadog","slack"],"The agent adds a column with a backfill, runs it against a copy of production, watches Datadog latency and posts the result before merging."),w("wf-deploy","Deploy and watch error rates","src/workflows/deploy.ts#deployAndWatch",["aws","datadog","sentry","slack","github"],"After merge the agent deploys to AWS, watches Sentry and Datadog for 15 minutes and rolls back on its own if errors climb."),w("wf-flaky","Quarantine a flaky test","src/workflows/ci.ts#quarantineFlaky",["github","linear","slack"],"A test fails 1 run in 20. The agent quarantines it in one PR and files a Linear issue for the owner."),w("wf-postmortem","Draft an incident postmortem","src/workflows/incidents.ts#draftPostmortem",["notion","pagerduty","datadog","slack"],"After an incident closes, the agent pulls the PagerDuty timeline and Datadog graphs into a Notion postmortem draft."),w("wf-rollback","Roll back a bad release","src/workflows/deploy.ts#rollback",["aws","github","pagerduty","slack"],"PagerDuty fires after a release. The agent reverts to the previous AWS task definition, opens the revert PR and resolves the page."),w("wf-twin-dup","Fault: GitHub times out after the PR is created","src/twin/faults.ts#prTimeout",["github","linear","slack"],"The GitHub twin creates the pull request, then times out. A correct agent searches for its branch first; a naive one opens a second PR.")]},{slug:"sentry",name:"sentry-oncall-twin",totalCommits:1655,seed:606,risk:.12,changed:["src/workflows/triage.ts"],workflows:[w("wf-triage","Triage a new error spike","src/workflows/triage.ts#triageSpike",["sentry","github","linear","slack"],"A new issue hits 2,000 events in five minutes. The agent groups it, finds the suspect commit on GitHub, files one Linear issue and posts to the team channel."),w("wf-page","Page the owning team","src/workflows/paging.ts#pageOwner",["pagerduty","sentry","slack","google-calendar"],"The agent reads code owners, checks who is on call and not on holiday in Google Calendar, and pages them once in PagerDuty."),w("wf-assign","Assign an issue to the commit author","src/workflows/ownership.ts#assignAuthor",["sentry","github","slack"],"Sentry ties a regression to a release. The agent assigns the issue to the author of the suspect commit and DMs them the stack trace."),w("wf-war-room","Open an incident war room","src/workflows/incidents.ts#openWarRoom",["slack","zoom","pagerduty","notion"],"A SEV-1 is declared. The agent creates the incident channel and Zoom bridge, invites responders and starts the Notion timeline."),w("wf-release-hold","Hold a release with crash regressions","src/workflows/releases.ts#holdRelease",["sentry","github","slack","datadog"],"The crash-free rate falls below 99.5% on a canary. The agent blocks the GitHub deployment and posts the evidence."),w("wf-customer-impact","Notify affected enterprise customers","src/workflows/comms.ts#notifyCustomers",["salesforce","sentry","gmail","slack"],"The agent finds which enterprise accounts hit the error, emails each technical contact once and logs it in Salesforce."),w("wf-autoscale","Scale up during an ingest spike","src/workflows/capacity.ts#scaleIngest",["aws","datadog","pagerduty","slack"],"Event ingest triples. The agent raises the AWS autoscaling limit within policy and tells on-call what changed."),w("wf-resolve","Resolve an issue and link the fix","src/workflows/triage.ts#resolveWithFix",["sentry","github","jira"],"A fix merges. The agent marks the Sentry issue resolved in the next release and closes the linked Jira ticket."),w("wf-twin-dup","Fault: PagerDuty times out after paging","src/twin/faults.ts#pageTimeout",["pagerduty","slack","sentry"],"The PagerDuty twin creates the incident, then stalls. A correct agent checks for the open incident; a naive one wakes the engineer twice.")]},{slug:"abridge",name:"abridge-clinical-twin",totalCommits:887,seed:707,risk:.26,changed:["src/workflows/notes.ts"],workflows:[w("wf-note","File a visit note to the EHR","src/workflows/notes.ts#fileNote",["ehr","openai","snowflake"],"A clinician ends a recorded visit. The agent drafts the SOAP note, files it to the patient’s encounter in the EHR once and logs the draft for quality review."),w("wf-codes","Suggest billing codes for review","src/workflows/coding.ts#suggestCodes",["ehr","snowflake","servicenow"],"From the signed note the agent suggests ICD-10 and CPT codes, attaches them to the encounter and opens a ServiceNow task if documentation is thin."),w("wf-referral","Send a specialist referral","src/workflows/referrals.ts#sendReferral",["ehr","twilio","gmail"],"The plan says “refer to cardiology”. The agent creates the referral order, texts the patient the clinic number and emails the specialist’s office."),w("wf-followup","Schedule a patient follow-up","src/workflows/scheduling.ts#bookFollowUp",["ehr","google-calendar","twilio"],"A follow-up is due in two weeks. The agent books one appointment in the clinic calendar and sends one SMS reminder."),w("wf-prior-auth","Submit a prior authorisation","src/workflows/payers.ts#priorAuth",["ehr","docusign","gmail","servicenow"],"An MRI needs payer approval. The agent assembles the clinical justification, gets the physician’s DocuSign signature and submits it."),w("wf-phi-audit","Audit access to patient records","src/workflows/compliance.ts#auditPhiAccess",["siem","okta","ehr","slack"],"Nightly the agent compares EHR chart access in the SIEM with Okta roles and flags anyone who opened a chart without a care relationship."),w("wf-clinician","Give a new clinician access","src/workflows/access.ts#onboardClinician",["okta","entra","ehr","slack"],"A physician joins. The agent assigns Okta and Entra groups, provisions their EHR template and confirms in Slack."),w("wf-amend","Correct an amended note","src/workflows/notes.ts#amendNote",["ehr","servicenow","slack"],"A clinician corrects a medication dose. The agent files an addendum, never an overwrite, and records the change request."),w("wf-twin-dup","Fault: the EHR times out after the note saves","src/twin/faults.ts#noteTimeout",["ehr","slack","snowflake"],"The EHR twin saves the note, then times out. A correct agent checks the encounter; a naive one files the note twice in the patient’s chart.")]},{slug:"paloalto",name:"paloalto-triage-twin",totalCommits:1988,seed:808,risk:.1,changed:["src/workflows/containment.ts"],workflows:[w("wf-phish","Contain a reported phishing email","src/workflows/phishing.ts#contain",["outlook","siem","edr","servicenow","slack"],"An employee reports a phish. The agent pulls every copy from Outlook inboxes, checks the SIEM for clicks, scans those laptops with EDR and opens one ServiceNow incident."),w("wf-isolate","Isolate an infected laptop","src/workflows/containment.ts#isolateHost",["edr","servicenow","okta","slack"],"EDR detects ransomware behaviour. The agent isolates the host, suspends the user’s Okta sessions and pages the SOC."),w("wf-travel","Respond to impossible travel","src/workflows/identity.ts#impossibleTravel",["okta","siem","pagerduty","slack"],"A user signs in from Lisbon and Singapore 20 minutes apart. The agent forces re-authentication and asks the user to confirm in Slack."),w("wf-leaked-key","Revoke a leaked AWS key","src/workflows/secrets.ts#revokeKey",["aws","github","siem","jira"],"GitHub secret scanning finds an AWS key in a public repo. The agent deactivates the key, checks CloudTrail in the SIEM for use and files a Jira ticket."),w("wf-cve","Open tickets for a critical CVE","src/workflows/vulns.ts#ticketCve",["jira","edr","slack"],"A critical CVE is published. The agent finds affected hosts through EDR and opens one Jira ticket per owning team."),w("wf-offboard","Cut access for a terminated employee","src/workflows/identity.ts#offboard",["okta","entra","workday","servicenow"],"Workday records a termination. The agent disables Okta and Entra accounts within 15 minutes and logs the evidence for audit."),w("wf-s3","Lock down a public S3 bucket","src/workflows/cloud.ts#lockBucket",["aws","siem","jira","slack"],"A bucket with customer data becomes public. The agent blocks public access, checks access logs and notifies the owner."),w("wf-mfa","Reset MFA after identity verification","src/workflows/identity.ts#resetMfa",["okta","servicenow","twilio"],"A user lost their phone. The agent verifies them by SMS to the number on file and resets Okta MFA once."),w("wf-twin-dup","Fault: ServiceNow times out after the ticket opens","src/twin/faults.ts#ticketTimeout",["servicenow","slack","siem"],"The ServiceNow twin opens the incident, then stalls. A correct agent searches for it; a naive one opens a duplicate and splits the investigation.")]}].map(e=>{let{slug:t,name:s,totalCommits:f,seed:w,risk:m,changed:k,workflows:b}=e,y=[...new Set(b.flatMap(e=>e.tools))].map(e=>{var t,s;let o=null!=(s=null==(t=(0,a.SG)(e))?void 0:t.name)?s:e;return"postgres"===e?r(e,o,{kind:"database"}):g.has(e)?{id:e,title:o,interface:"api",kind:"service",category:"access",confidence:"medium"}:r(e,o)});return{slug:t,inventory:{schema:"company-inventory/v1",name:s,generatedAt:"2026-10-23T09:12:00Z",git:{branch:"main",head:o,previousHead:"8e4b2c71fa39d6b05c8e7a1f0d93c5b6e2a8d7f1",dirty:!1,capturedAt:"2026-10-23T09:12:00Z",totalCommits:f,commits:Array.from({length:29},(e,t)=>({sha:(o+t.toString(16).padStart(4,"0")).slice(0,40),date:new Date(Date.now()-(13-t%14)*864e5-(t+1)*36e5).toISOString(),message:["Fix thread id lookup","Add retry around postMessage","Extract shared helper","Handle renamed channel","Pin runner version","Cache lookups","Return actionable error","Structured logging","Bump adapter contracts","Tiny copy fixes"][t%10],author:"sashank"})),changedFiles:k},tools:y,workflows:b.map(e=>{var t;return{...e,confidence:"medium",steps:(null!=(t=e.tools)?t:[]).map(e=>({tool:e,operations:["invoke","observe"]}))}})},runs:function(e,t){let s,o=(s=t,()=>{s|=0;let e=Math.imul((s=s+0x6d2b79f5|0)^s>>>15,1|s);return(((e=e+Math.imul(e^e>>>7,61|e)^e)^e>>>14)>>>0)/0x100000000}),r=e.inventory.workflows,f=Date.now(),w=[];for(let t=0;t<120;t++){var g,m,k,b,y,v;let s,S,A=r[Math.floor(t/120*r.length+1.4*o())%r.length],T=Math.floor(56*o()),C=function(e,t,s){let a=t*(.35+1.3*s/56),o=e();return o<.6*a?"failed":o<.75*a?"incomplete":o<.9*a?"error":"passed"}(o,null!=(g=e.risk)?g:.2,T),R=new Date(f-864e5*T-36e5*Math.floor(20*o())).toISOString(),x=l(o,n),E=t=>{var s,a;return null!=(a=null==(s=e.inventory.tools.find(e=>e.id===t))?void 0:s.title)?a:t},P=(null!=(m=A.tools)?m:[]).map(E),O=null!=(k=P[0])?k:"CLI",M=null!=(y=null!=(b=P[1])?b:P[0])?y:"CLI",I="".concat(1e3+Math.floor(8900*o())),D=(e,t,s,a,o)=>({service:e,path:t,summary:s,expected:a,actual:o,count:a,passed:a===o}),_=[],q=[],F=(e,t,s,a)=>q.push({sequence:q.length+1,service:e,operation:t,path:s,detail:a});if(F("CLI","loaded",A.id,"Loaded workflow ".concat(A.id)),"passed"===C)_.push(D(O,"".concat(A.id,"/outcome"),"Expected outcome recorded",1,1)),_.push(D(O,"".concat(A.id,"/writes"),"Exactly one write performed",1,1)),o()>.4&&_.push(D(M,"".concat(A.id,"/side-effect"),"Downstream effect verified",1,1)),F("CLI","finished",A.id,"".concat(_.length," checks recorded"));else if("failed"===C)l(o,["missing","duplicated","stale","wrong value"]),_.push(D(O,"".concat(A.id,"/outcome"),"Expected outcome recorded",1,0)),o()>.5&&_.push(D(M,"".concat(A.id,"/side-effect"),"Downstream effect verified",1,0)),_.push(D("CLI","retries","Retry budget respected",0,0)),F("CLI","finished",A.id,"Recorded outcome differs from expected");else if("error"===C){let e=l(o,["credentials missing for the sandbox account","adapter exited before the first call","rate limit exhausted on the test tenant","fixture set failed to load"]);_.push(D(O,"".concat(A.id,"/outcome"),"Workflow could not finish",1,0)),F("CLI","error",A.id,e.charAt(0).toUpperCase()+e.slice(1)),F("CLI","aborted",A.id,"Workflow aborted before the first write"),s="Workflow could not start: ".concat(e,".")}else _.push(D(O,"".concat(A.id,"/outcome"),"Workflow finished inside its limit",1,0)),F("CLI","timeout",A.id,"Exceeded the workflow time limit before completing");let L={},N={};(null!=(v=A.tools)?v:[]).forEach((e,t)=>{var s;let n=function(e,t,s,o){var n,r,i,c,l,f,w,g,m;let k=null!=(r=null==(n=(0,a.SG)(e))?void 0:n.shape)?r:"records",b=Number(t),[y,v]=null!=(i=d[e])?i:d.stripe,S=100*Math.round(y+s()*(v-y))+Math.floor(100*s());if("money"===k){let[s,a]=null!=(c=h[e])?c:h.stripe;return{path:s,detail:a.replace("{$}","$".concat((S/100).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}))).replace("{n}",t),before:[{id:"re_".concat(b-7),amount:Math.round(.62*S),currency:"usd",charge:"ch_".concat(b-7),status:"succeeded",reason:"duplicate"},{id:"re_".concat(b-3),amount:Math.round(.37*S),currency:"usd",charge:"ch_".concat(b-3),status:"succeeded",reason:"requested_by_customer"}],added:[{id:"re_".concat(b),amount:S,currency:"usd",charge:"ch_".concat(t),status:"succeeded",reason:"requested_by_customer"}]}}if("messages"===k){let s="twilio"===e?"+1 415 555 0"+t.slice(-3):["gmail","outlook","klaviyo"].includes(e)?"customer".concat(t,"@example.com"):"intercom"===e?"conversation ".concat(t):"zoom"===e?"bridge ".concat(t):"#ops-escalations";return{path:"twilio"===e?"/Messages.json":"intercom"===e?"/conversations":"/messages",detail:"Sent to ".concat(s),before:[{id:"m_".concat(b-2),to:s,text:"Thanks — we are looking into this now.",status:"delivered"}],added:[{id:"m_".concat(b),to:s,text:"".concat(o," — done for #").concat(t,". Reply here if anything looks off."),status:"sent"}]}}return"work"===k?{path:(null!=(l=u[e])?l:["/issues"])[0],detail:"".concat((null!=(f=u[e])?f:[,"Opened issue"])[1]," for #").concat(t),changedId:"ENG-".concat(b-1),before:[{id:"ENG-".concat(b-4),title:"Webhook retries spike after deploy",state:"In Progress"},{id:"ENG-".concat(b-1),title:"Customer #".concat(t," cannot see invoices"),state:"Todo"}],changed:{id:"ENG-".concat(b-1),title:"Customer #".concat(t," cannot see invoices"),state:"In Progress"},added:[{id:"ENG-".concat(b),title:"P1: ".concat(o.toLowerCase()," for #").concat(t),state:"Todo"}]}:"files"===k?{path:null!=(w=({"google-drive":"/files",sharepoint:"/drive/items",docusign:"/envelopes"})[e])?w:"/pages",detail:"Wrote page for #".concat(t),before:[{id:"pg_".concat(b-5),title:"Support macros"}],added:[{id:"pg_".concat(b),title:"".concat(o," — #").concat(t)}]}:"data"===k?{path:null!=(g=({snowflake:"/statements",openai:"/responses","google-sheets":"/values"})[e])?g:"/rows",detail:"openai"===e?"Generated draft for #".concat(t):"Inserted row ".concat(t),before:[{id:"r_".concat(b-1),name:"job ".concat(b-1),status:"done"}],added:[{id:"r_".concat(b),name:"job ".concat(t),status:"queued"}]}:{path:null!=(m=p[e])?m:"/records",detail:"Updated record #".concat(t),changedId:"c_".concat(t),before:[{id:"c_".concat(t),name:"Ada Ruiz",email:"ada".concat(t,"@example.com"),status:"lead"},{id:"c_".concat(b+1),name:"Sam Okafor",email:"sam@example.com",status:"customer"}],changed:{id:"c_".concat(t),name:"Ada Ruiz",email:"ada".concat(t,"@example.com"),status:"customer"},added:[]}}(e,I,o,A.title),r="failed"===C&&0===t&&n.added.length>0;L[e]={[n.path]:n.before},N[e]={[n.path]:"error"===C?n.before:[...n.before.filter(e=>!n.changedId||e.id!==n.changedId),...n.changed?[n.changed]:[],..."incomplete"===C&&t>0?[]:n.added,...r?n.added.map(e=>({...e,id:e.id+"_2"})):[]]},"error"!==C&&("incomplete"!==C||!(t>0))&&(q.splice(q.length-1,0,{sequence:0,service:e,operation:"write",path:n.path,detail:n.detail,record:null!=(s=n.added[0])?s:n.changed}),r&&(S={type:"timeout-after-write",service:e,path:n.path,delayMs:1500,triggered:!0},q.splice(q.length-1,0,{sequence:0,service:e,operation:"fault",path:n.path,detail:"write committed; response delayed 1500ms"}),q.splice(q.length-1,0,{sequence:0,service:e,operation:"write",path:n.path,detail:"Retried after timeout \xb7 ".concat(n.detail),record:{...n.added[0],id:n.added[0].id+"_2"}}),_.unshift(D(E(e),n.path,"Exactly one write performed",1,2))))}),q.forEach((e,t)=>{e.sequence=t+1}),F("CLI","receipt",A.id,"Run receipt written for ".concat(A.id)),w.push({schema:"agenttwin/run-v1",project:e.inventory.name,workflowId:A.id,entrypoint:A.entrypoint,name:A.id.replace(/^wf-/,"").replaceAll("-","_")+"_".concat(I),status:C,runId:c(o),runtime:"local",createdAt:R,durationMs:800+Math.floor(2600*o()),git:{head:x,branch:"main",dirty:o()>.85,capturedAt:R,totalCommits:1284,commits:[],changedFiles:[]},application:{command:["node","packages/cli/dist/cli.js","run","--workflow",A.id],exitCode:+("passed"!==C),stdout:"passed"===C?"".concat(A.title," finished with all checks passing."):"".concat(A.title," did not pass its recorded checks."),stderr:"",..."incomplete"===C?{timedOut:!0}:{}},assertions:_,events:q,initialState:L,finalState:N,...S?{fault:S}:{},sourceDigests:{},specDigest:i(o,64),...s?{executionError:s}:{}})}return w}({inventory:{name:s,tools:y,workflows:b},risk:m},w)}}),k=Object.fromEntries([...m.map(e=>[e.slug,e])]);m[0].inventory,m[0].runs}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9675],{9675:(e,t,s)=>{s.d(t,{DEMO_WORLDS:()=>m,DEMO_WORLDS_BY_SLUG:()=>k});var a=s(5242);let o="c2a9f10b7d3e5f8a9012bc34de56f7a89b0c12de",n=[o,"8e4b2c71fa39d6b05c8e7a1f0d93c5b6e2a8d7f1","41a9d02c7e35b8fa6012bc34de56f7a89b0c9d77","9c3f7e21b8d4056aec2174bdde56f8a89b1c0e44"],r=function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return{id:e,title:t,interface:"api",kind:"service",category:"tool",confidence:"medium",...s}},i=(e,t)=>Array.from({length:t},()=>"0123456789abcdef"[Math.floor(16*e())]).join(""),c=e=>"".concat(i(e,8),"-").concat(i(e,4),"-4").concat(i(e,3),"-a").concat(i(e,3),"-").concat(i(e,12)),l=(e,t)=>t[Math.floor(e()*t.length)],d={stripe:[180,4800],shopify:[90,1400],paypal:[40,900],quickbooks:[500,12e3],coupa:[5e3,8e4],netsuite:[8e3,96e3],sap:[12e3,24e4],bank:[25e3,48e4]},h={stripe:["/v1/refunds","Refunded {$} on charge ch_{n}"],shopify:["/orders","Created order for {$}"],paypal:["/v2/payments/refunds","Refunded {$} on PayPal capture {n}"],quickbooks:["/bills","Recorded bill for {$}"],coupa:["/invoices","Approved invoice for {$}"],netsuite:["/vendorbill","Created vendor bill for {$}"],sap:["/A_SalesOrder","Created sales order for {$}"],bank:["/transfers","Sent transfer of {$}"]},u={github:["/pulls","Opened pull request"],gitlab:["/merge_requests","Opened merge request"],jira:["/issue","Opened Jira issue"],servicenow:["/incident","Opened incident"],pagerduty:["/incidents","Opened incident"],sentry:["/issues","Updated issue"],linear:["/issues","Opened issue"]},p={hubspot:"/contacts",salesforce:"/sobjects/Account",okta:"/users",entra:"/users",workday:"/workers",ehr:"/Encounter",siem:"/alerts",edr:"/hosts",attio:"/records",mixpanel:"/events",marketo:"/leads","google-calendar":"/events",aws:"/resources",docusign:"/envelopes"},f={credit:"Billing",billing:"Billing",escalate:"Escalations",paging:"Incidents",incidents:"Incidents",onboarding:"Onboarding",handoff:"Onboarding",renewals:"Accounts",accounts:"Accounts",access:"Access",kb:"Knowledge base",csat:"Customer feedback",returns:"Returns",exchange:"Returns",refund:"Refunds",address:"Orders",backorder:"Orders",disputes:"Payments",payments:"Payments",loyalty:"Loyalty",risk:"Risk",fraud:"Risk",exports:"Finance",matching:"Approvals",approvals:"Approvals",vendors:"Vendors",close:"Month-end close",expenses:"Expenses",budgets:"Budgets",routing:"Pipeline",signals:"Pipeline",outbound:"Outbound",meetings:"Meetings",hygiene:"Data hygiene",events:"Marketing",compliance:"Compliance",bugs:"Bug fixes",security:"Security",migrations:"Releases",deploy:"Releases",releases:"Releases",ci:"CI",triage:"Triage",ownership:"Triage",comms:"Customer comms",capacity:"Capacity",notes:"Clinical notes",coding:"Medical coding",referrals:"Care coordination",scheduling:"Care coordination",payers:"Payers",phishing:"Email security",containment:"Endpoint",identity:"Identity",secrets:"Cloud",cloud:"Cloud",vulns:"Vulnerabilities"},w=(e,t,s,a,o)=>({id:e,title:t,entrypoint:s,tools:a,summary:o,group:(e=>{var t,s;return e.startsWith("src/twin/faults")?"Fault tests":null!=(s=f[null==(t=/([\w-]+)\.ts#/.exec(e))?void 0:t[1]])?s:"Other workflows"})(s)}),g=new Set(["bank","ehr"]),m=[{slug:"pylon",name:"pylon-support-twin",totalCommits:1284,seed:101,risk:.2,changed:["src/workflows/escalate.ts"],workflows:[w("wf-sla-credit","Issue an SLA breach credit","src/workflows/credit.ts#issueSlaCredit",["stripe","salesforce","slack","datadog"],"An enterprise P1 missed its 4-hour SLA. The agent confirms the breach in Datadog, credits the next Stripe invoice, logs it on the Salesforce account and tells the customer in their shared Slack channel."),w("wf-escalate","Escalate a Slack-reported bug to engineering","src/workflows/escalate.ts#escalateToEngineering",["linear","slack","github","salesforce"],"A customer reports a bug in their shared Slack channel. The agent files a Linear issue with the account’s ARR from Salesforce, links the suspect GitHub commit and replies in the thread with the ticket."),w("wf-seat-refund","Refund a duplicate seat charge","src/workflows/billing.ts#refundDuplicateSeats",["stripe","hubspot","gmail"],"An admin was charged twice for the same seats. The agent refunds the duplicate in Stripe, notes it on the HubSpot company and emails a receipt."),w("wf-onboard","Provision a new customer workspace","src/workflows/onboarding.ts#provisionWorkspace",["okta","slack","notion","salesforce","stripe"],"A deal closes. The agent creates the SSO app in Okta, opens a shared Slack Connect channel, copies the onboarding plan into Notion and starts the Stripe subscription."),w("wf-renewal-risk","Flag a renewal at risk","src/workflows/renewals.ts#flagRenewalRisk",["salesforce","snowflake","slack","gmail"],"Ticket volume for an account doubles 60 days before renewal. The agent pulls usage from Snowflake, marks the Salesforce opportunity at risk and alerts the account owner."),w("wf-kb","Turn a resolved thread into a help article","src/workflows/kb.ts#publishArticle",["notion","slack","openai"],"A tricky question gets solved in Slack. The agent drafts a help-centre article with OpenAI and publishes it to the Notion knowledge base for review."),w("wf-outage-page","Page on-call for an enterprise outage","src/workflows/paging.ts#pageForOutage",["pagerduty","datadog","slack","linear"],"Three enterprise accounts report the same error in ten minutes. The agent checks Datadog, pages the owning team in PagerDuty and opens a Linear incident."),w("wf-csat","Send a CSAT survey after resolution","src/workflows/csat.ts#sendSurvey",["gmail","snowflake","salesforce"],"A ticket closes. The agent emails one survey per requester, stores the score in Snowflake and rolls it up on the Salesforce account."),w("wf-account-merge","Merge accounts after an acquisition","src/workflows/accounts.ts#mergeAccounts",["salesforce","hubspot","stripe","snowflake"],"A customer acquires another customer. The agent merges both Salesforce accounts, moves HubSpot contacts and consolidates the two Stripe subscriptions."),w("wf-offboard-agent","Remove a departed agent’s access","src/workflows/access.ts#offboardAgent",["okta","slack","github","notion"],"A support agent leaves. The agent deactivates them in Okta, removes them from customer Slack channels, GitHub and Notion, and reports what was revoked."),w("wf-twin-dup","Fault: Stripe times out after the credit commits","src/twin/faults.ts#creditTimeout",["stripe","salesforce","slack"],"The Stripe twin saves the credit, then delays its reply past the agent’s timeout. A correct agent checks before retrying; a naive one credits twice.")]},{slug:"intercom",name:"intercom-returns-twin",totalCommits:946,seed:202,risk:.16,changed:["src/workflows/refund.ts"],workflows:[w("wf-return","Approve a return and send the label","src/workflows/returns.ts#approveReturn",["shopify","intercom","gmail","netsuite"],"A shopper asks Fin to return boots bought 12 days ago. The agent checks the return window in Shopify, creates the return, books stock back into NetSuite and emails the prepaid label."),w("wf-refund","Refund a damaged item","src/workflows/refund.ts#refundDamaged",["stripe","shopify","intercom","netsuite"],"A customer sends a photo of a cracked lamp. The agent refunds the line item in Stripe, marks the Shopify order, writes off the unit in NetSuite and closes the Intercom conversation."),w("wf-exchange","Swap a size and reserve stock","src/workflows/exchange.ts#swapSize",["shopify","netsuite","intercom","klaviyo"],"A jacket is too small. The agent reserves the larger size in NetSuite, creates a zero-value exchange order in Shopify and pauses the post-purchase Klaviyo flow."),w("wf-address","Change a delivery address before dispatch","src/workflows/address.ts#changeAddress",["shopify","intercom","twilio"],"A customer moved. The agent updates the Shopify shipping address only if the order has not been picked, then confirms by SMS."),w("wf-paypal","Refund a PayPal order","src/workflows/refund.ts#refundPaypal",["paypal","shopify","intercom"],"An order paid with PayPal is cancelled. The agent refunds through PayPal, not Stripe, and records it on the Shopify order."),w("wf-backorder","Tell customers about a backorder","src/workflows/backorder.ts#notifyBackorder",["klaviyo","shopify","twilio","intercom"],"A best-seller slips three weeks. The agent finds every open order in Shopify and sends one Klaviyo email and one SMS per customer, with a cancel option."),w("wf-chargeback","Respond to a chargeback","src/workflows/disputes.ts#respondToDispute",["stripe","shopify","google-drive","slack"],"Stripe opens a dispute. The agent gathers the tracking proof from Shopify, files the evidence packet to Google Drive, submits it to Stripe and posts to #payments."),w("wf-loyalty","Grant goodwill loyalty points","src/workflows/loyalty.ts#grantPoints",["postgres","klaviyo","intercom"],"A late delivery deserves an apology. The agent adds 500 points in the loyalty database once and updates the Klaviyo profile."),w("wf-fraud-hold","Hold a high-risk return","src/workflows/risk.ts#holdReturn",["shopify","stripe","slack","postgres"],"The fifth return this month from one address. The agent holds the refund, tags the Shopify customer and asks the risk team in Slack."),w("wf-ledger","Send finance the weekly returns ledger","src/workflows/exports.ts#exportReturns",["google-sheets","netsuite","gmail"],"Every Monday the agent reconciles refunds against NetSuite credit memos, writes the ledger to Google Sheets and emails finance."),w("wf-twin-dup","Fault: refund webhook arrives twice","src/twin/faults.ts#duplicateWebhook",["stripe","shopify","intercom"],"The Stripe twin delivers the refund webhook twice. A correct agent ignores the repeat; a naive one refunds again.")]},{slug:"ramp",name:"ramp-ap-twin",totalCommits:2103,seed:303,risk:.3,changed:["src/workflows/payments.ts"],workflows:[w("wf-pay-invoice","Pay a vendor invoice from email","src/workflows/payments.ts#payInvoice",["bank","netsuite","gmail","slack","snowflake"],"An invoice PDF arrives at ap@. The agent extracts it, matches the vendor in NetSuite, schedules the ACH on its due date and posts the payment to #ap-payments."),w("wf-three-way","Three-way match an invoice to its PO","src/workflows/matching.ts#threeWayMatch",["netsuite","coupa","gmail","slack"],"The agent compares the invoice, the Coupa purchase order and the goods receipt. It approves matches and sends quantity or price variances back to the buyer."),w("wf-approval","Route an approval above $50,000","src/workflows/approvals.ts#routeApproval",["coupa","slack","okta","netsuite"],"A large invoice needs a VP. The agent finds the approver through Okta groups, asks in Slack and releases the NetSuite bill only after approval."),w("wf-vendor","Onboard a new vendor","src/workflows/vendors.ts#onboardVendor",["netsuite","docusign","bank","gmail"],"Procurement adds a supplier. The agent sends the W-9 and contract through DocuSign, verifies bank details with a penny test and creates the NetSuite vendor."),w("wf-bank-change","Verify a vendor’s bank-detail change","src/workflows/fraud.ts#verifyBankChange",["bank","netsuite","gmail","slack"],"An email asks to change where a vendor gets paid, a common fraud pattern. The agent freezes payments, calls back the number on file and alerts treasury."),w("wf-close","Reconcile month-end card spend","src/workflows/close.ts#reconcileCards",["netsuite","snowflake","quickbooks","slack"],"At month end the agent matches 4,000 card transactions to receipts, books them to NetSuite and the QuickBooks subsidiary, and lists the missing receipts."),w("wf-reimburse","Reimburse an employee expense","src/workflows/expenses.ts#reimburse",["bank","workday","netsuite","slack"],"An approved travel report is ready. The agent checks the employee in Workday, pays them once by ACH and books the expense."),w("wf-fx","Pay an international supplier in euros","src/workflows/payments.ts#payInEur",["bank","netsuite","gmail"],"A German supplier invoices in EUR. The agent books the FX rate, sends a SEPA transfer and records the realised gain or loss."),w("wf-budget","Warn a team that it is over budget","src/workflows/budgets.ts#warnOverrun",["snowflake","slack","workday"],"Marketing reaches 92% of its quarterly budget. The agent finds the budget owner in Workday and messages them once with the top spend."),w("wf-twin-dup","Fault: the bank times out after the transfer","src/twin/faults.ts#transferTimeout",["bank","netsuite","slack"],"The bank twin sends the wire, then never answers. A correct agent checks the transfer status before retrying; a naive one pays the vendor twice.")]},{slug:"clay",name:"clay-gtm-twin",totalCommits:1740,seed:404,risk:.18,changed:["src/workflows/routing.ts"],workflows:[w("wf-route-lead","Enrich and route an inbound lead","src/workflows/routing.ts#routeLead",["salesforce","openai","slack","snowflake"],"A VP fills in the demo form. The agent enriches the company, scores fit with OpenAI against Snowflake win data, assigns the right rep in Salesforce and pings them in Slack."),w("wf-sequence","Enroll a lead in an outbound sequence","src/workflows/outbound.ts#enroll",["gmail","hubspot","salesforce"],"A target account shows intent. The agent writes a three-step personalised sequence, sends from the rep’s Gmail and logs every touch in HubSpot."),w("wf-book-demo","Book a demo from an email reply","src/workflows/meetings.ts#bookFromReply",["google-calendar","salesforce","gmail","zoom"],"A prospect replies “Thursday works”. The agent finds a free slot on the rep’s calendar, creates the Zoom link, sends the invite and moves the Salesforce stage."),w("wf-dedupe","Deduplicate accounts before territory planning","src/workflows/hygiene.ts#dedupeAccounts",["salesforce","snowflake","google-sheets"],"Before the new fiscal year, the agent finds duplicate Salesforce accounts by domain, merges them and shares the change list in Google Sheets."),w("wf-intent","Alert reps to product-usage intent","src/workflows/signals.ts#usageIntent",["mixpanel","salesforce","slack"],"A free workspace invites its tenth teammate. The agent reads the Mixpanel event, creates a Salesforce task and alerts the owner."),w("wf-closed-won","Hand a closed-won deal to onboarding","src/workflows/handoff.ts#closedWon",["attio","salesforce","slack","gmail"],"A deal closes. The agent creates the customer record in Attio, opens the onboarding channel and sends the welcome email once."),w("wf-webinar","Follow up with webinar attendees","src/workflows/events.ts#webinarFollowUp",["marketo","hubspot","gmail"],"After a webinar the agent splits attendees from no-shows in Marketo and sends each group one follow-up from HubSpot."),w("wf-unsubscribe","Honour an unsubscribe everywhere","src/workflows/compliance.ts#unsubscribe",["hubspot","marketo","salesforce","gmail"],"A prospect asks to be removed. The agent opts them out in HubSpot, Marketo and Salesforce and cancels any queued Gmail sends."),w("wf-twin-dup","Fault: Gmail times out mid-sequence","src/twin/faults.ts#sendTimeout",["gmail","hubspot","salesforce"],"The Gmail twin sends step two, then delays its reply. A correct agent checks the sent folder; a naive one emails the prospect twice.")]},{slug:"cognition",name:"cognition-coding-twin",totalCommits:3421,seed:505,risk:.24,changed:["src/workflows/deploy.ts"],workflows:[w("wf-fix-bug","Fix a Linear bug and open a pull request","src/workflows/bugs.ts#fixAndOpenPr",["github","linear","slack","sentry"],"A bug is assigned to the agent in Linear. It reads the Sentry stack trace, writes the fix and a test, opens one PR and links it on the issue."),w("wf-jira","Pick up a Jira ticket for a customer repo","src/workflows/bugs.ts#fromJira",["jira","gitlab","slack"],"An enterprise customer runs Jira and GitLab. The agent takes the ticket, opens a merge request and moves the ticket to In Review."),w("wf-cve","Upgrade a vulnerable dependency","src/workflows/security.ts#patchCve",["github","linear","slack"],"A critical CVE lands in a transitive dependency. The agent bumps it across 14 repositories, opening one PR each, and tracks them on a Linear project."),w("wf-migration","Ship a database migration safely","src/workflows/migrations.ts#ship",["postgres","github","datadog","slack"],"The agent adds a column with a backfill, runs it against a copy of production, watches Datadog latency and posts the result before merging."),w("wf-deploy","Deploy and watch error rates","src/workflows/deploy.ts#deployAndWatch",["aws","datadog","sentry","slack","github"],"After merge the agent deploys to AWS, watches Sentry and Datadog for 15 minutes and rolls back on its own if errors climb."),w("wf-flaky","Quarantine a flaky test","src/workflows/ci.ts#quarantineFlaky",["github","linear","slack"],"A test fails 1 run in 20. The agent quarantines it in one PR and files a Linear issue for the owner."),w("wf-postmortem","Draft an incident postmortem","src/workflows/incidents.ts#draftPostmortem",["notion","pagerduty","datadog","slack"],"After an incident closes, the agent pulls the PagerDuty timeline and Datadog graphs into a Notion postmortem draft."),w("wf-rollback","Roll back a bad release","src/workflows/deploy.ts#rollback",["aws","github","pagerduty","slack"],"PagerDuty fires after a release. The agent reverts to the previous AWS task definition, opens the revert PR and resolves the page."),w("wf-twin-dup","Fault: GitHub times out after the PR is created","src/twin/faults.ts#prTimeout",["github","linear","slack"],"The GitHub twin creates the pull request, then times out. A correct agent searches for its branch first; a naive one opens a second PR.")]},{slug:"sentry",name:"sentry-oncall-twin",totalCommits:1655,seed:606,risk:.12,changed:["src/workflows/triage.ts"],workflows:[w("wf-triage","Triage a new error spike","src/workflows/triage.ts#triageSpike",["sentry","github","linear","slack"],"A new issue hits 2,000 events in five minutes. The agent groups it, finds the suspect commit on GitHub, files one Linear issue and posts to the team channel."),w("wf-page","Page the owning team","src/workflows/paging.ts#pageOwner",["pagerduty","sentry","slack","google-calendar"],"The agent reads code owners, checks who is on call and not on holiday in Google Calendar, and pages them once in PagerDuty."),w("wf-assign","Assign an issue to the commit author","src/workflows/ownership.ts#assignAuthor",["sentry","github","slack"],"Sentry ties a regression to a release. The agent assigns the issue to the author of the suspect commit and DMs them the stack trace."),w("wf-war-room","Open an incident war room","src/workflows/incidents.ts#openWarRoom",["slack","zoom","pagerduty","notion"],"A SEV-1 is declared. The agent creates the incident channel and Zoom bridge, invites responders and starts the Notion timeline."),w("wf-release-hold","Hold a release with crash regressions","src/workflows/releases.ts#holdRelease",["sentry","github","slack","datadog"],"The crash-free rate falls below 99.5% on a canary. The agent blocks the GitHub deployment and posts the evidence."),w("wf-customer-impact","Notify affected enterprise customers","src/workflows/comms.ts#notifyCustomers",["salesforce","sentry","gmail","slack"],"The agent finds which enterprise accounts hit the error, emails each technical contact once and logs it in Salesforce."),w("wf-autoscale","Scale up during an ingest spike","src/workflows/capacity.ts#scaleIngest",["aws","datadog","pagerduty","slack"],"Event ingest triples. The agent raises the AWS autoscaling limit within policy and tells on-call what changed."),w("wf-resolve","Resolve an issue and link the fix","src/workflows/triage.ts#resolveWithFix",["sentry","github","jira"],"A fix merges. The agent marks the Sentry issue resolved in the next release and closes the linked Jira ticket."),w("wf-twin-dup","Fault: PagerDuty times out after paging","src/twin/faults.ts#pageTimeout",["pagerduty","slack","sentry"],"The PagerDuty twin creates the incident, then stalls. A correct agent checks for the open incident; a naive one wakes the engineer twice.")]},{slug:"abridge",name:"abridge-clinical-twin",totalCommits:887,seed:707,risk:.26,changed:["src/workflows/notes.ts"],workflows:[w("wf-note","File a visit note to the EHR","src/workflows/notes.ts#fileNote",["ehr","openai","snowflake"],"A clinician ends a recorded visit. The agent drafts the SOAP note, files it to the patient’s encounter in the EHR once and logs the draft for quality review."),w("wf-codes","Suggest billing codes for review","src/workflows/coding.ts#suggestCodes",["ehr","snowflake","servicenow"],"From the signed note the agent suggests ICD-10 and CPT codes, attaches them to the encounter and opens a ServiceNow task if documentation is thin."),w("wf-referral","Send a specialist referral","src/workflows/referrals.ts#sendReferral",["ehr","twilio","gmail"],"The plan says “refer to cardiology”. The agent creates the referral order, texts the patient the clinic number and emails the specialist’s office."),w("wf-followup","Schedule a patient follow-up","src/workflows/scheduling.ts#bookFollowUp",["ehr","google-calendar","twilio"],"A follow-up is due in two weeks. The agent books one appointment in the clinic calendar and sends one SMS reminder."),w("wf-prior-auth","Submit a prior authorisation","src/workflows/payers.ts#priorAuth",["ehr","docusign","gmail","servicenow"],"An MRI needs payer approval. The agent assembles the clinical justification, gets the physician’s DocuSign signature and submits it."),w("wf-phi-audit","Audit access to patient records","src/workflows/compliance.ts#auditPhiAccess",["siem","okta","ehr","slack"],"Nightly the agent compares EHR chart access in the SIEM with Okta roles and flags anyone who opened a chart without a care relationship."),w("wf-clinician","Give a new clinician access","src/workflows/access.ts#onboardClinician",["okta","entra","ehr","slack"],"A physician joins. The agent assigns Okta and Entra groups, provisions their EHR template and confirms in Slack."),w("wf-amend","Correct an amended note","src/workflows/notes.ts#amendNote",["ehr","servicenow","slack"],"A clinician corrects a medication dose. The agent files an addendum, never an overwrite, and records the change request."),w("wf-twin-dup","Fault: the EHR times out after the note saves","src/twin/faults.ts#noteTimeout",["ehr","slack","snowflake"],"The EHR twin saves the note, then times out. A correct agent checks the encounter; a naive one files the note twice in the patient’s chart.")]},{slug:"paloalto",name:"paloalto-triage-twin",totalCommits:1988,seed:808,risk:.1,changed:["src/workflows/containment.ts"],workflows:[w("wf-phish","Contain a reported phishing email","src/workflows/phishing.ts#contain",["outlook","siem","edr","servicenow","slack"],"An employee reports a phish. The agent pulls every copy from Outlook inboxes, checks the SIEM for clicks, scans those laptops with EDR and opens one ServiceNow incident."),w("wf-isolate","Isolate an infected laptop","src/workflows/containment.ts#isolateHost",["edr","servicenow","okta","slack"],"EDR detects ransomware behaviour. The agent isolates the host, suspends the user’s Okta sessions and pages the SOC."),w("wf-travel","Respond to impossible travel","src/workflows/identity.ts#impossibleTravel",["okta","siem","pagerduty","slack"],"A user signs in from Lisbon and Singapore 20 minutes apart. The agent forces re-authentication and asks the user to confirm in Slack."),w("wf-leaked-key","Revoke a leaked AWS key","src/workflows/secrets.ts#revokeKey",["aws","github","siem","jira"],"GitHub secret scanning finds an AWS key in a public repo. The agent deactivates the key, checks CloudTrail in the SIEM for use and files a Jira ticket."),w("wf-cve","Open tickets for a critical CVE","src/workflows/vulns.ts#ticketCve",["jira","edr","slack"],"A critical CVE is published. The agent finds affected hosts through EDR and opens one Jira ticket per owning team."),w("wf-offboard","Cut access for a terminated employee","src/workflows/identity.ts#offboard",["okta","entra","workday","servicenow"],"Workday records a termination. The agent disables Okta and Entra accounts within 15 minutes and logs the evidence for audit."),w("wf-s3","Lock down a public S3 bucket","src/workflows/cloud.ts#lockBucket",["aws","siem","jira","slack"],"A bucket with customer data becomes public. The agent blocks public access, checks access logs and notifies the owner."),w("wf-mfa","Reset MFA after identity verification","src/workflows/identity.ts#resetMfa",["okta","servicenow","twilio"],"A user lost their phone. The agent verifies them by SMS to the number on file and resets Okta MFA once."),w("wf-twin-dup","Fault: ServiceNow times out after the ticket opens","src/twin/faults.ts#ticketTimeout",["servicenow","slack","siem"],"The ServiceNow twin opens the incident, then stalls. A correct agent searches for it; a naive one opens a duplicate and splits the investigation.")]}].map(e=>{let{slug:t,name:s,totalCommits:f,seed:w,risk:m,changed:k,workflows:b}=e,y=[...new Set(b.flatMap(e=>e.tools))].map(e=>{var t,s;let o=null!=(s=null==(t=(0,a.SG)(e))?void 0:t.name)?s:e;return"postgres"===e?r(e,o,{kind:"database"}):g.has(e)?{id:e,title:o,interface:"api",kind:"service",category:"access",confidence:"medium"}:r(e,o)});return{slug:t,inventory:{schema:"company-inventory/v1",name:s,generatedAt:"2026-10-23T09:12:00Z",git:{branch:"main",head:o,previousHead:"8e4b2c71fa39d6b05c8e7a1f0d93c5b6e2a8d7f1",dirty:!1,capturedAt:"2026-10-23T09:12:00Z",totalCommits:f,commits:Array.from({length:29},(e,t)=>({sha:(o+t.toString(16).padStart(4,"0")).slice(0,40),date:new Date(Date.now()-(13-t%14)*864e5-(t+1)*36e5).toISOString(),message:["Fix thread id lookup","Add retry around postMessage","Extract shared helper","Handle renamed channel","Pin runner version","Cache lookups","Return actionable error","Structured logging","Bump adapter contracts","Tiny copy fixes"][t%10],author:"sashank"})),changedFiles:k},tools:y,workflows:b.map(e=>{var t;return{...e,confidence:"medium",steps:(null!=(t=e.tools)?t:[]).map(e=>({tool:e,operations:["invoke","observe"]}))}})},runs:function(e,t){let s,o=(s=t,()=>{s|=0;let e=Math.imul((s=s+0x6d2b79f5|0)^s>>>15,1|s);return(((e=e+Math.imul(e^e>>>7,61|e)^e)^e>>>14)>>>0)/0x100000000}),r=e.inventory.workflows,f=Date.now(),w=[];for(let t=0;t<120;t++){var g,m,k,b,y,v;let s,S,A=r[Math.floor(t/120*r.length+1.4*o())%r.length],T=Math.floor(56*o()),C=function(e,t,s){let a=t*(.35+1.3*s/56),o=e();return o<.6*a?"failed":o<.75*a?"incomplete":o<.9*a?"error":"passed"}(o,null!=(g=e.risk)?g:.2,T),R=new Date(f-864e5*T-36e5*Math.floor(20*o())).toISOString(),x=l(o,n),E=t=>{var s,a;return null!=(a=null==(s=e.inventory.tools.find(e=>e.id===t))?void 0:s.title)?a:t},P=(null!=(m=A.tools)?m:[]).map(E),O=null!=(k=P[0])?k:"CLI",M=null!=(y=null!=(b=P[1])?b:P[0])?y:"CLI",I="".concat(1e3+Math.floor(8900*o())),D=(e,t,s,a,o)=>({service:e,path:t,summary:s,expected:a,actual:o,count:a,passed:a===o}),_=[],q=[],F=(e,t,s,a)=>q.push({sequence:q.length+1,service:e,operation:t,path:s,detail:a});if(F("CLI","loaded",A.id,"Loaded workflow ".concat(A.id)),"passed"===C)_.push(D(O,"".concat(A.id,"/outcome"),"Expected outcome recorded",1,1)),_.push(D(O,"".concat(A.id,"/writes"),"Exactly one write performed",1,1)),o()>.4&&_.push(D(M,"".concat(A.id,"/side-effect"),"Downstream effect verified",1,1)),F("CLI","finished",A.id,"".concat(_.length," checks recorded"));else if("failed"===C)l(o,["missing","duplicated","stale","wrong value"]),_.push(D(O,"".concat(A.id,"/outcome"),"Expected outcome recorded",1,0)),o()>.5&&_.push(D(M,"".concat(A.id,"/side-effect"),"Downstream effect verified",1,0)),_.push(D("CLI","retries","Retry budget respected",0,0)),F("CLI","finished",A.id,"Recorded outcome differs from expected");else if("error"===C){let e=l(o,["credentials missing for the sandbox account","adapter exited before the first call","rate limit exhausted on the test tenant","fixture set failed to load"]);_.push(D(O,"".concat(A.id,"/outcome"),"Workflow could not finish",1,0)),F("CLI","error",A.id,e.charAt(0).toUpperCase()+e.slice(1)),F("CLI","aborted",A.id,"Workflow aborted before the first write"),s="Workflow could not start: ".concat(e,".")}else _.push(D(O,"".concat(A.id,"/outcome"),"Workflow finished inside its limit",1,0)),F("CLI","timeout",A.id,"Exceeded the workflow time limit before completing");let L={},N={};(null!=(v=A.tools)?v:[]).forEach((e,t)=>{var s;let n=function(e,t,s,o){var n,r,i,c,l,f,w,g,m;let k=null!=(r=null==(n=(0,a.SG)(e))?void 0:n.shape)?r:"records",b=Number(t),[y,v]=null!=(i=d[e])?i:d.stripe,S=100*Math.round(y+s()*(v-y))+Math.floor(100*s());if("money"===k){let[s,a]=null!=(c=h[e])?c:h.stripe;return{path:s,detail:a.replace("{$}","$".concat((S/100).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}))).replace("{n}",t),before:[{id:"re_".concat(b-7),amount:Math.round(.62*S),currency:"usd",charge:"ch_".concat(b-7),status:"succeeded",reason:"duplicate"},{id:"re_".concat(b-3),amount:Math.round(.37*S),currency:"usd",charge:"ch_".concat(b-3),status:"succeeded",reason:"requested_by_customer"}],added:[{id:"re_".concat(b),amount:S,currency:"usd",charge:"ch_".concat(t),status:"succeeded",reason:"requested_by_customer"}]}}if("messages"===k){let s="twilio"===e?"+1 415 555 0"+t.slice(-3):["gmail","outlook","klaviyo"].includes(e)?"customer".concat(t,"@example.com"):"intercom"===e?"conversation ".concat(t):"zoom"===e?"bridge ".concat(t):"#ops-escalations";return{path:"twilio"===e?"/Messages.json":"intercom"===e?"/conversations":"/messages",detail:"Sent to ".concat(s),before:[{id:"m_".concat(b-2),to:s,text:"Thanks — we are looking into this now.",status:"delivered"}],added:[{id:"m_".concat(b),to:s,text:"".concat(o," — done for #").concat(t,". Reply here if anything looks off."),status:"sent"}]}}return"work"===k?{path:(null!=(l=u[e])?l:["/issues"])[0],detail:"".concat((null!=(f=u[e])?f:[,"Opened issue"])[1]," for #").concat(t),changedId:"ENG-".concat(b-1),before:[{id:"ENG-".concat(b-4),title:"Webhook retries spike after deploy",state:"In Progress"},{id:"ENG-".concat(b-1),title:"Customer #".concat(t," cannot see invoices"),state:"Todo"}],changed:{id:"ENG-".concat(b-1),title:"Customer #".concat(t," cannot see invoices"),state:"In Progress"},added:[{id:"ENG-".concat(b),title:"P1: ".concat(o.toLowerCase()," for #").concat(t),state:"Todo"}]}:"files"===k?{path:null!=(w=({"google-drive":"/files",sharepoint:"/drive/items",docusign:"/envelopes"})[e])?w:"/pages",detail:"Wrote page for #".concat(t),before:[{id:"pg_".concat(b-5),title:"Support macros"}],added:[{id:"pg_".concat(b),title:"".concat(o," — #").concat(t)}]}:"data"===k?{path:null!=(g=({snowflake:"/statements",openai:"/responses","google-sheets":"/values"})[e])?g:"/rows",detail:"openai"===e?"Generated draft for #".concat(t):"Inserted row ".concat(t),before:[{id:"r_".concat(b-1),name:"job ".concat(b-1),status:"done"}],added:[{id:"r_".concat(b),name:"job ".concat(t),status:"queued"}]}:{path:null!=(m=p[e])?m:"/records",detail:"Updated record #".concat(t),changedId:"c_".concat(t),before:[{id:"c_".concat(t),name:"Ada Ruiz",email:"ada".concat(t,"@example.com"),status:"lead"},{id:"c_".concat(b+1),name:"Sam Okafor",email:"sam@example.com",status:"customer"}],changed:{id:"c_".concat(t),name:"Ada Ruiz",email:"ada".concat(t,"@example.com"),status:"customer"},added:[]}}(e,I,o,A.title),r="failed"===C&&0===t&&n.added.length>0;L[e]={[n.path]:n.before},N[e]={[n.path]:"error"===C?n.before:[...n.before.filter(e=>!n.changedId||e.id!==n.changedId),...n.changed?[n.changed]:[],..."incomplete"===C&&t>0?[]:n.added,...r?n.added.map(e=>({...e,id:e.id+"_2"})):[]]},"error"!==C&&("incomplete"!==C||!(t>0))&&(q.splice(q.length-1,0,{sequence:0,service:e,operation:"write",path:n.path,detail:n.detail,record:null!=(s=n.added[0])?s:n.changed}),r&&(S={type:"timeout-after-write",service:e,path:n.path,delayMs:1500,triggered:!0},q.splice(q.length-1,0,{sequence:0,service:e,operation:"fault",path:n.path,detail:"write committed; response delayed 1500ms"}),q.splice(q.length-1,0,{sequence:0,service:e,operation:"write",path:n.path,detail:"Retried after timeout \xb7 ".concat(n.detail),record:{...n.added[0],id:n.added[0].id+"_2"}}),_.unshift(D(E(e),n.path,"Exactly one write performed",1,2))))}),q.forEach((e,t)=>{e.sequence=t+1}),F("CLI","receipt",A.id,"Run receipt written for ".concat(A.id)),w.push({schema:"agenttwin/run-v1",project:e.inventory.name,workflowId:A.id,entrypoint:A.entrypoint,name:A.id.replace(/^wf-/,"").replaceAll("-","_")+"_".concat(I),status:C,runId:c(o),runtime:"local",createdAt:R,durationMs:800+Math.floor(2600*o()),git:{head:x,branch:"main",dirty:o()>.85,capturedAt:R,totalCommits:1284,commits:[],changedFiles:[]},application:{command:["node","packages/cli/dist/cli.js","run","--workflow",A.id],exitCode:+("passed"!==C),stdout:"passed"===C?"".concat(A.title," finished with all checks passing."):"".concat(A.title," did not pass its recorded checks."),stderr:"",..."incomplete"===C?{timedOut:!0}:{}},assertions:_,events:q,initialState:L,finalState:N,...S?{fault:S}:{},sourceDigests:{},specDigest:i(o,64),...s?{executionError:s}:{}})}return w}({inventory:{name:s,tools:y,workflows:b},risk:m},w)}}),k=Object.fromEntries([...m.map(e=>[e.slug,e])]);m[0].inventory,m[0].runs}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9492],{3652:o=>{o.exports={footer:"SiteFooter_footer__aUaTs",content:"SiteFooter_content__1J6Jy",navigation:"SiteFooter_navigation__Zsq8o",main:"SiteFooter_main__EWvbi",brand:"SiteFooter_brand__HyIqL",groups:"SiteFooter_groups__tPgIM",group:"SiteFooter_group__FK9ik",more:"SiteFooter_more__LEh69",bottom:"SiteFooter_bottom__ADU2b",srOnly:"SiteFooter_srOnly__e7DbB"}},3783:(o,e,t)=>{Promise.resolve().then(t.t.bind(t,3652,23))}},o=>{o.O(0,[4123,8441,1255,7358],()=>o(o.s=3783)),_N_E=o.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7220],{2670:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,3652,23)),Promise.resolve().then(n.bind(n,8765)),Promise.resolve().then(n.t.bind(n,3845,23)),Promise.resolve().then(n.t.bind(n,5875,23))},3652:e=>{e.exports={footer:"SiteFooter_footer__aUaTs",content:"SiteFooter_content__1J6Jy",navigation:"SiteFooter_navigation__Zsq8o",main:"SiteFooter_main__EWvbi",brand:"SiteFooter_brand__HyIqL",groups:"SiteFooter_groups__tPgIM",group:"SiteFooter_group__FK9ik",more:"SiteFooter_more__LEh69",bottom:"SiteFooter_bottom__ADU2b",srOnly:"SiteFooter_srOnly__e7DbB"}},3845:()=>{},5875:()=>{},8765:(e,t,n)=>{"use strict";n.d(t,{default:()=>l});var a=n(5155),i=n(2115),s=n(1719);function o(){let[e,t]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{t("light"===document.documentElement.dataset.siteTheme)},[]),(0,a.jsxs)("button",{className:"site-theme-toggle",type:"button","aria-label":e?"Switch to dark mode":"Switch to light mode",title:e?"Switch to dark mode":"Switch to light mode",onClick:()=>{let e="light"!==document.documentElement.dataset.siteTheme,n=e?"light":"dark";document.documentElement.dataset.siteTheme=n,t(e);try{localStorage.setItem("agenttwin-site-theme",n)}catch(e){}},children:[(0,a.jsx)(s.gLX,{className:"site-theme-sun",width:20,height:20,"aria-hidden":"true"}),(0,a.jsx)(s.rRK,{className:"site-theme-moon",width:20,height:20,"aria-hidden":"true"})]})}let r=[{href:"/what-is-agenttwin/",label:"Product"},{href:"/#how",label:"How it works"},{href:"/pricing/",label:"Pricing"},{href:"/about/",label:"About"},{href:"/docs/",label:"Docs"},{href:"/blog/",label:"Blog"}];function l(){let[e,t]=(0,i.useState)(!1),n=(0,i.useRef)(null),s=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=e=>{var a,i;"Escape"===e.key&&(null==(a=s.current)?void 0:a.querySelector("#navlinks.is-open"))&&(t(!1),null==(i=n.current)||i.focus())},a=e=>{var n;(null==(n=s.current)?void 0:n.contains(e.target))||t(!1)},i=matchMedia("(min-width: 1024px)"),o=()=>t(!1);return document.addEventListener("keydown",e),document.addEventListener("click",a),i.addEventListener("change",o),()=>{document.removeEventListener("keydown",e),document.removeEventListener("click",a),i.removeEventListener("change",o)}},[]),(0,a.jsxs)("header",{className:"site-header",ref:s,children:[(0,a.jsxs)("a",{className:"brand",href:"/","aria-label":"AgentTwin home",children:[(0,a.jsx)("img",{src:"assets/logo/mark-twin-rings.svg?v=white-rings",alt:"","aria-hidden":"true",width:29,height:29}),"AgentTwin"]}),(0,a.jsxs)("nav",{className:"main-nav".concat(e?" is-open":""),id:"navlinks","aria-label":"Main navigation",children:[r.map(e=>(0,a.jsx)("a",{href:e.href,onClick:()=>t(!1),children:e.label},e.href)),(0,a.jsx)("a",{className:"nav-mobile-dashboard",href:"/dashboard/",onClick:()=>t(!1),children:"Open dashboard"})]}),(0,a.jsxs)("div",{className:"nav-actions",children:[(0,a.jsx)("a",{href:"/login/",children:"Sign in"}),(0,a.jsxs)("a",{className:"button button-white button-small",href:"/signup/",children:["Get started ",(0,a.jsx)("span",{"aria-hidden":"true",children:"\xbb"})]})]}),(0,a.jsx)(o,{}),(0,a.jsxs)("button",{className:"menu-toggle",ref:n,type:"button","aria-label":e?"Close menu":"Open menu","aria-expanded":e,"aria-controls":"navlinks",onClick:()=>t(!e),children:[(0,a.jsx)("span",{}),(0,a.jsx)("span",{})]})]})}}},e=>{e.O(0,[4123,7502,9832,5105,8441,1255,7358],()=>e(e.s=2670)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9842],{
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9842],{3529:(e,a,s)=>{"use strict";s.d(a,{default:()=>o});var n=s(5155),t=s(2115),r=s(6787);function o(){let[e,a]=(0,t.useState)(null),[s,o]=(0,t.useState)(!0),[i,l]=(0,t.useState)(""),[d,c]=(0,t.useState)(""),[h,u]=(0,t.useState)(!1),[p,w]=(0,t.useState)(""),[g,m]=(0,t.useState)(!1),[f,y]=(0,t.useState)("/login/");async function j(e){if(e.preventDefault(),!h){if(w(""),i!==d)return void w("The passwords do not match.");u(!0);try{let e=await fetch(r.n+"/v1/auth/password",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:i}),signal:AbortSignal.timeout(2e4)}),s=await e.json();if(!e.ok)throw Error(s.error||"Could not create your password.");a(s.user),l(""),c(""),m(!0)}catch(e){w(e instanceof TypeError?"Could not connect to AgentTwin. Please try again.":e instanceof Error?e.message:"Could not create your password.")}finally{u(!1)}}}return(0,t.useEffect)(()=>{let e=new AbortController,s=["localhost","127.0.0.1"].includes(location.hostname)&&"https://api.agenttwin.si"===r.n;return s&&y("https://agenttwin.si/login/"),fetch(r.n+"/v1/auth/me",{credentials:"include",signal:e.signal,cache:"no-store"}).then(async e=>{var s;if(!e.ok)throw Error("Sign in with Google, then open Settings → Email and password.");let n=await e.json();if(!(null==(s=n.user)?void 0:s.email))throw Error("Could not load your account. Please sign in again.");a(n.user)}).catch(a=>{e.signal.aborted||w(a instanceof TypeError?s?"This local preview cannot connect to production sign-in. Open agenttwin.si to manage your password.":"Could not connect to AgentTwin. Please try again.":a instanceof Error?a.message:"Could not load your account.")}).finally(()=>{e.signal.aborted||o(!1)}),()=>e.abort()},[]),(0,n.jsxs)("main",{className:"auth-page auth-entry vercel-auth vercel-entry",children:[(0,n.jsxs)("header",{className:"auth-header",children:[(0,n.jsx)("a",{className:"auth-brand",href:"/","aria-label":"AgentTwin home",children:(0,n.jsx)("img",{src:"assets/logo/mark-twin-rings.svg",width:"26",height:"26",alt:""})}),(0,n.jsx)("a",{className:"auth-header-link",href:"/dashboard/#settings",children:"Back to settings"})]}),(0,n.jsxs)("section",{className:"auth-card auth-entry-card","aria-labelledby":"password-title",children:[(0,n.jsx)("h1",{id:"password-title",children:"Email and password"}),s&&(0,n.jsx)("p",{role:"status",children:"Loading your sign-in methods…"}),p&&(0,n.jsx)("p",{role:"alert",children:p}),g?(0,n.jsxs)("p",{role:"status",children:["Password created. You can now sign in with ",null==e?void 0:e.email," and your password, or continue with Google. Your workspace is the same."]}):(null==e?void 0:e.passwordEnabled)?(0,n.jsxs)("p",{children:["Email and password sign-in is already enabled for ",e.email,"."]}):(null==e?void 0:e.passwordSetupAllowed)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("p",{children:["Create an AgentTwin password for ",e.email,". Google sign-in will keep working."]}),(0,n.jsx)("p",{children:"For security, sign in with Google within the last 10 minutes before saving."}),(0,n.jsxs)("form",{onSubmit:j,"aria-busy":h,children:[(0,n.jsx)("input",{type:"text",name:"username",autoComplete:"username",value:e.email,readOnly:!0,hidden:!0}),(0,n.jsxs)("label",{htmlFor:"new-password",children:["New password",(0,n.jsx)("input",{id:"new-password",type:"password",autoComplete:"new-password",minLength:12,maxLength:128,required:!0,value:i,onChange:e=>l(e.target.value),"aria-describedby":"password-guidance"})]}),(0,n.jsx)("small",{id:"password-guidance",children:"Use 12–128 characters. This is a new AgentTwin password, separate from your Google password."}),(0,n.jsxs)("label",{htmlFor:"confirm-password",children:["Confirm password",(0,n.jsx)("input",{id:"confirm-password",type:"password",autoComplete:"new-password",minLength:12,maxLength:128,required:!0,value:d,onChange:e=>c(e.target.value)})]}),(0,n.jsx)("button",{className:"auth-primary",type:"submit",disabled:h,children:h?"Saving…":"Create password"})]})]}):e&&(0,n.jsx)("p",{children:"Password setup is available for accounts created with Google."}),!s&&!g&&!(null==e?void 0:e.passwordEnabled)&&(0,n.jsx)("p",{children:(0,n.jsx)("a",{href:f,children:"Sign in with Google again →"})})]}),(0,n.jsx)("footer",{className:"auth-footer",children:(0,n.jsx)("a",{href:"/dashboard/#settings",children:"Back to settings"})})]})}},8300:(e,a,s)=>{Promise.resolve().then(s.bind(s,3529))}},e=>{e.O(0,[3935,6787,8441,1255,7358],()=>e(e.s=8300)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[977,990,1369,2481,2882,3232,4345,6226,6402,6990,7006,7066,8365,9366,9877],{3652:e=>{e.exports={footer:"SiteFooter_footer__aUaTs",content:"SiteFooter_content__1J6Jy",navigation:"SiteFooter_navigation__Zsq8o",main:"SiteFooter_main__EWvbi",brand:"SiteFooter_brand__HyIqL",groups:"SiteFooter_groups__tPgIM",group:"SiteFooter_group__FK9ik",more:"SiteFooter_more__LEh69",bottom:"SiteFooter_bottom__ADU2b",srOnly:"SiteFooter_srOnly__e7DbB"}},8614:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,3652,23)),Promise.resolve().then(n.bind(n,8765))},8765:(e,t,n)=>{"use strict";n.d(t,{default:()=>l});var a=n(5155),i=n(2115),s=n(1719);function o(){let[e,t]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{t("light"===document.documentElement.dataset.siteTheme)},[]),(0,a.jsxs)("button",{className:"site-theme-toggle",type:"button","aria-label":e?"Switch to dark mode":"Switch to light mode",title:e?"Switch to dark mode":"Switch to light mode",onClick:()=>{let e="light"!==document.documentElement.dataset.siteTheme,n=e?"light":"dark";document.documentElement.dataset.siteTheme=n,t(e);try{localStorage.setItem("agenttwin-site-theme",n)}catch(e){}},children:[(0,a.jsx)(s.gLX,{className:"site-theme-sun",width:20,height:20,"aria-hidden":"true"}),(0,a.jsx)(s.rRK,{className:"site-theme-moon",width:20,height:20,"aria-hidden":"true"})]})}let r=[{href:"/what-is-agenttwin/",label:"Product"},{href:"/#how",label:"How it works"},{href:"/pricing/",label:"Pricing"},{href:"/about/",label:"About"},{href:"/docs/",label:"Docs"},{href:"/blog/",label:"Blog"}];function l(){let[e,t]=(0,i.useState)(!1),n=(0,i.useRef)(null),s=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=e=>{var a,i;"Escape"===e.key&&(null==(a=s.current)?void 0:a.querySelector("#navlinks.is-open"))&&(t(!1),null==(i=n.current)||i.focus())},a=e=>{var n;(null==(n=s.current)?void 0:n.contains(e.target))||t(!1)},i=matchMedia("(min-width: 1024px)"),o=()=>t(!1);return document.addEventListener("keydown",e),document.addEventListener("click",a),i.addEventListener("change",o),()=>{document.removeEventListener("keydown",e),document.removeEventListener("click",a),i.removeEventListener("change",o)}},[]),(0,a.jsxs)("header",{className:"site-header",ref:s,children:[(0,a.jsxs)("a",{className:"brand",href:"/","aria-label":"AgentTwin home",children:[(0,a.jsx)("img",{src:"assets/logo/mark-twin-rings.svg?v=white-rings",alt:"","aria-hidden":"true",width:29,height:29}),"AgentTwin"]}),(0,a.jsxs)("nav",{className:"main-nav".concat(e?" is-open":""),id:"navlinks","aria-label":"Main navigation",children:[r.map(e=>(0,a.jsx)("a",{href:e.href,onClick:()=>t(!1),children:e.label},e.href)),(0,a.jsx)("a",{className:"nav-mobile-dashboard",href:"/dashboard/",onClick:()=>t(!1),children:"Open dashboard"})]}),(0,a.jsxs)("div",{className:"nav-actions",children:[(0,a.jsx)("a",{href:"/login/",children:"Sign in"}),(0,a.jsxs)("a",{className:"button button-white button-small",href:"/signup/",children:["Get started ",(0,a.jsx)("span",{"aria-hidden":"true",children:"\xbb"})]})]}),(0,a.jsx)(o,{}),(0,a.jsxs)("button",{className:"menu-toggle",ref:n,type:"button","aria-label":e?"Close menu":"Open menu","aria-expanded":e,"aria-controls":"navlinks",onClick:()=>t(!e),children:[(0,a.jsx)("span",{}),(0,a.jsx)("span",{})]})]})}}},e=>{e.O(0,[4123,5105,8441,1255,7358],()=>e(e.s=8614)),_N_E=e.O()}]);
|