reflex-agent 0.13.4 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-build-manifest.json +102 -95
- package/.next/app-path-routes-manifest.json +8 -7
- package/.next/build-manifest.json +5 -5
- package/.next/prerender-manifest.json +3 -3
- package/.next/react-loadable-manifest.json +1 -1
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/agents/[agentId]/page.js +1 -1
- package/.next/server/app/agents/[agentId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/agents/[agentId]/respond/route.js +1 -1
- package/.next/server/app/api/agents/[agentId]/respond/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/images/[rootId]/[file]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/oauth/callback/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/oauth/start/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/roots/[id]/attachments/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route.js +1 -1
- package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route.js +1 -1
- package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route.js +1 -1
- package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/roots/[id]/dashboard/route.js +1 -1
- package/.next/server/app/api/roots/[id]/dashboard/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/roots/[id]/suggestions/route.js +1 -1
- package/.next/server/app/api/roots/[id]/suggestions/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/utilities/[scope]/[id]/bundle.js/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/utilities/[scope]/[id]/host/route.js +1 -1
- package/.next/server/app/api/utilities/[scope]/[id]/host/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/utilities/[scope]/[id]/host-api.mjs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/utilities/[scope]/[id]/host-ui.mjs/route.js +53 -1
- package/.next/server/app/api/utilities/[scope]/[id]/host-ui.mjs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/utilities/[scope]/[id]/iframe/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/utilities/[scope]/[id]/style.css/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/utilities/install-archive/route.js +1 -0
- package/.next/server/app/api/utilities/install-archive/route.js.nft.json +1 -0
- package/.next/server/app/api/utilities/install-archive/route_client-reference-manifest.js +1 -0
- package/.next/server/app/audit/page.js +2 -2
- package/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/server/app/onboarding/page.js +2 -2
- package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js +2 -2
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roots/[id]/chat/[topicId]/page.js +2 -2
- package/.next/server/app/roots/[id]/chat/[topicId]/page.js.nft.json +1 -1
- package/.next/server/app/roots/[id]/chat/[topicId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roots/[id]/kb/[...slug]/page.js +2 -2
- package/.next/server/app/roots/[id]/kb/[...slug]/page.js.nft.json +1 -1
- package/.next/server/app/roots/[id]/kb/[...slug]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roots/[id]/memory/page.js +1 -1
- package/.next/server/app/roots/[id]/memory/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roots/[id]/page.js +6 -6
- package/.next/server/app/roots/[id]/page.js.nft.json +1 -1
- package/.next/server/app/roots/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roots/[id]/workflows/[wfId]/page.js +2 -2
- package/.next/server/app/roots/[id]/workflows/[wfId]/page.js.nft.json +1 -1
- package/.next/server/app/roots/[id]/workflows/[wfId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roots/[id]/workflows/page.js +2 -2
- package/.next/server/app/roots/[id]/workflows/page.js.nft.json +1 -1
- package/.next/server/app/roots/[id]/workflows/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roots/new/page.js +4 -4
- package/.next/server/app/roots/new/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page.js +5 -5
- package/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/share/[id]/file/page.js +2 -2
- package/.next/server/app/share/[id]/file/page_client-reference-manifest.js +1 -1
- package/.next/server/app/share/[id]/page.js +2 -2
- package/.next/server/app/share/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/utilities/[scope]/[id]/page.js +2 -2
- package/.next/server/app/utilities/[scope]/[id]/page.js.nft.json +1 -1
- package/.next/server/app/utilities/[scope]/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/utilities/page.js +2 -2
- package/.next/server/app/utilities/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +8 -7
- package/.next/server/chunks/1105.js +1 -1
- package/.next/server/chunks/1358.js +1 -1
- package/.next/server/chunks/285.js +9 -6
- package/.next/server/chunks/3091.js +1 -0
- package/.next/server/chunks/3332.js +1 -1
- package/.next/server/chunks/3795.js +3 -0
- package/.next/server/chunks/{2688.js → 4299.js} +2 -2
- package/.next/server/chunks/4812.js +1 -1
- package/.next/server/chunks/4925.js +1 -1
- package/.next/server/chunks/{8425.js → 6648.js} +1 -1
- package/.next/server/chunks/7300.js +56 -4
- package/.next/server/chunks/7358.js +3 -0
- package/.next/server/chunks/9098.js +1 -1
- package/.next/server/chunks/969.js +1 -0
- package/.next/server/chunks/9809.js +1 -1
- package/.next/server/chunks/9861.js +57 -5
- package/.next/server/functions-config-manifest.json +1 -0
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-manifest.json +5 -5
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/1y4wPze4yO8DprxGKwSXQ/_buildManifest.js +1 -0
- package/.next/static/chunks/{5596-93b53c14a2d5c59a.js → 2608-755e5d9ca79c19dc.js} +1 -1
- package/.next/static/chunks/4108.17cd7704e88bcb32.js +1 -0
- package/.next/static/chunks/{9001-6f38a673a3868871.js → 4442-79daa48fe7845771.js} +1 -1
- package/.next/static/chunks/6226-819ec17660994a7d.js +1 -0
- package/.next/static/chunks/7922-9a16eb68adcc7498.js +1 -0
- package/.next/static/chunks/9624-7dc547ab202a1d82.js +1 -0
- package/.next/static/chunks/app/api/agents/[agentId]/respond/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/images/[rootId]/[file]/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/oauth/callback/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/oauth/start/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/roots/[id]/attachments/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/roots/[id]/chat/[topicId]/send/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/roots/[id]/chat/[topicId]/stop/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/roots/[id]/chat/[topicId]/stream/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/roots/[id]/dashboard/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/roots/[id]/suggestions/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/utilities/[scope]/[id]/bundle.js/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/utilities/[scope]/[id]/host/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/utilities/[scope]/[id]/host-api.mjs/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/utilities/[scope]/[id]/host-ui.mjs/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/utilities/[scope]/[id]/iframe/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/utilities/[scope]/[id]/style.css/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/api/utilities/install-archive/route-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/layout-5caae9e60f5d6d42.js +1 -0
- package/.next/static/chunks/app/onboarding/page-3bb8ad02f9c88fdf.js +1 -0
- package/.next/static/chunks/app/{page-0c090eba51732036.js → page-6e32890e646e50aa.js} +1 -1
- package/.next/static/chunks/app/roots/[id]/chat/[topicId]/{page-292bc4cdceb6ea1d.js → page-ac00a7a8d6a16da8.js} +1 -1
- package/.next/static/chunks/app/roots/[id]/kb/[...slug]/{page-5e4f7b893c02c2bd.js → page-14cb4b8a24e40dc7.js} +1 -1
- package/.next/static/chunks/app/roots/[id]/layout-5d0cd3b754198853.js +1 -0
- package/.next/static/chunks/app/roots/[id]/memory/page-7bbe675652b7f9e8.js +1 -0
- package/.next/static/chunks/app/roots/[id]/page-2080ede443a668d2.js +1 -0
- package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-c744450355558209.js +1 -0
- package/.next/static/chunks/app/roots/[id]/workflows/page-8175a0fbbc465472.js +1 -0
- package/.next/static/chunks/app/roots/new/page-3d83b5dfb0a8f869.js +1 -0
- package/.next/static/chunks/app/settings/page-550fab06213d866c.js +1 -0
- package/.next/static/chunks/app/share/[id]/page-c290e46d1beba1ff.js +1 -0
- package/.next/static/chunks/app/utilities/[scope]/[id]/{page-ea8352712b521f75.js → page-5aaa4731a5ab783d.js} +1 -1
- package/.next/static/chunks/app/utilities/page-0e362fd622574297.js +1 -0
- package/.next/static/chunks/{webpack-a4eadc02863be5eb.js → webpack-e60c7ddfa84db519.js} +1 -1
- package/.next/trace +90 -90
- package/.next/types/app/api/utilities/install-archive/route.ts +347 -0
- package/.next/types/routes.d.ts +2 -1
- package/.next/types/validator.ts +9 -0
- package/dist/lib/reflex/prompts/defaults.js +3 -0
- package/dist/lib/reflex/prompts/defaults.js.map +1 -1
- package/package.json +2 -1
- package/.next/server/chunks/2678.js +0 -3
- package/.next/server/chunks/491.js +0 -1
- package/.next/server/chunks/6238.js +0 -1
- package/.next/static/chunks/3717-339a6fc5e3b929f9.js +0 -1
- package/.next/static/chunks/4108.58294dcccaecb2f1.js +0 -1
- package/.next/static/chunks/4179-847dcd61bef8c59f.js +0 -1
- package/.next/static/chunks/4273-0b053f2035ad088d.js +0 -1
- package/.next/static/chunks/app/api/agents/[agentId]/respond/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/api/images/[rootId]/[file]/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/api/oauth/callback/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/api/oauth/start/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/api/roots/[id]/attachments/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/api/roots/[id]/chat/[topicId]/send/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/api/roots/[id]/chat/[topicId]/stop/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/api/roots/[id]/chat/[topicId]/stream/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/api/roots/[id]/dashboard/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/api/roots/[id]/suggestions/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/api/utilities/[scope]/[id]/bundle.js/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/api/utilities/[scope]/[id]/host/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/api/utilities/[scope]/[id]/host-api.mjs/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/api/utilities/[scope]/[id]/host-ui.mjs/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/api/utilities/[scope]/[id]/iframe/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/api/utilities/[scope]/[id]/style.css/route-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/layout-5e042e4e97dcea31.js +0 -1
- package/.next/static/chunks/app/onboarding/page-97aa4ad99276380f.js +0 -1
- package/.next/static/chunks/app/roots/[id]/layout-7e2f82a91b10b7e2.js +0 -1
- package/.next/static/chunks/app/roots/[id]/memory/page-b1fd919707f00c99.js +0 -1
- package/.next/static/chunks/app/roots/[id]/page-da97fb20eef9677c.js +0 -1
- package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-932edf8ce73b23bc.js +0 -1
- package/.next/static/chunks/app/roots/[id]/workflows/page-7339062dee577728.js +0 -1
- package/.next/static/chunks/app/roots/new/page-c96a333c1ef53fba.js +0 -1
- package/.next/static/chunks/app/settings/page-75c61dd145bed57e.js +0 -1
- package/.next/static/chunks/app/share/[id]/page-e4b74cf795d4e211.js +0 -1
- package/.next/static/chunks/app/utilities/page-b5514f6c3291e23f.js +0 -1
- package/.next/static/my3C6nd2vY80TaiBNwet5/_buildManifest.js +0 -1
- /package/.next/static/{my3C6nd2vY80TaiBNwet5 → 1y4wPze4yO8DprxGKwSXQ}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
self.__BUILD_MANIFEST=function(e,r,t,_){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},__routerFilterStatic:{numItems:10,errorRate:1e-4,numBits:192,numHashes:14,bitArray:[1,1,0,e,e,0,e,e,e,e,r,e,e,e,r,r,e,e,e,r,e,r,e,e,r,e,e,e,e,e,e,e,e,r,r,r,e,r,e,e,e,e,e,e,e,e,e,e,r,r,r,r,e,e,r,e,e,e,e,r,e,e,e,e,e,e,r,r,e,e,r,e,r,r,e,r,r,r,e,e,r,e,e,r,e,e,e,e,r,e,r,e,r,e,e,e,r,r,e,r,e,e,r,r,r,e,e,r,e,r,r,r,r,e,r,e,r,e,e,r,e,r,e,e,e,r,e,r,r,r,r,r,r,e,r,e,e,r,r,e,r,r,r,r,r,r,r,e,r,r,r,r,e,r,e,e,e,r,e,e,e,r,e,r,e,e,r,r,e,r,e,e,r,e,r,e,e,e,e,e,e,r,r,r,r,e,r,r,e,r,e,r]},__routerFilterDynamic:{numItems:8,errorRate:1e-4,numBits:154,numHashes:14,bitArray:[e,e,r,r,r,r,r,e,e,r,e,r,e,e,e,r,e,e,e,e,r,r,e,r,r,e,e,e,e,r,e,r,e,e,r,e,e,r,r,e,e,r,r,r,r,r,e,e,r,r,e,e,e,r,r,e,r,e,e,r,r,e,e,r,r,r,e,e,r,r,e,r,e,r,r,e,e,e,r,e,e,r,r,e,r,e,e,e,e,e,r,r,r,r,e,r,e,r,e,r,r,e,e,e,e,e,r,e,e,r,r,e,e,r,e,r,e,r,e,r,e,r,r,e,e,e,e,r,e,r,r,r,r,e,r,e,e,r,e,e,e,r,r,e,r,e,r,r,r,r,r,r,e,r]},"/_error":["static/chunks/pages/_error-da89ab2956f0cf38.js"],sortedPages:["/_app","/_error"]}}(1,0,1e-4,14),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5596],{13506:(e,t,r)=>{r.d(t,{cn:()=>i});var a=r(47989),n=r(55701);function i(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.QP)((0,a.$)(t))}},25235:(e,t,r)=>{r.d(t,{L:()=>$});var a=r(4624),n=r(99356),i=r(49411),l=r(86515),s=r(41234),o=r(71789),c=r(53732),d=r(3606),u=r(31108),m=r(8096),p=r(46972),f=r(16213),g=r(59145),h=r(27474),x=r(39624),v=r(3239),b=r(9721),w=r(84860),k=r(7293),y=r(49623),j=r(64417),N=r(13561),S=r(69285),A=r(56221),C=r(85253),R=r(71651),D=r(13506),F=r(7911);let E=(0,F.createServerReference)("607dff6b32bb7c08fb42ffe5b8fa35976dcd4b3ca4",F.callServer,void 0,F.findSourceMapURL,"searchMentionsAction"),T=[{id:"plan",trigger:"plan",label:"/plan",description:"Show the plan first — Reflex lays out the steps and waits for approval.",kind:"agent-mode",usage:"/plan <task>",icon:"ListChecks"},{id:"goal",trigger:"goal",label:"/goal",description:"Set a goal — Reflex will work toward it on its own, without reminders.",kind:"agent-mode",usage:"/goal <what to achieve>",icon:"Target"},{id:"research",trigger:"research",label:"/research",description:"Deep research on a topic — web search + summary with sources.",kind:"agent-mode",usage:"/research <topic>",icon:"Telescope"},{id:"widget",trigger:"widget",label:"/widget",description:"Create a card on the space dashboard.",kind:"agent-mode",usage:"/widget <what to show>",icon:"LayoutGrid"},{id:"workflow",trigger:"workflow",label:"/workflow",description:"Build a recipe — linear step-based automation for the task.",kind:"agent-mode",usage:"/workflow <what to automate>",icon:"Workflow"},{id:"new-utility",trigger:"new-utility",label:"/new-utility",description:"Build a Reflex mini-app (utility) — TypeScript, runs inside Reflex.",kind:"agent-mode",usage:"/new-utility <name — what it does>",icon:"PackagePlus"},{id:"distill",trigger:"distill",label:"/distill",description:"Pull a URL into the KB — extract key facts, action items, and links to related notes.",kind:"agent-mode",usage:"/distill <url> [focus]",icon:"BookOpenCheck"},{id:"practice",trigger:"practice",label:"/practice",description:"Roleplay a tough conversation — Reflex plays the counterpart and coaches you between turns.",kind:"agent-mode",usage:"/practice <scenario>",icon:"MessagesSquare"},{id:"reflect",trigger:"reflect",label:"/reflect",description:"Daily check-in — three questions adapted to your recent entries, saved as a journal note.",kind:"agent-mode",usage:"/reflect",allowEmpty:!0,icon:"Sunrise"},{id:"remember",trigger:"remember",label:"/remember",description:"Save a note — straight into memory, no AI involved.",kind:"direct",usage:"/remember <what to remember>",icon:"BookmarkPlus"},{id:"mcp",trigger:"mcp",label:"/mcp",description:"Connect an external service (setup wizard opens in chat).",kind:"agent-mode",usage:"/mcp <what you need>",icon:"PackagePlus"},{id:"skill",trigger:"skill",label:"/skill",description:"Attach a role — a ready-made instruction set for this conversation.",kind:"agent-mode",usage:"/skill <role-id> [prompt]",icon:"Sparkles"},{id:"delete-topic",trigger:"delete-topic",label:"/delete-topic",description:"Delete this conversation (with confirmation).",kind:"direct",usage:"/delete-topic",requiresConfirm:!0,allowEmpty:!0,icon:"Trash2"},{id:"clear-project",trigger:"clear-project",label:"/clear-project",description:"DANGER: clear the space — all conversations, cards, memory. Double confirmation.",kind:"direct",usage:"/clear-project",requiresConfirm:!0,allowEmpty:!0,icon:"AlertOctagon"},{id:"util",trigger:"util",label:"/util",description:"Open a mini-app (by partial name or from the list).",kind:"direct",usage:"/util <partial name or id>",allowEmpty:!0,icon:"Boxes"},{id:"help",trigger:"help",label:"/help",description:"List available commands.",kind:"direct",usage:"/help",allowEmpty:!0,icon:"HelpCircle"}],P=(0,F.createServerReference)("4003b1af78a1a11309725dd6d7eadfd46dd277aca4",F.callServer,void 0,F.findSourceMapURL,"listCommandArgsAction"),I=(0,F.createServerReference)("40014ed51e28eb47210060e22b0350fe6d39b05bdf",F.callServer,void 0,F.findSourceMapURL,"listAvailableSlashCommandsAction"),z=(0,F.createServerReference)("60ee37cc363f643954474689298329b9ffb0fe48de",F.callServer,void 0,F.findSourceMapURL,"rememberAction"),L=(0,F.createServerReference)("60005eeda1bc88a8849b83d0371515664cb48b0f0d",F.callServer,void 0,F.findSourceMapURL,"deleteCurrentTopicCommand"),M=(0,F.createServerReference)("608dfcd92b0af8b4207b5d937393088784f031da95",F.callServer,void 0,F.findSourceMapURL,"openUtilityAction"),_=(0,F.createServerReference)("4042298c4ede29cee1023598df6b13f44e40714731",F.callServer,void 0,F.findSourceMapURL,"clearProjectAction");var B=r(63514);let U={ListChecks:l.A,Target:s.A,Telescope:o.A,LayoutGrid:c.A,BookmarkPlus:d.A,PackagePlus:u.A,Sparkles:m.A,Trash2:p.A,AlertOctagon:f.A,HelpCircle:g.A,Workflow:h.A,Boxes:x.A};function $(e){let{rootId:t,topicId:r,placeholder:l,submitLabel:s,pendingLabel:o,SubmitIcon:c,disabled:d,onSubmit:u,active:m,onStop:p,clarifyLabel:f,stopLabel:g}=e,h=(0,i.c)("roots"),x=null!=f?f:h("chatInputForm.clarifyLabel"),k=null!=g?g:h("chatInputForm.stopLabel"),y=(0,S.useRouter)(),[j,N]=(0,n.useState)(""),[F,z]=(0,n.useState)([]),[L,M]=(0,n.useState)(!1),[_,B]=(0,n.useState)(!1),[U,$]=(0,n.useState)(!1),[Z,G]=(0,n.useState)(T);(0,n.useEffect)(()=>{let e=!0;return(async()=>{let r=await I({rootId:t});e&&r.ok&&G(r.commands)})(),()=>{e=!1}},[t]);let Q=(0,n.useRef)(null),V=(0,n.useRef)(null),[J,X]=(0,n.useState)(null),[Y,ee]=(0,n.useState)([]),[et,er]=(0,n.useState)(0),[ea,en]=(0,n.useState)(!1),ei=(0,n.useRef)(0),[el,es]=(0,n.useState)(null),[eo,ec]=(0,n.useState)(null),ed=(0,n.useRef)(0),eu=(0,n.useCallback)(()=>{let e=Q.current;e&&(e.style.height="auto",e.style.height=Math.min(e.scrollHeight,240)+"px")},[]);(0,n.useEffect)(()=>{eu()},[j,eu]);let em=(0,n.useCallback)((e,r)=>{let a=r;for(;a>0;){let t=e[a-1];if("@"===t){a-=1;break}if(/\s/.test(t)){a=-1;break}a-=1}if(a<0||"@"!==e[a]||a>0&&!/\s/.test(e[a-1])){X(null),ee([]);return}let n=e.slice(a+1,r);X({start:a,end:r}),er(0),en(!0);let i=++ei.current;(async()=>{let e=await E(t,n);ei.current===i&&(en(!1),ee(e.ok?e.items:[]))})()},[t]),ep=(0,n.useCallback)(()=>{X(null),ee([]),ei.current++},[]),ef=(0,n.useCallback)((e,r)=>{if(!e.startsWith("/")){es(null),ec(null);return}let a=e.indexOf(" ");if(a<0){ec(null);let t=e.slice(1).toLowerCase(),r=Z.filter(e=>e.trigger.startsWith(t)||e.label.toLowerCase().includes(t)||e.description.toLowerCase().includes(t));es(r.length?{items:r,index:0}:null);return}es(null);let n=e.slice(1,a),i=Z.find(e=>e.trigger===n);if(!i)return void ec(null);let l=a+1,s=r>=l?r:e.length;if(e.slice(s).indexOf(" ")>=0)return void ec(null);let o=e.slice(l,s),c=++ed.current;ec(e=>({cmd:i,items:(null==e?void 0:e.cmd.id)===i.id?e.items:[],index:0,start:l,end:s,loading:!0})),(async()=>{let e=await P({commandId:i.id,query:o,rootId:t});if(ed.current===c){if(!e.ok||!e.supported||0===e.items.length)return ec(null);ec({cmd:i,items:e.items,index:0,start:l,end:s,loading:!1})}})()},[t,Z]),eg=(0,n.useCallback)(()=>{es(null),ec(null)},[]),eh=(0,n.useCallback)(e=>{let t=Q.current;ec(r=>{if(!r)return null;let a=j.slice(0,r.start),n=j.slice(r.end),i="".concat(e.value," ");N(a+i+n);let l=a.length+i.length;return requestAnimationFrame(()=>{t&&(t.focus(),t.setSelectionRange(l,l))}),null})},[j]),ex=(0,n.useCallback)(e=>{let t=Q.current,r="/".concat(e.trigger).concat(e.allowEmpty&&"direct"===e.kind?"":" ");N(r),es(null),requestAnimationFrame(()=>{t&&(t.focus(),t.setSelectionRange(r.length,r.length))})},[]),ev=(0,n.useCallback)(e=>{let t=Q.current;if(!t||!J)return;let r=j.slice(0,J.start),a=j.slice(J.end),n="@".concat(e.relPath," ");N(r+n+a),ep();let i=r.length+n.length;requestAnimationFrame(()=>{t.focus(),t.setSelectionRange(i,i)})},[j,J,ep]),eb=(0,n.useCallback)(async e=>{if(0!==e.length){M(!0);try{let a=new FormData;for(let t of e)a.append("files",t);let n=await fetch("/api/roots/".concat(t,"/attachments"),{method:"POST",body:a});if(!n.ok){var r;let e=await n.json().catch(()=>({}));A.oR.error(null!=(r=e.error)?r:h("chatInputForm.uploadFailed",{status:n.status}));return}let i=await n.json();z(e=>[...e,...i.files])}catch(e){A.oR.error(e instanceof Error?e.message:String(e))}finally{M(!1)}}},[t]),ew=j.trim().length>0||F.length>0,ek=m&&p?ew?"clarify":"stop":"send",ey=(0,n.useCallback)(async()=>{if(_)return;if("stop"===ek){if(!p)return;B(!0);try{await p()}finally{B(!1)}return}let e=j.trim();if(!e&&0===F.length||d&&"send"===ek)return;let a=function(e){var t,r,a;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=e.trim();if(!i.startsWith("/"))return null;let l=/^\/([a-z][a-z0-9-]*)(?:\s+([\s\S]*))?$/.exec(i);if(!l)return null;let s=l[1],o=null!==(t=null!=(a=T.find(e=>e.trigger===s))?a:null)&&void 0!==t?t:n.find(e=>e.trigger===s);return o?{def:o,payload:(null!=(r=l[2])?r:"").trim()}:null}(e);if(a&&"direct"===a.def.kind){B(!0);try{await O({cmd:a.def,payload:a.payload,rootId:t,topicId:r,router:y,t:h}),N("")}finally{B(!1)}return}B(!0);try{"clarify"===ek&&p&&await p(),await u({message:e,attachments:F})&&(N(""),z([]))}finally{B(!1)}},[j,F,_,d,ek,p,u,t,r,y,h]),ej=!_&&!L&&("stop"===ek||ew&&(!d||"clarify"===ek));return(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),ey()},onDragEnter:e=>{Array.from(e.dataTransfer.types).includes("Files")&&(e.preventDefault(),$(!0))},onDragOver:e=>{Array.from(e.dataTransfer.types).includes("Files")&&(e.preventDefault(),$(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||$(!1)},onDrop:e=>{e.preventDefault(),$(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&eb(t)},className:(0,D.cn)("space-y-2 rounded-md transition-colors",U&&"ring-2 ring-ring/60 bg-accent/40"),children:[F.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:F.map((e,t)=>(0,a.jsx)(K,{attachment:e,onRemove:()=>z(t=>t.filter(t=>t!==e))},e.absPath+t))}),(0,a.jsxs)("div",{className:"flex items-end gap-2",children:[(0,a.jsxs)("div",{className:"relative flex-1",children:[(0,a.jsx)(R.T,{ref:Q,value:j,onChange:e=>{N(e.target.value),em(e.target.value,e.target.selectionStart),ef(e.target.value,e.target.selectionStart)},onKeyUp:e=>{let t=e.currentTarget;em(t.value,t.selectionStart),ef(t.value,t.selectionStart)},onClick:e=>{let t=e.currentTarget;em(t.value,t.selectionStart),ef(t.value,t.selectionStart)},onBlur:()=>{setTimeout(()=>{ep(),eg()},150)},onKeyDown:e=>{if(el){if("ArrowDown"===e.key){e.preventDefault(),es(e=>e?{...e,index:Math.min(e.items.length-1,e.index+1)}:null);return}if("ArrowUp"===e.key){e.preventDefault(),es(e=>e?{...e,index:Math.max(0,e.index-1)}:null);return}if("Tab"===e.key){e.preventDefault();let t=el.items[el.index];t&&ex(t);return}if("Escape"===e.key){e.preventDefault(),eg();return}}if(eo&&eo.items.length>0){if("ArrowDown"===e.key){e.preventDefault(),ec(e=>e?{...e,index:Math.min(e.items.length-1,e.index+1)}:null);return}if("ArrowUp"===e.key){e.preventDefault(),ec(e=>e?{...e,index:Math.max(0,e.index-1)}:null);return}if("Tab"===e.key){e.preventDefault();let t=eo.items[eo.index];t&&eh(t);return}if("Escape"===e.key){e.preventDefault(),ec(null);return}}if(J&&Y.length>0){if("ArrowDown"===e.key){e.preventDefault(),er(e=>Math.min(Y.length-1,e+1));return}if("ArrowUp"===e.key){e.preventDefault(),er(e=>Math.max(0,e-1));return}if("Enter"===e.key||"Tab"===e.key){e.preventDefault();let t=Y[et];t&&ev(t);return}if("Escape"===e.key){e.preventDefault(),ep();return}}"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),ey())},onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length>0&&(e.preventDefault(),eb(t))},placeholder:l,rows:1,disabled:d||_,className:"resize-none min-h-[44px] max-h-60 text-base bg-background/70 border-transparent focus-visible:border-ring py-2.5 w-full"}),J&&(0,a.jsx)(H,{items:Y,index:et,loading:ea,onPick:ev,onHover:e=>er(e)}),el&&!J&&(0,a.jsx)(q,{items:el.items,index:el.index,onPick:ex,onHover:e=>es(t=>t?{...t,index:e}:null),topicAvailable:!!r}),eo&&!J&&!el&&(0,a.jsx)(W,{cmd:eo.cmd,items:eo.items,index:eo.index,onPick:eh,onHover:e=>ec(t=>t?{...t,index:e}:null)})]}),(0,a.jsx)("input",{ref:V,type:"file",multiple:!0,className:"hidden",onChange:e=>{var t;let r=Array.from(null!=(t=e.target.files)?t:[]);r.length>0&&eb(r),e.target.value=""}}),(0,a.jsx)(C.$,{type:"button",size:"icon",variant:"ghost",onClick:()=>{var e;return null==(e=V.current)?void 0:e.click()},disabled:L||_||d,title:h("chatInputForm.attachTitle"),className:"h-11 w-11 shrink-0",children:L?(0,a.jsx)(v.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(b.A,{className:"h-4 w-4"})}),(0,a.jsx)(C.$,{type:"submit",size:"lg",disabled:!ej,variant:"stop"===ek?"destructive":"default",className:"h-11 px-6 shadow-md shrink-0",children:_?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.A,{className:"mr-2 h-4 w-4 animate-spin"}),o]}):"stop"===ek?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(w.A,{className:"mr-2 h-4 w-4",fill:"currentColor"}),k]}):"clarify"===ek?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c,{className:"mr-2 h-4 w-4"}),x]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c,{className:"mr-2 h-4 w-4"}),s]})})]}),(0,a.jsx)("div",{className:"text-[10px] text-muted-foreground",children:h("chatInputForm.helperRow")})]})}async function O(e){var t,r,a;let{cmd:n,payload:i,rootId:l,topicId:s,router:o,t:c}=e;if("help"===n.id){let e=T.map(e=>"• ".concat(e.label," — ").concat(e.description));A.oR.info(c("chatInputForm.availableCommands",{list:e.join("\n")}),{duration:12e3});return}if("remember"===n.id){if(!i)return void A.oR.error(c("chatInputForm.rememberEmpty"));let e=await z(l,i);return void(e.ok?(A.oR.success(null!=(t=e.message)?t:c("chatInputForm.savedToKb")),(0,B.$d)(B.Zi.kbChanged(l))):A.oR.error(e.error))}if("delete-topic"===n.id){if(!s)return void A.oR.error(c("chatInputForm.topicOnlyCommand"));if(!confirm(c("chatInputForm.deleteTopicConfirm")))return;let e=await L(l,s);return void(e.ok?(A.oR.success(null!=(r=e.message)?r:c("chatInputForm.deleted")),(0,B.$d)(B.Zi.topicsChanged(l)),e.redirectTo&&o.push(e.redirectTo)):A.oR.error(e.error))}if("util"===n.id){let e=await M(l,i);if(!e.ok)return void A.oR.error(e.error);if("redirect"===e.kind)return void o.push(e.url);let t=e.items.slice(0,8).map(e=>"• ".concat(e.name," (").concat(e.scope,"/").concat(e.id,")")).join("\n");return void A.oR.message(c("chatInputForm.multipleMatches",{list:t}),{duration:12e3})}if("clear-project"===n.id){if(!confirm(c("chatInputForm.clearProjectConfirm")))return;let e=prompt(c("chatInputForm.clearProjectPrompt"));if((null==e?void 0:e.trim().toLowerCase())!==c("chatInputForm.clearProjectPhrase"))return void A.oR.message(c("chatInputForm.confirmFailed"));let t=await _(l);return void(t.ok?(A.oR.success(null!=(a=t.message)?a:c("chatInputForm.projectCleared")),(0,B.$d)(B.Zi.topicsChanged(l)),(0,B.$d)(B.Zi.kbChanged(l)),t.redirectTo&&o.push(t.redirectTo)):A.oR.error(t.error))}A.oR.error(c("chatInputForm.unknownCommand",{label:n.label}))}function q(e){let{items:t,index:r,onPick:n,onHover:l,topicAvailable:s}=e,o=(0,i.c)("roots");return(0,a.jsxs)("div",{className:"absolute bottom-full left-0 right-0 mb-2 z-50 max-h-80 overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-lg",children:[(0,a.jsx)("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wider text-muted-foreground border-b",children:o("chatInputForm.commandsPaletteHeader")}),(0,a.jsx)("ul",{children:t.map((e,t)=>{var i;let c=null!=(i=U[e.icon])?i:m.A,d="delete-topic"===e.id&&!s;return(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),d||n(e)},onMouseEnter:()=>l(t),disabled:d,className:(0,D.cn)("w-full flex items-start gap-2 px-3 py-2 text-left",t===r?"bg-accent":"hover:bg-accent/60",d&&"opacity-40 cursor-not-allowed"),children:[(0,a.jsx)(c,{className:(0,D.cn)("h-3.5 w-3.5 mt-0.5 shrink-0","direct"===e.kind?"text-amber-600":"text-violet-600")}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-baseline gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"font-mono text-xs font-medium",children:e.label}),"direct"===e.kind&&(0,a.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-amber-700",children:o("chatInputForm.directAction")}),e.requiresConfirm&&(0,a.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-destructive",children:o("chatInputForm.withConfirm")})]}),(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground leading-snug mt-0.5",children:e.description}),(0,a.jsx)("p",{className:"text-[10px] text-muted-foreground/80 font-mono mt-0.5",children:e.usage})]})]})},e.id)})})]})}function H(e){let{items:t,index:r,loading:n,onPick:l,onHover:s}=e,o=(0,i.c)("roots");return(0,a.jsx)("div",{className:"absolute bottom-full left-0 right-0 mb-2 z-50 max-h-72 overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-lg",children:n&&0===t.length?(0,a.jsxs)("div",{className:"px-3 py-2 text-xs text-muted-foreground flex items-center gap-2",children:[(0,a.jsx)(v.A,{className:"h-3 w-3 animate-spin"})," ",o("chatInputForm.mentionSearching")]}):0===t.length?(0,a.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground italic",children:o("chatInputForm.mentionNothing")}):(0,a.jsx)("ul",{children:t.map((e,t)=>{let n="kb"===e.kind?k.A:y.A;return(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),l(e)},onMouseEnter:()=>s(t),className:(0,D.cn)("w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left",t===r?"bg-accent":"hover:bg-accent/60"),children:[(0,a.jsx)(n,{className:(0,D.cn)("h-3.5 w-3.5 shrink-0","kb"===e.kind?"text-primary":"text-muted-foreground")}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"truncate font-mono text-xs",children:e.relPath}),e.parent&&(0,a.jsx)("div",{className:"truncate text-[10px] text-muted-foreground",children:e.parent})]}),(0,a.jsx)("span",{className:(0,D.cn)("text-[10px] uppercase tracking-wider shrink-0","kb"===e.kind?"text-primary":"text-muted-foreground"),children:e.kind})]})},e.absPath)})})})}function K(e){var t;let{attachment:r,onRemove:n}=e,i=r.mime.startsWith("image/")?j.A:y.A;return(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-muted px-2 py-1 text-[11px] max-w-[18rem]",children:[(0,a.jsx)(i,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate",title:r.name,children:r.name}),(0,a.jsx)("span",{className:"text-muted-foreground",children:(t=r.size)<1024?"".concat(t," B"):t<1048576?"".concat((t/1024).toFixed(1)," KB"):"".concat((t/1048576).toFixed(1)," MB")}),(0,a.jsx)("button",{type:"button",onClick:n,className:"ml-0.5 text-muted-foreground hover:text-foreground",children:(0,a.jsx)(N.A,{className:"h-3 w-3"})})]})}function W(e){var t;let{cmd:r,items:n,index:i,onPick:l,onHover:s}=e,o=null!=(t=U[r.icon])?t:m.A;return(0,a.jsxs)("div",{className:"absolute bottom-full left-0 right-0 mb-2 z-50 max-h-80 overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-lg",children:[(0,a.jsxs)("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wider text-muted-foreground border-b flex items-center gap-2",children:[(0,a.jsx)(o,{className:"h-3 w-3"}),(0,a.jsxs)("span",{children:[r.label," \xb7 ",r.usage.replace(/^\/\S+\s*/,"")]})]}),(0,a.jsx)("ul",{children:n.map((e,t)=>(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),l(e)},onMouseEnter:()=>s(t),className:(0,D.cn)("w-full flex items-start gap-2 px-3 py-2 text-left",t===i?"bg-accent":"hover:bg-accent/60"),children:[(0,a.jsx)(m.A,{className:"h-3.5 w-3.5 mt-0.5 shrink-0 text-violet-600"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-baseline gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"font-medium text-sm",children:e.label}),(0,a.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground",children:e.value})]}),e.description&&(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground leading-snug mt-0.5 line-clamp-2",children:e.description})]})]})},e.value))})]})}},63514:(e,t,r)=>{r.d(t,{$d:()=>i,S9:()=>l,Zi:()=>n});var a=r(99356);let n={rootsChanged:"reflex:roots-changed",topicsChanged:e=>"reflex:topics-changed:".concat(e),kbChanged:e=>"reflex:kb-changed:".concat(e)};function i(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function l(e,t){(0,a.useEffect)(()=>{let r=e=>t(e.detail);return window.addEventListener(e,r),()=>window.removeEventListener(e,r)},[e,t])}},63602:(e,t,r)=>{r.d(t,{E:()=>l});var a=r(4624),n=r(49411),i=r(8096);function l(e){let{label:t,headerRight:r,children:l}=e,s=(0,n.c)("roots"),o=null!=t?t:s("commandBarFrame.label");return(0,a.jsx)("div",{className:"border-t bg-background",children:(0,a.jsx)("div",{className:"mx-auto max-w-3xl px-6 py-5",children:(0,a.jsx)("div",{className:"reflex-gradient rounded-2xl p-[2px] shadow-[0_8px_40px_-12px_oklch(0.55_0.2_290/0.45)]",children:(0,a.jsxs)("div",{className:"rounded-[14px] bg-background/85 backdrop-blur-xl px-5 py-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,a.jsx)("span",{className:"reflex-gradient inline-flex h-6 w-6 items-center justify-center rounded-full text-white shadow-sm",children:(0,a.jsx)(i.A,{className:"h-3.5 w-3.5"})}),(0,a.jsx)("span",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:o}),r&&(0,a.jsx)("span",{className:"ml-auto flex items-center gap-1",children:r})]}),l]})})})})}},71651:(e,t,r)=>{r.d(t,{T:()=>i});var a=r(4624);r(99356);var n=r(13506);function i(e){let{className:t,...r}=e;return(0,a.jsx)("textarea",{"data-slot":"textarea",className:(0,n.cn)("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",t),...r})}},85253:(e,t,r)=>{r.d(t,{$:()=>o});var a=r(4624);r(99356);var n=r(60621),i=r(50362),l=r(13506);let s=(0,n.F)("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function o(e){let{className:t,variant:r="default",size:n="default",asChild:o=!1,...c}=e,d=o?i.bL:"button";return(0,a.jsx)(d,{"data-slot":"button","data-variant":r,"data-size":n,className:(0,l.cn)(s({variant:r,size:n,className:t})),...c})}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2608],{13506:(e,t,r)=>{r.d(t,{cn:()=>i});var a=r(47989),n=r(55701);function i(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.QP)((0,a.$)(t))}},18471:(e,t,r)=>{r.d(t,{L:()=>$});var a=r(4624),n=r(99356),i=r(49411),l=r(86515),s=r(41234),o=r(71789),c=r(53732),d=r(3606),u=r(31108),m=r(8096),p=r(46972),f=r(16213),g=r(59145),h=r(27474),x=r(39624),v=r(3239),b=r(9721),w=r(84860),k=r(7293),y=r(49623),j=r(64417),N=r(13561),S=r(69285),A=r(56221),C=r(85253),R=r(71651),D=r(13506),F=r(7911);let E=(0,F.createServerReference)("60c417c893805a43872ba154b694e3894ae00ea047",F.callServer,void 0,F.findSourceMapURL,"searchMentionsAction"),T=[{id:"plan",trigger:"plan",label:"/plan",description:"Show the plan first — Reflex lays out the steps and waits for approval.",kind:"agent-mode",usage:"/plan <task>",icon:"ListChecks"},{id:"goal",trigger:"goal",label:"/goal",description:"Set a goal — Reflex will work toward it on its own, without reminders.",kind:"agent-mode",usage:"/goal <what to achieve>",icon:"Target"},{id:"research",trigger:"research",label:"/research",description:"Deep research on a topic — web search + summary with sources.",kind:"agent-mode",usage:"/research <topic>",icon:"Telescope"},{id:"widget",trigger:"widget",label:"/widget",description:"Create a card on the space dashboard.",kind:"agent-mode",usage:"/widget <what to show>",icon:"LayoutGrid"},{id:"workflow",trigger:"workflow",label:"/workflow",description:"Build a recipe — linear step-based automation for the task.",kind:"agent-mode",usage:"/workflow <what to automate>",icon:"Workflow"},{id:"new-utility",trigger:"new-utility",label:"/new-utility",description:"Build a Reflex mini-app (utility) — TypeScript, runs inside Reflex.",kind:"agent-mode",usage:"/new-utility <name — what it does>",icon:"PackagePlus"},{id:"distill",trigger:"distill",label:"/distill",description:"Pull a URL into the KB — extract key facts, action items, and links to related notes.",kind:"agent-mode",usage:"/distill <url> [focus]",icon:"BookOpenCheck"},{id:"practice",trigger:"practice",label:"/practice",description:"Roleplay a tough conversation — Reflex plays the counterpart and coaches you between turns.",kind:"agent-mode",usage:"/practice <scenario>",icon:"MessagesSquare"},{id:"reflect",trigger:"reflect",label:"/reflect",description:"Daily check-in — three questions adapted to your recent entries, saved as a journal note.",kind:"agent-mode",usage:"/reflect",allowEmpty:!0,icon:"Sunrise"},{id:"remember",trigger:"remember",label:"/remember",description:"Save a note — straight into memory, no AI involved.",kind:"direct",usage:"/remember <what to remember>",icon:"BookmarkPlus"},{id:"mcp",trigger:"mcp",label:"/mcp",description:"Connect an external service (setup wizard opens in chat).",kind:"agent-mode",usage:"/mcp <what you need>",icon:"PackagePlus"},{id:"skill",trigger:"skill",label:"/skill",description:"Attach a role — a ready-made instruction set for this conversation.",kind:"agent-mode",usage:"/skill <role-id> [prompt]",icon:"Sparkles"},{id:"delete-topic",trigger:"delete-topic",label:"/delete-topic",description:"Delete this conversation (with confirmation).",kind:"direct",usage:"/delete-topic",requiresConfirm:!0,allowEmpty:!0,icon:"Trash2"},{id:"clear-project",trigger:"clear-project",label:"/clear-project",description:"DANGER: clear the space — all conversations, cards, memory. Double confirmation.",kind:"direct",usage:"/clear-project",requiresConfirm:!0,allowEmpty:!0,icon:"AlertOctagon"},{id:"util",trigger:"util",label:"/util",description:"Open a mini-app (by partial name or from the list).",kind:"direct",usage:"/util <partial name or id>",allowEmpty:!0,icon:"Boxes"},{id:"help",trigger:"help",label:"/help",description:"List available commands.",kind:"direct",usage:"/help",allowEmpty:!0,icon:"HelpCircle"}],P=(0,F.createServerReference)("40919f134d43c8b7c5655a4ab89323db9861390d9c",F.callServer,void 0,F.findSourceMapURL,"listCommandArgsAction"),I=(0,F.createServerReference)("40e232f18c49b7d68f19914aae4e6aca4e775a8c4a",F.callServer,void 0,F.findSourceMapURL,"listAvailableSlashCommandsAction"),z=(0,F.createServerReference)("60b9cf424b7c070b15a1f3d52d8331fe64698b3db3",F.callServer,void 0,F.findSourceMapURL,"rememberAction"),L=(0,F.createServerReference)("600baff5b896710d998210fb8e6961d397a9d9b30d",F.callServer,void 0,F.findSourceMapURL,"deleteCurrentTopicCommand"),M=(0,F.createServerReference)("605636f6c818a0feed4bf69fa9401c3cb8611319da",F.callServer,void 0,F.findSourceMapURL,"openUtilityAction"),_=(0,F.createServerReference)("4012b10c5906f6eda4ff8d517c71ff2b9408dd0b70",F.callServer,void 0,F.findSourceMapURL,"clearProjectAction");var B=r(63514);let U={ListChecks:l.A,Target:s.A,Telescope:o.A,LayoutGrid:c.A,BookmarkPlus:d.A,PackagePlus:u.A,Sparkles:m.A,Trash2:p.A,AlertOctagon:f.A,HelpCircle:g.A,Workflow:h.A,Boxes:x.A};function $(e){let{rootId:t,topicId:r,placeholder:l,submitLabel:s,pendingLabel:o,SubmitIcon:c,disabled:d,onSubmit:u,active:m,onStop:p,clarifyLabel:f,stopLabel:g}=e,h=(0,i.c)("roots"),x=null!=f?f:h("chatInputForm.clarifyLabel"),k=null!=g?g:h("chatInputForm.stopLabel"),y=(0,S.useRouter)(),[j,N]=(0,n.useState)(""),[F,z]=(0,n.useState)([]),[L,M]=(0,n.useState)(!1),[_,B]=(0,n.useState)(!1),[U,$]=(0,n.useState)(!1),[Z,G]=(0,n.useState)(T);(0,n.useEffect)(()=>{let e=!0;return(async()=>{let r=await I({rootId:t});e&&r.ok&&G(r.commands)})(),()=>{e=!1}},[t]);let Q=(0,n.useRef)(null),V=(0,n.useRef)(null),[J,X]=(0,n.useState)(null),[Y,ee]=(0,n.useState)([]),[et,er]=(0,n.useState)(0),[ea,en]=(0,n.useState)(!1),ei=(0,n.useRef)(0),[el,es]=(0,n.useState)(null),[eo,ec]=(0,n.useState)(null),ed=(0,n.useRef)(0),eu=(0,n.useCallback)(()=>{let e=Q.current;e&&(e.style.height="auto",e.style.height=Math.min(e.scrollHeight,240)+"px")},[]);(0,n.useEffect)(()=>{eu()},[j,eu]);let em=(0,n.useCallback)((e,r)=>{let a=r;for(;a>0;){let t=e[a-1];if("@"===t){a-=1;break}if(/\s/.test(t)){a=-1;break}a-=1}if(a<0||"@"!==e[a]||a>0&&!/\s/.test(e[a-1])){X(null),ee([]);return}let n=e.slice(a+1,r);X({start:a,end:r}),er(0),en(!0);let i=++ei.current;(async()=>{let e=await E(t,n);ei.current===i&&(en(!1),ee(e.ok?e.items:[]))})()},[t]),ep=(0,n.useCallback)(()=>{X(null),ee([]),ei.current++},[]),ef=(0,n.useCallback)((e,r)=>{if(!e.startsWith("/")){es(null),ec(null);return}let a=e.indexOf(" ");if(a<0){ec(null);let t=e.slice(1).toLowerCase(),r=Z.filter(e=>e.trigger.startsWith(t)||e.label.toLowerCase().includes(t)||e.description.toLowerCase().includes(t));es(r.length?{items:r,index:0}:null);return}es(null);let n=e.slice(1,a),i=Z.find(e=>e.trigger===n);if(!i)return void ec(null);let l=a+1,s=r>=l?r:e.length;if(e.slice(s).indexOf(" ")>=0)return void ec(null);let o=e.slice(l,s),c=++ed.current;ec(e=>({cmd:i,items:(null==e?void 0:e.cmd.id)===i.id?e.items:[],index:0,start:l,end:s,loading:!0})),(async()=>{let e=await P({commandId:i.id,query:o,rootId:t});if(ed.current===c){if(!e.ok||!e.supported||0===e.items.length)return ec(null);ec({cmd:i,items:e.items,index:0,start:l,end:s,loading:!1})}})()},[t,Z]),eg=(0,n.useCallback)(()=>{es(null),ec(null)},[]),eh=(0,n.useCallback)(e=>{let t=Q.current;ec(r=>{if(!r)return null;let a=j.slice(0,r.start),n=j.slice(r.end),i="".concat(e.value," ");N(a+i+n);let l=a.length+i.length;return requestAnimationFrame(()=>{t&&(t.focus(),t.setSelectionRange(l,l))}),null})},[j]),ex=(0,n.useCallback)(e=>{let t=Q.current,r="/".concat(e.trigger).concat(e.allowEmpty&&"direct"===e.kind?"":" ");N(r),es(null),requestAnimationFrame(()=>{t&&(t.focus(),t.setSelectionRange(r.length,r.length))})},[]),ev=(0,n.useCallback)(e=>{let t=Q.current;if(!t||!J)return;let r=j.slice(0,J.start),a=j.slice(J.end),n="@".concat(e.relPath," ");N(r+n+a),ep();let i=r.length+n.length;requestAnimationFrame(()=>{t.focus(),t.setSelectionRange(i,i)})},[j,J,ep]),eb=(0,n.useCallback)(async e=>{if(0!==e.length){M(!0);try{let a=new FormData;for(let t of e)a.append("files",t);let n=await fetch("/api/roots/".concat(t,"/attachments"),{method:"POST",body:a});if(!n.ok){var r;let e=await n.json().catch(()=>({}));A.oR.error(null!=(r=e.error)?r:h("chatInputForm.uploadFailed",{status:n.status}));return}let i=await n.json();z(e=>[...e,...i.files])}catch(e){A.oR.error(e instanceof Error?e.message:String(e))}finally{M(!1)}}},[t]),ew=j.trim().length>0||F.length>0,ek=m&&p?ew?"clarify":"stop":"send",ey=(0,n.useCallback)(async()=>{if(_)return;if("stop"===ek){if(!p)return;B(!0);try{await p()}finally{B(!1)}return}let e=j.trim();if(!e&&0===F.length||d&&"send"===ek)return;let a=function(e){var t,r,a;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=e.trim();if(!i.startsWith("/"))return null;let l=/^\/([a-z][a-z0-9-]*)(?:\s+([\s\S]*))?$/.exec(i);if(!l)return null;let s=l[1],o=null!==(t=null!=(a=T.find(e=>e.trigger===s))?a:null)&&void 0!==t?t:n.find(e=>e.trigger===s);return o?{def:o,payload:(null!=(r=l[2])?r:"").trim()}:null}(e);if(a&&"direct"===a.def.kind){B(!0);try{await O({cmd:a.def,payload:a.payload,rootId:t,topicId:r,router:y,t:h}),N("")}finally{B(!1)}return}B(!0);try{"clarify"===ek&&p&&await p(),await u({message:e,attachments:F})&&(N(""),z([]))}finally{B(!1)}},[j,F,_,d,ek,p,u,t,r,y,h]),ej=!_&&!L&&("stop"===ek||ew&&(!d||"clarify"===ek));return(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),ey()},onDragEnter:e=>{Array.from(e.dataTransfer.types).includes("Files")&&(e.preventDefault(),$(!0))},onDragOver:e=>{Array.from(e.dataTransfer.types).includes("Files")&&(e.preventDefault(),$(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||$(!1)},onDrop:e=>{e.preventDefault(),$(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&eb(t)},className:(0,D.cn)("space-y-2 rounded-md transition-colors",U&&"ring-2 ring-ring/60 bg-accent/40"),children:[F.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:F.map((e,t)=>(0,a.jsx)(K,{attachment:e,onRemove:()=>z(t=>t.filter(t=>t!==e))},e.absPath+t))}),(0,a.jsxs)("div",{className:"flex items-end gap-2",children:[(0,a.jsxs)("div",{className:"relative flex-1",children:[(0,a.jsx)(R.T,{ref:Q,value:j,onChange:e=>{N(e.target.value),em(e.target.value,e.target.selectionStart),ef(e.target.value,e.target.selectionStart)},onKeyUp:e=>{let t=e.currentTarget;em(t.value,t.selectionStart),ef(t.value,t.selectionStart)},onClick:e=>{let t=e.currentTarget;em(t.value,t.selectionStart),ef(t.value,t.selectionStart)},onBlur:()=>{setTimeout(()=>{ep(),eg()},150)},onKeyDown:e=>{if(el){if("ArrowDown"===e.key){e.preventDefault(),es(e=>e?{...e,index:Math.min(e.items.length-1,e.index+1)}:null);return}if("ArrowUp"===e.key){e.preventDefault(),es(e=>e?{...e,index:Math.max(0,e.index-1)}:null);return}if("Tab"===e.key){e.preventDefault();let t=el.items[el.index];t&&ex(t);return}if("Escape"===e.key){e.preventDefault(),eg();return}}if(eo&&eo.items.length>0){if("ArrowDown"===e.key){e.preventDefault(),ec(e=>e?{...e,index:Math.min(e.items.length-1,e.index+1)}:null);return}if("ArrowUp"===e.key){e.preventDefault(),ec(e=>e?{...e,index:Math.max(0,e.index-1)}:null);return}if("Tab"===e.key){e.preventDefault();let t=eo.items[eo.index];t&&eh(t);return}if("Escape"===e.key){e.preventDefault(),ec(null);return}}if(J&&Y.length>0){if("ArrowDown"===e.key){e.preventDefault(),er(e=>Math.min(Y.length-1,e+1));return}if("ArrowUp"===e.key){e.preventDefault(),er(e=>Math.max(0,e-1));return}if("Enter"===e.key||"Tab"===e.key){e.preventDefault();let t=Y[et];t&&ev(t);return}if("Escape"===e.key){e.preventDefault(),ep();return}}"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),ey())},onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length>0&&(e.preventDefault(),eb(t))},placeholder:l,rows:1,disabled:d||_,className:"resize-none min-h-[44px] max-h-60 text-base bg-background/70 border-transparent focus-visible:border-ring py-2.5 w-full"}),J&&(0,a.jsx)(H,{items:Y,index:et,loading:ea,onPick:ev,onHover:e=>er(e)}),el&&!J&&(0,a.jsx)(q,{items:el.items,index:el.index,onPick:ex,onHover:e=>es(t=>t?{...t,index:e}:null),topicAvailable:!!r}),eo&&!J&&!el&&(0,a.jsx)(W,{cmd:eo.cmd,items:eo.items,index:eo.index,onPick:eh,onHover:e=>ec(t=>t?{...t,index:e}:null)})]}),(0,a.jsx)("input",{ref:V,type:"file",multiple:!0,className:"hidden",onChange:e=>{var t;let r=Array.from(null!=(t=e.target.files)?t:[]);r.length>0&&eb(r),e.target.value=""}}),(0,a.jsx)(C.$,{type:"button",size:"icon",variant:"ghost",onClick:()=>{var e;return null==(e=V.current)?void 0:e.click()},disabled:L||_||d,title:h("chatInputForm.attachTitle"),className:"h-11 w-11 shrink-0",children:L?(0,a.jsx)(v.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(b.A,{className:"h-4 w-4"})}),(0,a.jsx)(C.$,{type:"submit",size:"lg",disabled:!ej,variant:"stop"===ek?"destructive":"default",className:"h-11 px-6 shadow-md shrink-0",children:_?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.A,{className:"mr-2 h-4 w-4 animate-spin"}),o]}):"stop"===ek?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(w.A,{className:"mr-2 h-4 w-4",fill:"currentColor"}),k]}):"clarify"===ek?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c,{className:"mr-2 h-4 w-4"}),x]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c,{className:"mr-2 h-4 w-4"}),s]})})]}),(0,a.jsx)("div",{className:"text-[10px] text-muted-foreground",children:h("chatInputForm.helperRow")})]})}async function O(e){var t,r,a;let{cmd:n,payload:i,rootId:l,topicId:s,router:o,t:c}=e;if("help"===n.id){let e=T.map(e=>"• ".concat(e.label," — ").concat(e.description));A.oR.info(c("chatInputForm.availableCommands",{list:e.join("\n")}),{duration:12e3});return}if("remember"===n.id){if(!i)return void A.oR.error(c("chatInputForm.rememberEmpty"));let e=await z(l,i);return void(e.ok?(A.oR.success(null!=(t=e.message)?t:c("chatInputForm.savedToKb")),(0,B.$d)(B.Zi.kbChanged(l))):A.oR.error(e.error))}if("delete-topic"===n.id){if(!s)return void A.oR.error(c("chatInputForm.topicOnlyCommand"));if(!confirm(c("chatInputForm.deleteTopicConfirm")))return;let e=await L(l,s);return void(e.ok?(A.oR.success(null!=(r=e.message)?r:c("chatInputForm.deleted")),(0,B.$d)(B.Zi.topicsChanged(l)),e.redirectTo&&o.push(e.redirectTo)):A.oR.error(e.error))}if("util"===n.id){let e=await M(l,i);if(!e.ok)return void A.oR.error(e.error);if("redirect"===e.kind)return void o.push(e.url);let t=e.items.slice(0,8).map(e=>"• ".concat(e.name," (").concat(e.scope,"/").concat(e.id,")")).join("\n");return void A.oR.message(c("chatInputForm.multipleMatches",{list:t}),{duration:12e3})}if("clear-project"===n.id){if(!confirm(c("chatInputForm.clearProjectConfirm")))return;let e=prompt(c("chatInputForm.clearProjectPrompt"));if((null==e?void 0:e.trim().toLowerCase())!==c("chatInputForm.clearProjectPhrase"))return void A.oR.message(c("chatInputForm.confirmFailed"));let t=await _(l);return void(t.ok?(A.oR.success(null!=(a=t.message)?a:c("chatInputForm.projectCleared")),(0,B.$d)(B.Zi.topicsChanged(l)),(0,B.$d)(B.Zi.kbChanged(l)),t.redirectTo&&o.push(t.redirectTo)):A.oR.error(t.error))}A.oR.error(c("chatInputForm.unknownCommand",{label:n.label}))}function q(e){let{items:t,index:r,onPick:n,onHover:l,topicAvailable:s}=e,o=(0,i.c)("roots");return(0,a.jsxs)("div",{className:"absolute bottom-full left-0 right-0 mb-2 z-50 max-h-80 overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-lg",children:[(0,a.jsx)("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wider text-muted-foreground border-b",children:o("chatInputForm.commandsPaletteHeader")}),(0,a.jsx)("ul",{children:t.map((e,t)=>{var i;let c=null!=(i=U[e.icon])?i:m.A,d="delete-topic"===e.id&&!s;return(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),d||n(e)},onMouseEnter:()=>l(t),disabled:d,className:(0,D.cn)("w-full flex items-start gap-2 px-3 py-2 text-left",t===r?"bg-accent":"hover:bg-accent/60",d&&"opacity-40 cursor-not-allowed"),children:[(0,a.jsx)(c,{className:(0,D.cn)("h-3.5 w-3.5 mt-0.5 shrink-0","direct"===e.kind?"text-amber-600":"text-violet-600")}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-baseline gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"font-mono text-xs font-medium",children:e.label}),"direct"===e.kind&&(0,a.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-amber-700",children:o("chatInputForm.directAction")}),e.requiresConfirm&&(0,a.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-destructive",children:o("chatInputForm.withConfirm")})]}),(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground leading-snug mt-0.5",children:e.description}),(0,a.jsx)("p",{className:"text-[10px] text-muted-foreground/80 font-mono mt-0.5",children:e.usage})]})]})},e.id)})})]})}function H(e){let{items:t,index:r,loading:n,onPick:l,onHover:s}=e,o=(0,i.c)("roots");return(0,a.jsx)("div",{className:"absolute bottom-full left-0 right-0 mb-2 z-50 max-h-72 overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-lg",children:n&&0===t.length?(0,a.jsxs)("div",{className:"px-3 py-2 text-xs text-muted-foreground flex items-center gap-2",children:[(0,a.jsx)(v.A,{className:"h-3 w-3 animate-spin"})," ",o("chatInputForm.mentionSearching")]}):0===t.length?(0,a.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground italic",children:o("chatInputForm.mentionNothing")}):(0,a.jsx)("ul",{children:t.map((e,t)=>{let n="kb"===e.kind?k.A:y.A;return(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),l(e)},onMouseEnter:()=>s(t),className:(0,D.cn)("w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left",t===r?"bg-accent":"hover:bg-accent/60"),children:[(0,a.jsx)(n,{className:(0,D.cn)("h-3.5 w-3.5 shrink-0","kb"===e.kind?"text-primary":"text-muted-foreground")}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"truncate font-mono text-xs",children:e.relPath}),e.parent&&(0,a.jsx)("div",{className:"truncate text-[10px] text-muted-foreground",children:e.parent})]}),(0,a.jsx)("span",{className:(0,D.cn)("text-[10px] uppercase tracking-wider shrink-0","kb"===e.kind?"text-primary":"text-muted-foreground"),children:e.kind})]})},e.absPath)})})})}function K(e){var t;let{attachment:r,onRemove:n}=e,i=r.mime.startsWith("image/")?j.A:y.A;return(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-muted px-2 py-1 text-[11px] max-w-[18rem]",children:[(0,a.jsx)(i,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate",title:r.name,children:r.name}),(0,a.jsx)("span",{className:"text-muted-foreground",children:(t=r.size)<1024?"".concat(t," B"):t<1048576?"".concat((t/1024).toFixed(1)," KB"):"".concat((t/1048576).toFixed(1)," MB")}),(0,a.jsx)("button",{type:"button",onClick:n,className:"ml-0.5 text-muted-foreground hover:text-foreground",children:(0,a.jsx)(N.A,{className:"h-3 w-3"})})]})}function W(e){var t;let{cmd:r,items:n,index:i,onPick:l,onHover:s}=e,o=null!=(t=U[r.icon])?t:m.A;return(0,a.jsxs)("div",{className:"absolute bottom-full left-0 right-0 mb-2 z-50 max-h-80 overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-lg",children:[(0,a.jsxs)("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wider text-muted-foreground border-b flex items-center gap-2",children:[(0,a.jsx)(o,{className:"h-3 w-3"}),(0,a.jsxs)("span",{children:[r.label," \xb7 ",r.usage.replace(/^\/\S+\s*/,"")]})]}),(0,a.jsx)("ul",{children:n.map((e,t)=>(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),l(e)},onMouseEnter:()=>s(t),className:(0,D.cn)("w-full flex items-start gap-2 px-3 py-2 text-left",t===i?"bg-accent":"hover:bg-accent/60"),children:[(0,a.jsx)(m.A,{className:"h-3.5 w-3.5 mt-0.5 shrink-0 text-violet-600"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-baseline gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"font-medium text-sm",children:e.label}),(0,a.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground",children:e.value})]}),e.description&&(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground leading-snug mt-0.5 line-clamp-2",children:e.description})]})]})},e.value))})]})}},63514:(e,t,r)=>{r.d(t,{$d:()=>i,S9:()=>l,Zi:()=>n});var a=r(99356);let n={rootsChanged:"reflex:roots-changed",topicsChanged:e=>"reflex:topics-changed:".concat(e),kbChanged:e=>"reflex:kb-changed:".concat(e)};function i(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function l(e,t){(0,a.useEffect)(()=>{let r=e=>t(e.detail);return window.addEventListener(e,r),()=>window.removeEventListener(e,r)},[e,t])}},63602:(e,t,r)=>{r.d(t,{E:()=>l});var a=r(4624),n=r(49411),i=r(8096);function l(e){let{label:t,headerRight:r,children:l}=e,s=(0,n.c)("roots"),o=null!=t?t:s("commandBarFrame.label");return(0,a.jsx)("div",{className:"border-t bg-background",children:(0,a.jsx)("div",{className:"mx-auto max-w-3xl px-6 py-5",children:(0,a.jsx)("div",{className:"reflex-gradient rounded-2xl p-[2px] shadow-[0_8px_40px_-12px_oklch(0.55_0.2_290/0.45)]",children:(0,a.jsxs)("div",{className:"rounded-[14px] bg-background/85 backdrop-blur-xl px-5 py-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,a.jsx)("span",{className:"reflex-gradient inline-flex h-6 w-6 items-center justify-center rounded-full text-white shadow-sm",children:(0,a.jsx)(i.A,{className:"h-3.5 w-3.5"})}),(0,a.jsx)("span",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:o}),r&&(0,a.jsx)("span",{className:"ml-auto flex items-center gap-1",children:r})]}),l]})})})})}},71651:(e,t,r)=>{r.d(t,{T:()=>i});var a=r(4624);r(99356);var n=r(13506);function i(e){let{className:t,...r}=e;return(0,a.jsx)("textarea",{"data-slot":"textarea",className:(0,n.cn)("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",t),...r})}},85253:(e,t,r)=>{r.d(t,{$:()=>o});var a=r(4624);r(99356);var n=r(60621),i=r(50362),l=r(13506);let s=(0,n.F)("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function o(e){let{className:t,variant:r="default",size:n="default",asChild:o=!1,...c}=e,d=o?i.bL:"button";return(0,a.jsx)(d,{"data-slot":"button","data-variant":r,"data-size":n,className:(0,l.cn)(s({variant:r,size:n,className:t})),...c})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4108],{2434:(e,t,a)=>{a.d(t,{J:()=>r});var c=a(7911);let r=(0,c.createServerReference)("40875f5effa14f102708d783ecda73c2715799e17b",c.callServer,void 0,c.findSourceMapURL,"getOAuthClientAction")},22914:(e,t,a)=>{a.d(t,{o:()=>r});var c=a(7911);let r=(0,c.createServerReference)("00cfd11d87898110247aaf8bd50ba239b87c8aaad9",c.callServer,void 0,c.findSourceMapURL,"listOAuthStatusesAction")},64963:(e,t,a)=>{a.d(t,{T:()=>r});var c=a(7911);let r=(0,c.createServerReference)("60345a3ec2d80062f357d0fb2647e18973e9443e0e",c.callServer,void 0,c.findSourceMapURL,"beginOAuthAction")},92091:(e,t,a)=>{a.d(t,{S:()=>r});var c=a(7911);let r=(0,c.createServerReference)("405eb2ef746a086a6b8df68d0f82aaac5b08159c7e",c.callServer,void 0,c.findSourceMapURL,"saveOAuthClientAction")},94108:(e,t,a)=>{a.d(t,{beginOAuthAction:()=>n.T,getOAuthClientAction:()=>i.J,listOAuthStatusesAction:()=>c.o,saveOAuthClientAction:()=>r.S});var c=a(22914),r=a(92091),i=a(2434),n=a(64963)}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9001],{51376:(e,t,r)=>{r.d(t,{t:()=>n});var a=r(7911);let n=(0,a.createServerReference)("607ec426f58c6315a682237697fa9f96f5e15c32d1",a.callServer,void 0,a.findSourceMapURL,"restoreWidgetAction")},68682:(e,t,r)=>{function a(e){return"".concat(e.lat,",").concat(e.lng)}function n(e){return"".concat(e.lng,",").concat(e.lat)}r.d(t,{JY:()=>i,yp:()=>s});let s=[{id:"google",label:"Google Maps",description:"Global, navigation + street view. Works everywhere except where the RF blocks it.",brand:"#4285F4",glyph:"G",urlFor:(e,t)=>"https://www.google.com/maps/dir/?api=1&destination=".concat(e,",").concat(t),routeUrlFor:e=>{if(e.length<2)return"";let t=a(e[0]),r=a(e[e.length-1]),n=e.slice(1,-1).map(a).join("|"),s=n?"&waypoints=".concat(encodeURIComponent(n)):"";return"https://www.google.com/maps/dir/?api=1&origin=".concat(t,"&destination=").concat(r).concat(s)}},{id:"yandex",label:"Yandex Maps",description:"CIS region, best RF detail and real-time traffic.",brand:"#FFCC00",glyph:"Y",urlFor:(e,t)=>"https://yandex.ru/maps/?rtext=~".concat(e,",").concat(t,"&rtt=auto"),routeUrlFor:e=>"https://yandex.ru/maps/?rtext=".concat(e.map(a).join("~"),"&rtt=auto")},{id:"2gis",label:"2GIS",description:"CIS region, precise addresses and POI. Uniquely strong on RF cities.",brand:"#1BA049",glyph:"2",urlFor:(e,t)=>"https://2gis.ru/routeSearch/to/".concat(t,",").concat(e),routeUrlFor:e=>{let t=n(e[0]),r=n(e[e.length-1]),a=e.slice(1,-1).map(e=>"/via/".concat(n(e))).join("");return"https://2gis.ru/routeSearch/rsType/car/from/".concat(t).concat(a,"/to/").concat(r)}},{id:"apple",label:"Apple Maps",description:"Opens in the native app on iOS/macOS, otherwise on the website.",brand:"#1d1d1f",glyph:"A",urlFor:(e,t)=>"https://maps.apple.com/?daddr=".concat(e,",").concat(t),routeUrlFor:e=>{let t=a(e[0]),r=e.slice(1).map(e=>"+to:".concat(a(e))).join("");return"https://maps.apple.com/?saddr=".concat(t,"&daddr=").concat(t).concat(r)}},{id:"osm",label:"OpenStreetMap",description:"Open data, no account required. Basic navigation.",brand:"#7EB73F",glyph:"OSM",urlFor:(e,t)=>"https://www.openstreetmap.org/directions?to=".concat(e,",").concat(t),routeUrlFor:e=>{let t=e.map(a).join(";");return"https://www.openstreetmap.org/directions?route=".concat(encodeURIComponent(t))}},{id:"waze",label:"Waze",description:"Car navigation with crowd-sourced traffic and alerts.",brand:"#33CCFF",glyph:"W",urlFor:(e,t)=>"https://waze.com/ul?ll=".concat(e,",").concat(t,"&navigate=yes"),routeUrlFor:e=>{let t=e[e.length-1];return"https://waze.com/ul?ll=".concat(t.lat,",").concat(t.lng,"&navigate=yes")}},{id:"organic",label:"Organic Maps",description:"Offline maps with open data. Opens in the app.",brand:"#006C35",glyph:"OM",urlFor:(e,t)=>"om://map?ll=".concat(e,",").concat(t),routeUrlFor:e=>{let t=e[0],r=e[e.length-1];return"om://route?sll=".concat(t.lat,",").concat(t.lng,"&saddr=&dll=").concat(r.lat,",").concat(r.lng,"&daddr=&type=vehicle")}}],i=["google","yandex","apple","osm"]},91940:(e,t,r)=>{r.d(t,{v:()=>D});var a=r(4624),n=r(49411),s=r(96325),i=r(99356),l=r(87738),o=r(39783),c=r(43153),d=r(13561),u=r(41695),p=r(46972),m=r(84630),x=r(96447),h=r(54207),g=r(84860),f=r(41379),v=r(3239),b=r(85253),y=r(15523),j=r(64681),N=r(54400),w=r.n(N),k=r(49623),W=r(85785),A=r(43863),C=r(57308),S=r(35285),R=r(9598),F=r(56221),T=r(68682);function L(e){let{service:t,size:r=18,className:n}=e;return(0,a.jsx)("span",{className:"inline-flex items-center justify-center rounded-[5px] font-bold leading-none text-white shrink-0 "+(null!=n?n:""),style:{background:t.brand,width:r,height:r,fontSize:Math.max(8,Math.floor(.55*r)),letterSpacing:t.glyph.length>1?"-0.05em":"0"},"aria-hidden":!0,children:t.glyph})}var E=r(7911);let U=(0,E.createServerReference)("008a0115c5a92a8704984aa2afc6f0cac1a4159e8c",E.callServer,void 0,E.findSourceMapURL,"getEnabledMapServicesAction"),M="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",z="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js";function I(e){let{point:t,services:r,interactive:s,onRemove:i}=e,l=(0,n.c)("roots");return(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[r.slice(0,4).map(e=>(0,a.jsx)("a",{href:e.urlFor(t.lat,t.lng),target:"_blank",rel:"noopener noreferrer",className:"rounded p-0.5 hover:ring-1 hover:ring-offset-1 hover:ring-violet-300",title:l("mapWidget.navigationTitle",{service:e.label}),children:(0,a.jsx)(L,{service:e,size:18})},e.id)),(0,a.jsx)("button",{type:"button",onClick:()=>{navigator.clipboard.writeText("".concat(t.lat,", ").concat(t.lng)).then(()=>F.oR.success(l("mapWidget.coordsCopied"))).catch(()=>F.oR.error(l("mapWidget.clipboardUnavailable")))},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground",title:l("mapWidget.copyCoords"),children:(0,a.jsx)(R.A,{className:"h-3 w-3"})}),s&&(0,a.jsx)("button",{type:"button",onClick:i,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-destructive",title:l("mapWidget.removePoint"),children:(0,a.jsx)(d.A,{className:"h-3 w-3"})})]})}function O(e){let{service:t,stops:r}=e,s=(0,n.c)("roots"),i=t.routeUrlFor(r),l=e=>{e.preventDefault(),e.stopPropagation(),navigator.clipboard.writeText(i).then(()=>F.oR.success(s("mapWidget.linkCopied",{service:t.label}))).catch(()=>F.oR.error(s("mapWidget.clipboardUnavailable")))};return(0,a.jsxs)("a",{href:i,target:"_blank",rel:"noopener noreferrer",onContextMenu:l,className:"inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[11px] hover:bg-accent",title:s("mapWidget.openTitle",{service:t.label}),children:[(0,a.jsx)(L,{service:t,size:16}),(0,a.jsx)("span",{className:"truncate max-w-[80px]",children:t.label}),(0,a.jsx)("button",{type:"button",onClick:l,className:"text-muted-foreground hover:text-foreground",title:s("mapWidget.copyLinkTitle"),children:(0,a.jsx)(R.A,{className:"h-2.5 w-2.5"})})]})}let _=(0,E.createServerReference)("6033be0a16d3b845608376d8c703bbacac07b81939",E.callServer,void 0,E.findSourceMapURL,"invokeCardActionAction");var P=r(8096);let q=(0,E.createServerReference)("60749f271ea23d589ccc774fb906ba80cb270b2e4e",E.callServer,void 0,E.findSourceMapURL,"refreshUtilityCardAction"),B={markdown:function(e){var t;let{data:r}=e;return(0,a.jsx)("div",{className:"text-sm",children:(0,a.jsx)(s.p,{source:null!=(t=r.body)?t:""})})},"news-list":function(e){var t;let{data:r,readonly:s,onPatch:u}=e,p=(0,n.c)("roots"),m=null!=(t=r.items)?t:[],[x,h]=(0,i.useState)(m),[g,f]=(0,i.useTransition)(),v=(0,i.useRef)("");(0,i.useEffect)(()=>{let e=JSON.stringify(m);e!==v.current&&(v.current=e,h(m))},[r]);let b=e=>{h(e),u&&f(async()=>{try{await u({items:e})}catch(e){}})};return 0===x.length?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:p("newsListWidget.empty")}):(0,a.jsx)("ul",{className:"space-y-2",children:x.map((e,t)=>(0,a.jsxs)("li",{className:"group/row relative border-l-2 pl-2.5 py-0.5 transition ".concat(e.read?"border-muted-foreground/30 opacity-60":"border-violet-200"),children:[(0,a.jsxs)("div",{className:"flex items-start gap-1.5",children:[(0,a.jsx)(l.A,{className:"h-3 w-3 mt-1 shrink-0 ".concat(e.read?"text-muted-foreground":"text-violet-600")}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 pr-12",children:[e.url?(0,a.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium hover:underline inline-flex items-center gap-1",children:[e.title,(0,a.jsx)(o.A,{className:"h-3 w-3 opacity-50"})]}):(0,a.jsx)("span",{className:"text-sm font-medium",children:e.title}),e.summary&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:e.summary}),(e.source||e.date)&&(0,a.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-0.5 flex gap-1.5",children:[e.source&&(0,a.jsx)("span",{children:e.source}),e.source&&e.date&&(0,a.jsx)("span",{children:"\xb7"}),e.date&&(0,a.jsx)("span",{className:"font-mono",children:e.date})]})]})]}),!s&&(0,a.jsxs)("div",{className:"absolute top-0 right-0 flex items-center gap-0.5 opacity-0 group-hover/row:opacity-100 transition-opacity",children:[(0,a.jsx)("button",{type:"button",onClick:()=>{!s&&b(x.map((e,r)=>r===t?{...e,read:!e.read}:e))},disabled:g,"aria-label":e.read?p("newsListWidget.markUnreadAria"):p("newsListWidget.markReadAria"),title:e.read?p("newsListWidget.markUnreadTitle"):p("newsListWidget.markReadTitle"),className:"p-1 rounded hover:bg-emerald-100 dark:hover:bg-emerald-950/40 text-muted-foreground hover:text-emerald-600 disabled:opacity-30",children:(0,a.jsx)(c.A,{className:"h-3 w-3"})}),(0,a.jsx)("button",{type:"button",onClick:()=>{!s&&b(x.filter((e,r)=>r!==t))},disabled:g,"aria-label":p("newsListWidget.dismissAria"),title:p("newsListWidget.dismissTitle"),className:"p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive disabled:opacity-30",children:(0,a.jsx)(d.A,{className:"h-3 w-3"})})]})]},t))})},"link-list":function(e){var t;let{data:r,readonly:s,onPatch:l}=e,c=(0,n.c)("roots"),d=null!=(t=r.items)?t:[],[m,x]=(0,i.useState)(d),[h,g]=(0,i.useTransition)(),f=(0,i.useRef)("");return((0,i.useEffect)(()=>{let e=JSON.stringify(d);e!==f.current&&(f.current=e,x(d))},[r]),0===m.length)?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:c("linkListWidget.empty")}):(0,a.jsx)("ul",{className:"space-y-0.5",children:m.map((e,t)=>(0,a.jsxs)("li",{className:"group/row relative",children:[(0,a.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-start gap-1.5 rounded-md px-2 py-1.5 hover:bg-accent/40 transition",children:[(0,a.jsx)(u.A,{className:"h-3 w-3 mt-1 shrink-0 text-sky-600"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"text-sm font-medium hover:underline inline-flex items-center gap-1",children:[e.title,(0,a.jsx)(o.A,{className:"h-3 w-3 opacity-50"})]}),e.hint&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:e.hint}),(0,a.jsx)("div",{className:"text-[10px] text-muted-foreground truncate font-mono mt-0.5",children:e.url})]})]}),!s&&(0,a.jsx)("button",{type:"button",onClick:()=>(e=>{if(!s){var t;x(t=m.filter((t,r)=>r!==e)),l&&g(async()=>{try{await l({items:t})}catch(e){}})}})(t),disabled:h,"aria-label":c("linkListWidget.removeAria"),className:"absolute top-1.5 right-1.5 opacity-0 group-hover/row:opacity-100 transition-opacity p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive disabled:opacity-30",children:(0,a.jsx)(p.A,{className:"h-3 w-3"})})]},t))})},kpi:function(e){var t;let{data:r}=e,s=(0,n.c)("roots"),i=null!=(t=r.items)?t:[];if(0===i.length)return(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:s("kpiWidget.empty")});let l=Math.min(i.length,3);return(0,a.jsx)("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(".concat(l,", minmax(0,1fr))")},children:i.map((e,t)=>(0,a.jsxs)("div",{className:"rounded-md border bg-card px-3 py-2 flex flex-col gap-0.5",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:e.label}),(0,a.jsxs)("div",{className:"flex items-baseline gap-1",children:[(0,a.jsx)("span",{className:"text-lg font-semibold tabular-nums",children:e.value}),"up"===e.delta&&(0,a.jsx)(m.A,{className:"h-3.5 w-3.5 text-emerald-600"}),"down"===e.delta&&(0,a.jsx)(x.A,{className:"h-3.5 w-3.5 text-rose-600"}),"flat"===e.delta&&(0,a.jsx)(h.A,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),e.hint&&(0,a.jsx)("div",{className:"text-[10px] text-muted-foreground leading-snug",children:e.hint})]},t))})},checklist:function(e){var t;let{data:r,readonly:s,onPatch:l}=e,o=(0,n.c)("roots"),d=null!=(t=r.items)?t:[],[u,m]=(0,i.useState)(d),[x,h]=(0,i.useTransition)(),[j,N]=(0,i.useState)(""),w=(0,i.useRef)("");(0,i.useEffect)(()=>{let e=JSON.stringify(d);e!==w.current&&(w.current=e,m(d))},[r]);let k=e=>{m(e),l&&h(async()=>{try{await l({items:e})}catch(e){}})},W=e=>{s||k(u.map((t,r)=>r===e?{...t,done:!t.done}:t))};return 0===u.length&&s?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:o("checklistWidget.empty")}):(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("ul",{className:"space-y-0.5",children:u.map((e,t)=>(0,a.jsxs)("li",{className:"group/row flex items-start gap-2 text-sm py-0.5 rounded hover:bg-accent/30 px-1 -mx-1 ".concat(e.done?"text-muted-foreground":""),children:[(0,a.jsx)("button",{type:"button",onClick:()=>W(t),disabled:s||x,"aria-label":e.done?o("checklistWidget.uncheckAria"):o("checklistWidget.checkAria"),className:"shrink-0 mt-0.5 disabled:opacity-50",children:e.done?(0,a.jsx)(c.A,{className:"h-3.5 w-3.5 text-emerald-600"}):(0,a.jsx)(g.A,{className:"h-3.5 w-3.5 text-muted-foreground/60 hover:text-foreground"})}),(0,a.jsx)("span",{className:"flex-1 min-w-0 break-words ".concat(e.done?"line-through":""),onClick:()=>W(t),style:s?{}:{cursor:"pointer"},children:e.text}),!s&&(0,a.jsx)("button",{type:"button",onClick:()=>{!s&&k(u.filter((e,r)=>r!==t))},disabled:x,"aria-label":o("checklistWidget.removeAria"),className:"opacity-0 group-hover/row:opacity-100 transition-opacity shrink-0 p-0.5 text-muted-foreground hover:text-destructive disabled:opacity-30",children:(0,a.jsx)(p.A,{className:"h-3 w-3"})})]},t))}),!s&&(0,a.jsxs)("form",{className:"flex items-center gap-1 pt-1",onSubmit:e=>{e.preventDefault(),(()=>{if(s)return;let e=j.trim();e&&(k([...u,{text:e,done:!1}]),N(""))})()},children:[(0,a.jsx)(f.A,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,a.jsx)(y.p,{value:j,onChange:e=>N(e.target.value),placeholder:o("checklistWidget.newItemPlaceholder"),className:"h-7 text-xs flex-1 border-0 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 px-1",disabled:x}),j.trim()&&(0,a.jsx)(b.$,{type:"submit",size:"sm",variant:"ghost",className:"h-6 text-[10px] px-1.5",disabled:x,children:x?(0,a.jsx)(v.A,{className:"h-3 w-3 animate-spin"}):o("checklistWidget.add")})]})]})},quote:function(e){let{data:t}=e,r=(0,n.c)("roots");return(null==t?void 0:t.text)?(0,a.jsxs)("figure",{className:"relative pl-6",children:[(0,a.jsx)(j.A,{className:"h-5 w-5 absolute left-0 top-0 text-violet-300"}),(0,a.jsx)("blockquote",{className:"text-sm italic leading-relaxed",children:t.text}),t.attribution&&(0,a.jsxs)("figcaption",{className:"text-xs text-muted-foreground mt-1.5",children:["— ",t.attribution]})]}):(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:r("quoteWidget.empty")})},"kb-pinned":function(e){var t;let{rootId:r,data:s,readonly:l,onPatch:o}=e,c=(0,n.c)("roots"),u=null!=(t=s.items)?t:[],[p,m]=(0,i.useState)(u),[x,h]=(0,i.useTransition)(),g=(0,i.useRef)("");return((0,i.useEffect)(()=>{let e=JSON.stringify(u);e!==g.current&&(g.current=e,m(u))},[s]),0===p.length)?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:c("kbPinnedWidget.empty")}):(0,a.jsx)("ul",{className:"space-y-1",children:p.map((e,t)=>{var n;let s=e.rel.split("/").map(encodeURIComponent).join("/");return(0,a.jsxs)("li",{className:"group/row relative",children:[(0,a.jsxs)(w(),{href:"/roots/".concat(r,"/kb/").concat(s),className:"flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent/40 transition pr-7",children:[(0,a.jsx)(k.A,{className:"h-3 w-3 mt-0.5 shrink-0 text-emerald-700"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-sm font-medium truncate",children:null!=(n=e.title)?n:e.rel}),e.snippet&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed mt-0.5",children:e.snippet}),(0,a.jsx)("div",{className:"text-[10px] text-muted-foreground font-mono mt-0.5 truncate",children:e.rel})]})]}),!l&&(0,a.jsx)("button",{type:"button",onClick:()=>(e=>{if(!l){var t;m(t=p.filter((t,r)=>r!==e)),o&&h(async()=>{try{await o({items:t})}catch(e){}})}})(t),disabled:x,"aria-label":c("kbPinnedWidget.unpinAria"),title:c("kbPinnedWidget.unpinTitle"),className:"absolute top-1.5 right-1.5 opacity-0 group-hover/row:opacity-100 transition-opacity p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive disabled:opacity-30",children:(0,a.jsx)(d.A,{className:"h-3 w-3"})})]},t)})})},progress:function(e){var t;let{data:r,readonly:s,onPatch:l}=e,o=(0,n.c)("roots"),c=null!=(t=r.items)?t:[],[d,u]=(0,i.useState)(c),[p,m]=(0,i.useTransition)(),x=(0,i.useRef)("");(0,i.useEffect)(()=>{let e=JSON.stringify(c);e!==x.current&&(x.current=e,u(c))},[r]);let h=(e,t)=>{if(!s){var r;u(r=d.map((r,a)=>a===e?{...r,current:Math.max(0,r.current+t)}:r)),l&&m(async()=>{try{await l({items:r})}catch(e){}})}};return 0===d.length?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:o("progressWidget.empty")}):(0,a.jsx)("ul",{className:"space-y-2.5",children:d.map((e,t)=>{let r=e.target>0?Math.max(0,Math.min(100,e.current/e.target*100)):0;return(0,a.jsxs)("li",{className:"space-y-1 group/row",children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between gap-2 text-sm",children:[(0,a.jsx)("span",{className:"truncate flex-1 min-w-0",children:e.label}),!s&&(0,a.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover/row:opacity-100 transition-opacity shrink-0",children:[(0,a.jsx)("button",{type:"button",onClick:()=>h(t,-1),disabled:p||e.current<=0,"aria-label":"−1",className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30",children:(0,a.jsx)(W.A,{className:"h-3 w-3"})}),(0,a.jsx)("button",{type:"button",onClick:()=>h(t,1),disabled:p,"aria-label":"+1",className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30",children:(0,a.jsx)(f.A,{className:"h-3 w-3"})})]}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums shrink-0",children:[e.current," / ",e.target,e.unit?" ".concat(e.unit):""]})]}),(0,a.jsx)("div",{className:"h-1.5 rounded-full bg-muted overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-violet-600 transition-all",style:{width:"".concat(r,"%")}})})]},t)})})},image:function(e){var t;let{data:r}=e,s=(0,n.c)("roots");return(null==r?void 0:r.url)?(0,a.jsxs)("figure",{className:"space-y-1",children:[(0,a.jsx)("img",{src:r.url,alt:null!=(t=r.alt)?t:"",className:"rounded-md w-full h-auto border",loading:"lazy"}),r.caption&&(0,a.jsx)("figcaption",{className:"text-xs text-muted-foreground text-center",children:r.caption})]}):(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:s("imageWidget.empty")})},"stat-table":function(e){var t;let{data:r}=e,s=(0,n.c)("roots"),i=null!=(t=r.rows)?t:[];return 0===i.length?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:s("statTableWidget.empty")}):(0,a.jsx)("div",{className:"overflow-x-auto -mx-1",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[r.columns&&r.columns.length>0&&(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{className:"border-b",children:r.columns.map((e,t)=>(0,a.jsx)("th",{className:"text-left text-[10px] uppercase tracking-wider text-muted-foreground font-medium px-1.5 py-1.5",children:e},t))})}),(0,a.jsx)("tbody",{children:i.map((e,t)=>(0,a.jsx)("tr",{className:"border-b border-dashed last:border-b-0 hover:bg-accent/30",children:e.map((e,t)=>(0,a.jsx)("td",{className:"px-1.5 py-1.5 align-top",children:e},t))},t))})]})})},map:function(e){var t,r,s;let{data:l,readonly:o,onPatch:c}=e,u=(0,n.c)("roots"),m=(0,i.useRef)(null),x=(0,i.useRef)(null),[h,g]=(0,i.useState)(!1),[b,y]=(0,i.useState)(T.JY),[j,N]=(0,i.useState)(""),[w,k]=(0,i.useState)(!1),[W,R]=(0,i.useState)([]),[L,E]=(0,i.useState)(!1),[_,P]=(0,i.useState)([]),q=null!=(r=l.points)?r:[],B=null!=(s=null==(t=l.route)?void 0:t.stops)?s:[],D=L?_:B,J=(0,i.useMemo)(()=>D.map(e=>q[e]).filter(e=>!!e).map(e=>({lat:e.lat,lng:e.lng})),[D,q]),G=(0,i.useMemo)(()=>T.yp.filter(e=>b.includes(e.id)),[b]);(0,i.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await U();!e&&t.ok&&y(t.enabled)}catch(e){}})(),()=>{e=!0}},[]),(0,i.useEffect)(()=>{if(window.L)return void g(!0);if(!document.querySelector('link[href="'.concat(M,'"]'))){let e=document.createElement("link");e.rel="stylesheet",e.href=M,document.head.appendChild(e)}let e=document.querySelector('script[src="'.concat(z,'"]'));if(e){e.addEventListener("load",()=>g(!0)),window.L&&g(!0);return}let t=document.createElement("script");t.src=z,t.async=!0,t.onload=()=>g(!0),t.onerror=()=>F.oR.error(u("mapWidget.leafletLoadFailed")),document.head.appendChild(t)},[]),(0,i.useEffect)(()=>{var e,t,r;if(!h||!m.current)return;let a=window.L;if(!a||(x.current&&(x.current.remove(),x.current=null),0===q.length))return;let n=a.map(m.current,{scrollWheelZoom:!1,zoomControl:!0});x.current=n,a.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',maxZoom:19}).addTo(n);let s=q.map((e,t)=>{let r=D.includes(t),s=function(e,t,r){let a=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),n=t.map(t=>{let r=t.urlFor(e.lat,e.lng);return'<a href="'.concat(a(r),'" target="_blank" rel="noopener noreferrer" ')+'title="'.concat(a(t.label),'" ')+'style="display:inline-flex;align-items:center;gap:4px;margin:2px 4px 2px 0;padding:2px 6px;border-radius:5px;border:1px solid #e5e7eb;text-decoration:none;font-size:11px;color:#111;background:#fff;">'+'<span style="display:inline-block;width:14px;height:14px;border-radius:3px;background:'.concat(t.brand,";")+"color:#fff;font-size:9px;font-weight:700;line-height:14px;text-align:center;"+"letter-spacing:".concat(t.glyph.length>1?"-0.05em":"0",'">').concat(a(t.glyph),"</span>")+"<span>".concat(a(t.label),"</span>")+"</a>"}).join("");return['<div style="font-family:inherit;min-width:200px">','<div style="font-weight:600;font-size:13px;margin-bottom:2px">'.concat(a(e.title),"</div>"),e.description?'<div style="font-size:12px;color:#666;margin-bottom:6px">'.concat(a(e.description),"</div>"):"",'<div style="font-family:monospace;font-size:10px;color:#888;margin-bottom:6px">'.concat(e.lat.toFixed(5),", ").concat(e.lng.toFixed(5),"</div>"),t.length>0?'<div style="font-size:10px;color:#888;text-transform:uppercase;letter-spacing:0.5px;margin-bottom:2px">'.concat(a(r.openIn),"</div>").concat(n):"",'<div style="margin-top:6px"><button type="button" data-reflex-copy="'.concat(e.lat,", ").concat(e.lng,'" style="font-size:11px;padding:2px 8px;border:1px solid #ddd;border-radius:4px;background:#fff;cursor:pointer">\uD83D\uDCCB ').concat(a(r.copyCoords),"</button></div>"),"</div>"].filter(Boolean).join("")}(e,G,{openIn:u("mapWidget.openIn"),copyCoords:u("mapWidget.copyCoords")}),i=a.marker([e.lat,e.lng],{opacity:L&&!r?.55:1}).addTo(n);return i.bindPopup(s,{maxWidth:280}),i.on("click",()=>{L&&P(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])}),i});J.length>=2&&a.polyline(J.map(e=>[e.lat,e.lng]),{color:null!=(t=null==(e=l.route)?void 0:e.color)?t:"#7c3aed",weight:4,opacity:.85,dashArray:L?"6,6":void 0}).addTo(n);let i=e=>{let t=e.target.closest("[data-reflex-copy]");if(t){let r=t.getAttribute("data-reflex-copy");r&&navigator.clipboard.writeText(r).then(()=>F.oR.success(u("mapWidget.copied"))).catch(()=>F.oR.error(u("mapWidget.clipboardUnavailable"))),e.preventDefault()}};if(m.current.addEventListener("click",i),l.center&&"number"==typeof l.zoom)n.setView([l.center.lat,l.center.lng],l.zoom);else if(1===q.length)n.setView([q[0].lat,q[0].lng],null!=(r=l.zoom)?r:12);else{let e=a.featureGroup(s);n.fitBounds(e.getBounds().pad(.2))}return()=>{var e;null==(e=m.current)||e.removeEventListener("click",i),n.remove(),x.current=null}},[h,l,b.join("|"),L,_.join(",")]);let Y=!o&&!!c,K=async()=>{let e=j.trim();if(e){k(!0),R([]);try{let t="".concat("https://nominatim.openstreetmap.org/search","?q=").concat(encodeURIComponent(e),"&format=json&limit=6"),r=await fetch(t,{headers:{Accept:"application/json"}});if(!r.ok)throw Error("status ".concat(r.status));let a=await r.json();R(a),0===a.length&&F.oR.message(u("mapWidget.nothingFound"))}catch(e){F.oR.error(u("mapWidget.searchFailed",{error:e instanceof Error?e.message:String(e)}))}finally{k(!1)}}},V=async e=>{var t;if(!Y)return;let r=Number(e.lat),a=Number(e.lon);if(!Number.isFinite(r)||!Number.isFinite(a))return void F.oR.error(u("mapWidget.invalidCoordinates"));let n=(null==(t=e.display_name.split(",")[0])?void 0:t.trim())||e.display_name.slice(0,60),s={...l,points:[...q,{lat:r,lng:a,title:n,description:e.display_name}]};R([]),N(""),await (null==c?void 0:c(s))},Z=async e=>{var t,r;if(!Y)return;let a=q.filter((t,r)=>r!==e),n=l.route;if(null==(r=l.route)||null==(t=r.stops)?void 0:t.length){let t=l.route.stops.filter(t=>t!==e).map(t=>t>e?t-1:t);n=t.length>=2?{...l.route,stops:t}:void 0}let s={...l,points:a,...n?{route:n}:{route:void 0}};await (null==c?void 0:c(s))},$=async()=>{if(!Y)return;let e={...l,route:void 0};await (null==c?void 0:c(e)),E(!1),P([])},H=async()=>{var e;if(!Y)return;if(_.length<2)return void F.oR.error(u("mapWidget.routeNeedsTwo"));let t={...l,route:{...null!=(e=l.route)?e:{},stops:_}};await (null==c?void 0:c(t)),E(!1)};return 0!==q.length||Y?(0,a.jsxs)("div",{className:"space-y-2",children:[Y&&(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsxs)("div",{className:"relative flex-1",children:[(0,a.jsx)(A.A,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground pointer-events-none"}),(0,a.jsx)("input",{type:"search",value:j,onChange:e=>N(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),K())},placeholder:u("mapWidget.searchPlaceholder"),className:"w-full rounded border bg-background pl-7 pr-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-violet-400"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>void K(),disabled:w||!j.trim(),className:"rounded border px-2 py-1 text-xs hover:bg-accent disabled:opacity-50 inline-flex items-center gap-1",children:[w?(0,a.jsx)(v.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(A.A,{className:"h-3 w-3"}),u("mapWidget.search")]}),L?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{type:"button",onClick:()=>void H(),className:"rounded px-2 py-1 text-xs bg-violet-600 text-white hover:bg-violet-700 inline-flex items-center gap-1",title:u("mapWidget.saveRouteTitle"),children:[(0,a.jsx)(C.A,{className:"h-3 w-3"})," ",u("mapWidget.save")]}),(0,a.jsx)("button",{type:"button",onClick:()=>{E(!1),P([])},className:"rounded border px-2 py-1 text-xs hover:bg-accent inline-flex items-center gap-1",title:u("mapWidget.cancelTitle"),children:(0,a.jsx)(d.A,{className:"h-3 w-3"})})]}):(0,a.jsxs)("button",{type:"button",onClick:()=>{P(B),E(!0)},disabled:q.length<2,className:"rounded border px-2 py-1 text-xs hover:bg-accent disabled:opacity-50 inline-flex items-center gap-1",title:u("mapWidget.routeButtonTitle"),children:[(0,a.jsx)(C.A,{className:"h-3 w-3"}),u("mapWidget.route")]})]}),W.length>0&&(0,a.jsx)("ul",{className:"rounded border bg-card divide-y text-xs max-h-44 overflow-y-auto",children:W.map((e,t)=>(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",onClick:()=>void V(e),className:"w-full text-left flex items-start gap-2 px-2 py-1.5 hover:bg-accent",children:[(0,a.jsx)(f.A,{className:"h-3 w-3 mt-0.5 text-emerald-700 shrink-0"}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"block font-medium truncate",children:e.display_name.split(",")[0]}),(0,a.jsx)("span",{className:"block text-[10px] text-muted-foreground truncate",children:e.display_name})]})]})},t))}),L&&(0,a.jsx)("div",{className:"rounded border border-violet-200 bg-violet-50 dark:bg-violet-950/30 dark:border-violet-900/50 px-2 py-1.5 text-[11px] text-violet-900 dark:text-violet-200",children:u.rich("mapWidget.routeModeHint",{count:_.length,strong:e=>(0,a.jsx)("strong",{children:e})})})]}),(0,a.jsx)("div",{ref:m,className:"rounded-md border overflow-hidden bg-muted/30",style:{height:280}}),!L&&J.length>=2&&G.length>0&&(0,a.jsx)("div",{className:"rounded border bg-card px-2 py-1.5",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium",children:[(0,a.jsx)(C.A,{className:"h-3 w-3 text-violet-600"}),u("mapWidget.routeLabel",{count:J.length})]}),G.map(e=>(0,a.jsx)(O,{service:e,stops:J},e.id)),Y&&(0,a.jsxs)("button",{type:"button",onClick:()=>void $(),className:"ml-auto text-[10px] text-muted-foreground hover:text-destructive inline-flex items-center gap-0.5",title:u("mapWidget.deleteRouteTitle"),children:[(0,a.jsx)(p.A,{className:"h-3 w-3"}),u("mapWidget.delete")]})]})}),(0,a.jsx)("ul",{className:"space-y-1",children:q.map((e,t)=>{let r=D.indexOf(t);return(0,a.jsxs)("li",{className:"flex items-start gap-2 rounded-md border bg-card px-2 py-1.5 text-xs "+(L&&r>=0?"ring-1 ring-violet-400 border-violet-300":""),children:[L?(0,a.jsx)("button",{type:"button",onClick:()=>P(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t]),className:"h-5 w-5 mt-0.5 shrink-0 rounded-full border text-[10px] font-mono inline-flex items-center justify-center "+(r>=0?"bg-violet-600 text-white border-violet-600":"bg-card text-muted-foreground"),title:r>=0?u("mapWidget.removeFromRoute"):u("mapWidget.addToRoute"),children:r>=0?r+1:"+"}):(0,a.jsx)(S.A,{className:"h-3 w-3 mt-1 shrink-0 "+(B.includes(t)?"text-violet-600":"text-emerald-700")}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"font-medium truncate",children:e.title}),e.description&&(0,a.jsx)("p",{className:"text-muted-foreground leading-snug mt-0.5 line-clamp-2",children:e.description}),(0,a.jsxs)("div",{className:"text-[10px] text-muted-foreground/80 font-mono mt-0.5",children:[e.lat.toFixed(5),", ",e.lng.toFixed(5)]})]}),(0,a.jsx)(I,{point:e,services:G,interactive:Y,onRemove:()=>void Z(t)})]},t)})})]}):(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:u("mapWidget.noPointsReadonly")})},"action-list":function(e){var t;let{rootId:r,data:n,readonly:s,widgetId:l,utility:o}=e,[c,d]=(0,i.useState)(null!=(t=n.groups)?t:[]),[u,p]=(0,i.useState)(null);(0,i.useEffect)(()=>{var e;d(null!=(e=n.groups)?e:[])},[n.groups]);let m=!s&&!!o&&!!l,x=async(e,t)=>{if(o&&l&&(!t.confirm||confirm(t.confirm))){p(e);try{var a,n;let s=await _(r,{utilityId:o.id,utilityScope:o.scope,widgetId:l,actionName:t.actionName,args:{id:e,...null!=(a=t.args)?a:{}}});if(!s.ok)return void F.oR.error(null!=(n=s.error)?n:"Action failed");if(s.inner&&"action-list"===s.inner.kind){let e=s.inner.data;(null==e?void 0:e.groups)&&d(e.groups)}}catch(e){F.oR.error(e instanceof Error?e.message:String(e))}finally{p(null)}}};return 0===c.length?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Nothing here yet."}):(0,a.jsx)("div",{className:"space-y-3",children:c.map((e,t)=>{var r;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:[e.label,e.items.length>0&&(0,a.jsx)("span",{className:"ml-1 text-muted-foreground/70",children:e.items.length})]}),0===e.items.length?(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground/80 italic",children:null!=(r=e.emptyText)?r:"empty"}):(0,a.jsx)("ul",{className:"space-y-1",children:e.items.map(e=>(0,a.jsxs)("li",{className:"flex items-center gap-2 rounded-md border bg-card px-2 py-1.5",children:[e.badge&&(0,a.jsx)("span",{className:"shrink-0 text-[10px] uppercase tracking-wide rounded bg-muted px-1.5 py-0.5 text-muted-foreground",children:e.badge}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"truncate text-xs font-medium",children:e.title}),e.subtitle&&(0,a.jsx)("div",{className:"truncate text-[10px] text-muted-foreground",children:e.subtitle})]}),e.action&&m&&(0,a.jsx)(b.$,{size:"sm",variant:"secondary",className:"h-7 shrink-0 text-[11px]",disabled:null!==u,onClick:()=>void x(e.id,e.action),children:u===e.id?(0,a.jsx)(v.A,{className:"h-3 w-3 animate-spin"}):e.action.label})]},e.id))})]},t)})})},"utility-card":function(e){let{rootId:t,data:r,widgetId:s,readonly:l}=e,c=(0,n.c)("roots"),[d,u]=(0,i.useState)(r.inner),[p,m]=(0,i.useState)(!1),x=(0,i.useRef)(!1);(0,i.useEffect)(()=>{if(l||!s||x.current)return;x.current=!0;let e=!0;return m(!0),(async()=>{try{let r=await q(t,s);e&&r.ok&&r.inner&&u(r.inner)}finally{e&&m(!1)}})(),()=>{e=!1}},[t,s,l]),(0,i.useEffect)(()=>{u(r.inner)},[r.inner]);let h="project"===r.utilityScope?"/utilities/project/".concat(r.utilityId,"?rootId=").concat(encodeURIComponent(t)):"/utilities/global/".concat(r.utilityId);return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px] uppercase tracking-wider text-muted-foreground",children:[(0,a.jsx)(P.A,{className:"h-3 w-3 text-violet-600"}),(0,a.jsx)("span",{children:c("utilityCardWidget.miniAppLabel")}),(0,a.jsx)("span",{className:"font-mono normal-case tracking-normal text-muted-foreground/80",children:r.utilityId}),p&&(0,a.jsx)(v.A,{className:"h-2.5 w-2.5 animate-spin text-muted-foreground"}),(0,a.jsxs)(w(),{href:h,className:"ml-auto inline-flex items-center gap-0.5 text-[10px] text-violet-700 hover:underline normal-case tracking-normal",title:c("utilityCardWidget.openFullTitle"),children:[c("utilityCardWidget.openLabel"),(0,a.jsx)(o.A,{className:"h-2.5 w-2.5"})]})]}),d.title&&(0,a.jsx)("h4",{className:"text-sm font-medium",children:d.title}),d.description&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground -mt-1",children:d.description}),(0,a.jsx)("div",{children:D(t,d.kind,d.data,{readonly:"action-list"!==d.kind||!!l,...s?{widgetId:s}:{},utility:{id:r.utilityId,scope:r.utilityScope}})})]})}};function D(e,t,r,n){var s;let i=B[t];return i?(0,a.jsx)(i,{rootId:e,data:r,readonly:null!=(s=null==n?void 0:n.readonly)&&s,onPatch:null==n?void 0:n.onPatch,widgetId:null==n?void 0:n.widgetId,utility:null==n?void 0:n.utility}):(0,a.jsx)(J,{kind:t})}function J(e){let{kind:t}=e,r=(0,n.c)("roots");return(0,a.jsx)("p",{className:"text-xs text-destructive",children:r.rich("widgetsCommon.unknownKind",{kind:t,code:e=>(0,a.jsx)("code",{className:"font-mono",children:e})})})}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4442],{62350:(e,t,r)=>{r.d(t,{t:()=>n});var a=r(7911);let n=(0,a.createServerReference)("60afc7a65bf765df503a8fd87ef608147bae8d8171",a.callServer,void 0,a.findSourceMapURL,"restoreWidgetAction")},68682:(e,t,r)=>{function a(e){return"".concat(e.lat,",").concat(e.lng)}function n(e){return"".concat(e.lng,",").concat(e.lat)}r.d(t,{JY:()=>i,yp:()=>s});let s=[{id:"google",label:"Google Maps",description:"Global, navigation + street view. Works everywhere except where the RF blocks it.",brand:"#4285F4",glyph:"G",urlFor:(e,t)=>"https://www.google.com/maps/dir/?api=1&destination=".concat(e,",").concat(t),routeUrlFor:e=>{if(e.length<2)return"";let t=a(e[0]),r=a(e[e.length-1]),n=e.slice(1,-1).map(a).join("|"),s=n?"&waypoints=".concat(encodeURIComponent(n)):"";return"https://www.google.com/maps/dir/?api=1&origin=".concat(t,"&destination=").concat(r).concat(s)}},{id:"yandex",label:"Yandex Maps",description:"CIS region, best RF detail and real-time traffic.",brand:"#FFCC00",glyph:"Y",urlFor:(e,t)=>"https://yandex.ru/maps/?rtext=~".concat(e,",").concat(t,"&rtt=auto"),routeUrlFor:e=>"https://yandex.ru/maps/?rtext=".concat(e.map(a).join("~"),"&rtt=auto")},{id:"2gis",label:"2GIS",description:"CIS region, precise addresses and POI. Uniquely strong on RF cities.",brand:"#1BA049",glyph:"2",urlFor:(e,t)=>"https://2gis.ru/routeSearch/to/".concat(t,",").concat(e),routeUrlFor:e=>{let t=n(e[0]),r=n(e[e.length-1]),a=e.slice(1,-1).map(e=>"/via/".concat(n(e))).join("");return"https://2gis.ru/routeSearch/rsType/car/from/".concat(t).concat(a,"/to/").concat(r)}},{id:"apple",label:"Apple Maps",description:"Opens in the native app on iOS/macOS, otherwise on the website.",brand:"#1d1d1f",glyph:"A",urlFor:(e,t)=>"https://maps.apple.com/?daddr=".concat(e,",").concat(t),routeUrlFor:e=>{let t=a(e[0]),r=e.slice(1).map(e=>"+to:".concat(a(e))).join("");return"https://maps.apple.com/?saddr=".concat(t,"&daddr=").concat(t).concat(r)}},{id:"osm",label:"OpenStreetMap",description:"Open data, no account required. Basic navigation.",brand:"#7EB73F",glyph:"OSM",urlFor:(e,t)=>"https://www.openstreetmap.org/directions?to=".concat(e,",").concat(t),routeUrlFor:e=>{let t=e.map(a).join(";");return"https://www.openstreetmap.org/directions?route=".concat(encodeURIComponent(t))}},{id:"waze",label:"Waze",description:"Car navigation with crowd-sourced traffic and alerts.",brand:"#33CCFF",glyph:"W",urlFor:(e,t)=>"https://waze.com/ul?ll=".concat(e,",").concat(t,"&navigate=yes"),routeUrlFor:e=>{let t=e[e.length-1];return"https://waze.com/ul?ll=".concat(t.lat,",").concat(t.lng,"&navigate=yes")}},{id:"organic",label:"Organic Maps",description:"Offline maps with open data. Opens in the app.",brand:"#006C35",glyph:"OM",urlFor:(e,t)=>"om://map?ll=".concat(e,",").concat(t),routeUrlFor:e=>{let t=e[0],r=e[e.length-1];return"om://route?sll=".concat(t.lat,",").concat(t.lng,"&saddr=&dll=").concat(r.lat,",").concat(r.lng,"&daddr=&type=vehicle")}}],i=["google","yandex","apple","osm"]},97997:(e,t,r)=>{r.d(t,{v:()=>D});var a=r(4624),n=r(49411),s=r(26288),i=r(99356),l=r(87738),o=r(39783),c=r(43153),d=r(13561),u=r(41695),p=r(46972),m=r(84630),x=r(96447),h=r(54207),g=r(84860),f=r(41379),v=r(3239),b=r(85253),y=r(15523),j=r(64681),N=r(54400),w=r.n(N),k=r(49623),W=r(85785),A=r(43863),C=r(57308),S=r(35285),R=r(9598),F=r(56221),T=r(68682);function L(e){let{service:t,size:r=18,className:n}=e;return(0,a.jsx)("span",{className:"inline-flex items-center justify-center rounded-[5px] font-bold leading-none text-white shrink-0 "+(null!=n?n:""),style:{background:t.brand,width:r,height:r,fontSize:Math.max(8,Math.floor(.55*r)),letterSpacing:t.glyph.length>1?"-0.05em":"0"},"aria-hidden":!0,children:t.glyph})}var E=r(7911);let U=(0,E.createServerReference)("008fca9aa60e13ae38f98dc2c9403428988c9ac29d",E.callServer,void 0,E.findSourceMapURL,"getEnabledMapServicesAction"),M="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",z="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js";function I(e){let{point:t,services:r,interactive:s,onRemove:i}=e,l=(0,n.c)("roots");return(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[r.slice(0,4).map(e=>(0,a.jsx)("a",{href:e.urlFor(t.lat,t.lng),target:"_blank",rel:"noopener noreferrer",className:"rounded p-0.5 hover:ring-1 hover:ring-offset-1 hover:ring-violet-300",title:l("mapWidget.navigationTitle",{service:e.label}),children:(0,a.jsx)(L,{service:e,size:18})},e.id)),(0,a.jsx)("button",{type:"button",onClick:()=>{navigator.clipboard.writeText("".concat(t.lat,", ").concat(t.lng)).then(()=>F.oR.success(l("mapWidget.coordsCopied"))).catch(()=>F.oR.error(l("mapWidget.clipboardUnavailable")))},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground",title:l("mapWidget.copyCoords"),children:(0,a.jsx)(R.A,{className:"h-3 w-3"})}),s&&(0,a.jsx)("button",{type:"button",onClick:i,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-destructive",title:l("mapWidget.removePoint"),children:(0,a.jsx)(d.A,{className:"h-3 w-3"})})]})}function O(e){let{service:t,stops:r}=e,s=(0,n.c)("roots"),i=t.routeUrlFor(r),l=e=>{e.preventDefault(),e.stopPropagation(),navigator.clipboard.writeText(i).then(()=>F.oR.success(s("mapWidget.linkCopied",{service:t.label}))).catch(()=>F.oR.error(s("mapWidget.clipboardUnavailable")))};return(0,a.jsxs)("a",{href:i,target:"_blank",rel:"noopener noreferrer",onContextMenu:l,className:"inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[11px] hover:bg-accent",title:s("mapWidget.openTitle",{service:t.label}),children:[(0,a.jsx)(L,{service:t,size:16}),(0,a.jsx)("span",{className:"truncate max-w-[80px]",children:t.label}),(0,a.jsx)("button",{type:"button",onClick:l,className:"text-muted-foreground hover:text-foreground",title:s("mapWidget.copyLinkTitle"),children:(0,a.jsx)(R.A,{className:"h-2.5 w-2.5"})})]})}let _=(0,E.createServerReference)("60dce2246e4f335bf9edd4d6199f18a28e4b4a121b",E.callServer,void 0,E.findSourceMapURL,"invokeCardActionAction");var P=r(8096);let q=(0,E.createServerReference)("606b4219824f62fdf7825f8610a9f81fcdc018e173",E.callServer,void 0,E.findSourceMapURL,"refreshUtilityCardAction"),B={markdown:function(e){var t;let{data:r}=e;return(0,a.jsx)("div",{className:"text-sm",children:(0,a.jsx)(s.p,{source:null!=(t=r.body)?t:""})})},"news-list":function(e){var t;let{data:r,readonly:s,onPatch:u}=e,p=(0,n.c)("roots"),m=null!=(t=r.items)?t:[],[x,h]=(0,i.useState)(m),[g,f]=(0,i.useTransition)(),v=(0,i.useRef)("");(0,i.useEffect)(()=>{let e=JSON.stringify(m);e!==v.current&&(v.current=e,h(m))},[r]);let b=e=>{h(e),u&&f(async()=>{try{await u({items:e})}catch(e){}})};return 0===x.length?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:p("newsListWidget.empty")}):(0,a.jsx)("ul",{className:"space-y-2",children:x.map((e,t)=>(0,a.jsxs)("li",{className:"group/row relative border-l-2 pl-2.5 py-0.5 transition ".concat(e.read?"border-muted-foreground/30 opacity-60":"border-violet-200"),children:[(0,a.jsxs)("div",{className:"flex items-start gap-1.5",children:[(0,a.jsx)(l.A,{className:"h-3 w-3 mt-1 shrink-0 ".concat(e.read?"text-muted-foreground":"text-violet-600")}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 pr-12",children:[e.url?(0,a.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium hover:underline inline-flex items-center gap-1",children:[e.title,(0,a.jsx)(o.A,{className:"h-3 w-3 opacity-50"})]}):(0,a.jsx)("span",{className:"text-sm font-medium",children:e.title}),e.summary&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:e.summary}),(e.source||e.date)&&(0,a.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-0.5 flex gap-1.5",children:[e.source&&(0,a.jsx)("span",{children:e.source}),e.source&&e.date&&(0,a.jsx)("span",{children:"\xb7"}),e.date&&(0,a.jsx)("span",{className:"font-mono",children:e.date})]})]})]}),!s&&(0,a.jsxs)("div",{className:"absolute top-0 right-0 flex items-center gap-0.5 opacity-0 group-hover/row:opacity-100 transition-opacity",children:[(0,a.jsx)("button",{type:"button",onClick:()=>{!s&&b(x.map((e,r)=>r===t?{...e,read:!e.read}:e))},disabled:g,"aria-label":e.read?p("newsListWidget.markUnreadAria"):p("newsListWidget.markReadAria"),title:e.read?p("newsListWidget.markUnreadTitle"):p("newsListWidget.markReadTitle"),className:"p-1 rounded hover:bg-emerald-100 dark:hover:bg-emerald-950/40 text-muted-foreground hover:text-emerald-600 disabled:opacity-30",children:(0,a.jsx)(c.A,{className:"h-3 w-3"})}),(0,a.jsx)("button",{type:"button",onClick:()=>{!s&&b(x.filter((e,r)=>r!==t))},disabled:g,"aria-label":p("newsListWidget.dismissAria"),title:p("newsListWidget.dismissTitle"),className:"p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive disabled:opacity-30",children:(0,a.jsx)(d.A,{className:"h-3 w-3"})})]})]},t))})},"link-list":function(e){var t;let{data:r,readonly:s,onPatch:l}=e,c=(0,n.c)("roots"),d=null!=(t=r.items)?t:[],[m,x]=(0,i.useState)(d),[h,g]=(0,i.useTransition)(),f=(0,i.useRef)("");return((0,i.useEffect)(()=>{let e=JSON.stringify(d);e!==f.current&&(f.current=e,x(d))},[r]),0===m.length)?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:c("linkListWidget.empty")}):(0,a.jsx)("ul",{className:"space-y-0.5",children:m.map((e,t)=>(0,a.jsxs)("li",{className:"group/row relative",children:[(0,a.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-start gap-1.5 rounded-md px-2 py-1.5 hover:bg-accent/40 transition",children:[(0,a.jsx)(u.A,{className:"h-3 w-3 mt-1 shrink-0 text-sky-600"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"text-sm font-medium hover:underline inline-flex items-center gap-1",children:[e.title,(0,a.jsx)(o.A,{className:"h-3 w-3 opacity-50"})]}),e.hint&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:e.hint}),(0,a.jsx)("div",{className:"text-[10px] text-muted-foreground truncate font-mono mt-0.5",children:e.url})]})]}),!s&&(0,a.jsx)("button",{type:"button",onClick:()=>(e=>{if(!s){var t;x(t=m.filter((t,r)=>r!==e)),l&&g(async()=>{try{await l({items:t})}catch(e){}})}})(t),disabled:h,"aria-label":c("linkListWidget.removeAria"),className:"absolute top-1.5 right-1.5 opacity-0 group-hover/row:opacity-100 transition-opacity p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive disabled:opacity-30",children:(0,a.jsx)(p.A,{className:"h-3 w-3"})})]},t))})},kpi:function(e){var t;let{data:r}=e,s=(0,n.c)("roots"),i=null!=(t=r.items)?t:[];if(0===i.length)return(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:s("kpiWidget.empty")});let l=Math.min(i.length,3);return(0,a.jsx)("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(".concat(l,", minmax(0,1fr))")},children:i.map((e,t)=>(0,a.jsxs)("div",{className:"rounded-md border bg-card px-3 py-2 flex flex-col gap-0.5",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:e.label}),(0,a.jsxs)("div",{className:"flex items-baseline gap-1",children:[(0,a.jsx)("span",{className:"text-lg font-semibold tabular-nums",children:e.value}),"up"===e.delta&&(0,a.jsx)(m.A,{className:"h-3.5 w-3.5 text-emerald-600"}),"down"===e.delta&&(0,a.jsx)(x.A,{className:"h-3.5 w-3.5 text-rose-600"}),"flat"===e.delta&&(0,a.jsx)(h.A,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),e.hint&&(0,a.jsx)("div",{className:"text-[10px] text-muted-foreground leading-snug",children:e.hint})]},t))})},checklist:function(e){var t;let{data:r,readonly:s,onPatch:l}=e,o=(0,n.c)("roots"),d=null!=(t=r.items)?t:[],[u,m]=(0,i.useState)(d),[x,h]=(0,i.useTransition)(),[j,N]=(0,i.useState)(""),w=(0,i.useRef)("");(0,i.useEffect)(()=>{let e=JSON.stringify(d);e!==w.current&&(w.current=e,m(d))},[r]);let k=e=>{m(e),l&&h(async()=>{try{await l({items:e})}catch(e){}})},W=e=>{s||k(u.map((t,r)=>r===e?{...t,done:!t.done}:t))};return 0===u.length&&s?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:o("checklistWidget.empty")}):(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("ul",{className:"space-y-0.5",children:u.map((e,t)=>(0,a.jsxs)("li",{className:"group/row flex items-start gap-2 text-sm py-0.5 rounded hover:bg-accent/30 px-1 -mx-1 ".concat(e.done?"text-muted-foreground":""),children:[(0,a.jsx)("button",{type:"button",onClick:()=>W(t),disabled:s||x,"aria-label":e.done?o("checklistWidget.uncheckAria"):o("checklistWidget.checkAria"),className:"shrink-0 mt-0.5 disabled:opacity-50",children:e.done?(0,a.jsx)(c.A,{className:"h-3.5 w-3.5 text-emerald-600"}):(0,a.jsx)(g.A,{className:"h-3.5 w-3.5 text-muted-foreground/60 hover:text-foreground"})}),(0,a.jsx)("span",{className:"flex-1 min-w-0 break-words ".concat(e.done?"line-through":""),onClick:()=>W(t),style:s?{}:{cursor:"pointer"},children:e.text}),!s&&(0,a.jsx)("button",{type:"button",onClick:()=>{!s&&k(u.filter((e,r)=>r!==t))},disabled:x,"aria-label":o("checklistWidget.removeAria"),className:"opacity-0 group-hover/row:opacity-100 transition-opacity shrink-0 p-0.5 text-muted-foreground hover:text-destructive disabled:opacity-30",children:(0,a.jsx)(p.A,{className:"h-3 w-3"})})]},t))}),!s&&(0,a.jsxs)("form",{className:"flex items-center gap-1 pt-1",onSubmit:e=>{e.preventDefault(),(()=>{if(s)return;let e=j.trim();e&&(k([...u,{text:e,done:!1}]),N(""))})()},children:[(0,a.jsx)(f.A,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,a.jsx)(y.p,{value:j,onChange:e=>N(e.target.value),placeholder:o("checklistWidget.newItemPlaceholder"),className:"h-7 text-xs flex-1 border-0 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 px-1",disabled:x}),j.trim()&&(0,a.jsx)(b.$,{type:"submit",size:"sm",variant:"ghost",className:"h-6 text-[10px] px-1.5",disabled:x,children:x?(0,a.jsx)(v.A,{className:"h-3 w-3 animate-spin"}):o("checklistWidget.add")})]})]})},quote:function(e){let{data:t}=e,r=(0,n.c)("roots");return(null==t?void 0:t.text)?(0,a.jsxs)("figure",{className:"relative pl-6",children:[(0,a.jsx)(j.A,{className:"h-5 w-5 absolute left-0 top-0 text-violet-300"}),(0,a.jsx)("blockquote",{className:"text-sm italic leading-relaxed",children:t.text}),t.attribution&&(0,a.jsxs)("figcaption",{className:"text-xs text-muted-foreground mt-1.5",children:["— ",t.attribution]})]}):(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:r("quoteWidget.empty")})},"kb-pinned":function(e){var t;let{rootId:r,data:s,readonly:l,onPatch:o}=e,c=(0,n.c)("roots"),u=null!=(t=s.items)?t:[],[p,m]=(0,i.useState)(u),[x,h]=(0,i.useTransition)(),g=(0,i.useRef)("");return((0,i.useEffect)(()=>{let e=JSON.stringify(u);e!==g.current&&(g.current=e,m(u))},[s]),0===p.length)?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:c("kbPinnedWidget.empty")}):(0,a.jsx)("ul",{className:"space-y-1",children:p.map((e,t)=>{var n;let s=e.rel.split("/").map(encodeURIComponent).join("/");return(0,a.jsxs)("li",{className:"group/row relative",children:[(0,a.jsxs)(w(),{href:"/roots/".concat(r,"/kb/").concat(s),className:"flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent/40 transition pr-7",children:[(0,a.jsx)(k.A,{className:"h-3 w-3 mt-0.5 shrink-0 text-emerald-700"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-sm font-medium truncate",children:null!=(n=e.title)?n:e.rel}),e.snippet&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed mt-0.5",children:e.snippet}),(0,a.jsx)("div",{className:"text-[10px] text-muted-foreground font-mono mt-0.5 truncate",children:e.rel})]})]}),!l&&(0,a.jsx)("button",{type:"button",onClick:()=>(e=>{if(!l){var t;m(t=p.filter((t,r)=>r!==e)),o&&h(async()=>{try{await o({items:t})}catch(e){}})}})(t),disabled:x,"aria-label":c("kbPinnedWidget.unpinAria"),title:c("kbPinnedWidget.unpinTitle"),className:"absolute top-1.5 right-1.5 opacity-0 group-hover/row:opacity-100 transition-opacity p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive disabled:opacity-30",children:(0,a.jsx)(d.A,{className:"h-3 w-3"})})]},t)})})},progress:function(e){var t;let{data:r,readonly:s,onPatch:l}=e,o=(0,n.c)("roots"),c=null!=(t=r.items)?t:[],[d,u]=(0,i.useState)(c),[p,m]=(0,i.useTransition)(),x=(0,i.useRef)("");(0,i.useEffect)(()=>{let e=JSON.stringify(c);e!==x.current&&(x.current=e,u(c))},[r]);let h=(e,t)=>{if(!s){var r;u(r=d.map((r,a)=>a===e?{...r,current:Math.max(0,r.current+t)}:r)),l&&m(async()=>{try{await l({items:r})}catch(e){}})}};return 0===d.length?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:o("progressWidget.empty")}):(0,a.jsx)("ul",{className:"space-y-2.5",children:d.map((e,t)=>{let r=e.target>0?Math.max(0,Math.min(100,e.current/e.target*100)):0;return(0,a.jsxs)("li",{className:"space-y-1 group/row",children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between gap-2 text-sm",children:[(0,a.jsx)("span",{className:"truncate flex-1 min-w-0",children:e.label}),!s&&(0,a.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover/row:opacity-100 transition-opacity shrink-0",children:[(0,a.jsx)("button",{type:"button",onClick:()=>h(t,-1),disabled:p||e.current<=0,"aria-label":"−1",className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30",children:(0,a.jsx)(W.A,{className:"h-3 w-3"})}),(0,a.jsx)("button",{type:"button",onClick:()=>h(t,1),disabled:p,"aria-label":"+1",className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30",children:(0,a.jsx)(f.A,{className:"h-3 w-3"})})]}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums shrink-0",children:[e.current," / ",e.target,e.unit?" ".concat(e.unit):""]})]}),(0,a.jsx)("div",{className:"h-1.5 rounded-full bg-muted overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-violet-600 transition-all",style:{width:"".concat(r,"%")}})})]},t)})})},image:function(e){var t;let{data:r}=e,s=(0,n.c)("roots");return(null==r?void 0:r.url)?(0,a.jsxs)("figure",{className:"space-y-1",children:[(0,a.jsx)("img",{src:r.url,alt:null!=(t=r.alt)?t:"",className:"rounded-md w-full h-auto border",loading:"lazy"}),r.caption&&(0,a.jsx)("figcaption",{className:"text-xs text-muted-foreground text-center",children:r.caption})]}):(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:s("imageWidget.empty")})},"stat-table":function(e){var t;let{data:r}=e,s=(0,n.c)("roots"),i=null!=(t=r.rows)?t:[];return 0===i.length?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:s("statTableWidget.empty")}):(0,a.jsx)("div",{className:"overflow-x-auto -mx-1",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[r.columns&&r.columns.length>0&&(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{className:"border-b",children:r.columns.map((e,t)=>(0,a.jsx)("th",{className:"text-left text-[10px] uppercase tracking-wider text-muted-foreground font-medium px-1.5 py-1.5",children:e},t))})}),(0,a.jsx)("tbody",{children:i.map((e,t)=>(0,a.jsx)("tr",{className:"border-b border-dashed last:border-b-0 hover:bg-accent/30",children:e.map((e,t)=>(0,a.jsx)("td",{className:"px-1.5 py-1.5 align-top",children:e},t))},t))})]})})},map:function(e){var t,r,s;let{data:l,readonly:o,onPatch:c}=e,u=(0,n.c)("roots"),m=(0,i.useRef)(null),x=(0,i.useRef)(null),[h,g]=(0,i.useState)(!1),[b,y]=(0,i.useState)(T.JY),[j,N]=(0,i.useState)(""),[w,k]=(0,i.useState)(!1),[W,R]=(0,i.useState)([]),[L,E]=(0,i.useState)(!1),[_,P]=(0,i.useState)([]),q=null!=(r=l.points)?r:[],B=null!=(s=null==(t=l.route)?void 0:t.stops)?s:[],D=L?_:B,J=(0,i.useMemo)(()=>D.map(e=>q[e]).filter(e=>!!e).map(e=>({lat:e.lat,lng:e.lng})),[D,q]),G=(0,i.useMemo)(()=>T.yp.filter(e=>b.includes(e.id)),[b]);(0,i.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await U();!e&&t.ok&&y(t.enabled)}catch(e){}})(),()=>{e=!0}},[]),(0,i.useEffect)(()=>{if(window.L)return void g(!0);if(!document.querySelector('link[href="'.concat(M,'"]'))){let e=document.createElement("link");e.rel="stylesheet",e.href=M,document.head.appendChild(e)}let e=document.querySelector('script[src="'.concat(z,'"]'));if(e){e.addEventListener("load",()=>g(!0)),window.L&&g(!0);return}let t=document.createElement("script");t.src=z,t.async=!0,t.onload=()=>g(!0),t.onerror=()=>F.oR.error(u("mapWidget.leafletLoadFailed")),document.head.appendChild(t)},[]),(0,i.useEffect)(()=>{var e,t,r;if(!h||!m.current)return;let a=window.L;if(!a||(x.current&&(x.current.remove(),x.current=null),0===q.length))return;let n=a.map(m.current,{scrollWheelZoom:!1,zoomControl:!0});x.current=n,a.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',maxZoom:19}).addTo(n);let s=q.map((e,t)=>{let r=D.includes(t),s=function(e,t,r){let a=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),n=t.map(t=>{let r=t.urlFor(e.lat,e.lng);return'<a href="'.concat(a(r),'" target="_blank" rel="noopener noreferrer" ')+'title="'.concat(a(t.label),'" ')+'style="display:inline-flex;align-items:center;gap:4px;margin:2px 4px 2px 0;padding:2px 6px;border-radius:5px;border:1px solid #e5e7eb;text-decoration:none;font-size:11px;color:#111;background:#fff;">'+'<span style="display:inline-block;width:14px;height:14px;border-radius:3px;background:'.concat(t.brand,";")+"color:#fff;font-size:9px;font-weight:700;line-height:14px;text-align:center;"+"letter-spacing:".concat(t.glyph.length>1?"-0.05em":"0",'">').concat(a(t.glyph),"</span>")+"<span>".concat(a(t.label),"</span>")+"</a>"}).join("");return['<div style="font-family:inherit;min-width:200px">','<div style="font-weight:600;font-size:13px;margin-bottom:2px">'.concat(a(e.title),"</div>"),e.description?'<div style="font-size:12px;color:#666;margin-bottom:6px">'.concat(a(e.description),"</div>"):"",'<div style="font-family:monospace;font-size:10px;color:#888;margin-bottom:6px">'.concat(e.lat.toFixed(5),", ").concat(e.lng.toFixed(5),"</div>"),t.length>0?'<div style="font-size:10px;color:#888;text-transform:uppercase;letter-spacing:0.5px;margin-bottom:2px">'.concat(a(r.openIn),"</div>").concat(n):"",'<div style="margin-top:6px"><button type="button" data-reflex-copy="'.concat(e.lat,", ").concat(e.lng,'" style="font-size:11px;padding:2px 8px;border:1px solid #ddd;border-radius:4px;background:#fff;cursor:pointer">\uD83D\uDCCB ').concat(a(r.copyCoords),"</button></div>"),"</div>"].filter(Boolean).join("")}(e,G,{openIn:u("mapWidget.openIn"),copyCoords:u("mapWidget.copyCoords")}),i=a.marker([e.lat,e.lng],{opacity:L&&!r?.55:1}).addTo(n);return i.bindPopup(s,{maxWidth:280}),i.on("click",()=>{L&&P(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])}),i});J.length>=2&&a.polyline(J.map(e=>[e.lat,e.lng]),{color:null!=(t=null==(e=l.route)?void 0:e.color)?t:"#7c3aed",weight:4,opacity:.85,dashArray:L?"6,6":void 0}).addTo(n);let i=e=>{let t=e.target.closest("[data-reflex-copy]");if(t){let r=t.getAttribute("data-reflex-copy");r&&navigator.clipboard.writeText(r).then(()=>F.oR.success(u("mapWidget.copied"))).catch(()=>F.oR.error(u("mapWidget.clipboardUnavailable"))),e.preventDefault()}};if(m.current.addEventListener("click",i),l.center&&"number"==typeof l.zoom)n.setView([l.center.lat,l.center.lng],l.zoom);else if(1===q.length)n.setView([q[0].lat,q[0].lng],null!=(r=l.zoom)?r:12);else{let e=a.featureGroup(s);n.fitBounds(e.getBounds().pad(.2))}return()=>{var e;null==(e=m.current)||e.removeEventListener("click",i),n.remove(),x.current=null}},[h,l,b.join("|"),L,_.join(",")]);let Y=!o&&!!c,K=async()=>{let e=j.trim();if(e){k(!0),R([]);try{let t="".concat("https://nominatim.openstreetmap.org/search","?q=").concat(encodeURIComponent(e),"&format=json&limit=6"),r=await fetch(t,{headers:{Accept:"application/json"}});if(!r.ok)throw Error("status ".concat(r.status));let a=await r.json();R(a),0===a.length&&F.oR.message(u("mapWidget.nothingFound"))}catch(e){F.oR.error(u("mapWidget.searchFailed",{error:e instanceof Error?e.message:String(e)}))}finally{k(!1)}}},V=async e=>{var t;if(!Y)return;let r=Number(e.lat),a=Number(e.lon);if(!Number.isFinite(r)||!Number.isFinite(a))return void F.oR.error(u("mapWidget.invalidCoordinates"));let n=(null==(t=e.display_name.split(",")[0])?void 0:t.trim())||e.display_name.slice(0,60),s={...l,points:[...q,{lat:r,lng:a,title:n,description:e.display_name}]};R([]),N(""),await (null==c?void 0:c(s))},Z=async e=>{var t,r;if(!Y)return;let a=q.filter((t,r)=>r!==e),n=l.route;if(null==(r=l.route)||null==(t=r.stops)?void 0:t.length){let t=l.route.stops.filter(t=>t!==e).map(t=>t>e?t-1:t);n=t.length>=2?{...l.route,stops:t}:void 0}let s={...l,points:a,...n?{route:n}:{route:void 0}};await (null==c?void 0:c(s))},$=async()=>{if(!Y)return;let e={...l,route:void 0};await (null==c?void 0:c(e)),E(!1),P([])},H=async()=>{var e;if(!Y)return;if(_.length<2)return void F.oR.error(u("mapWidget.routeNeedsTwo"));let t={...l,route:{...null!=(e=l.route)?e:{},stops:_}};await (null==c?void 0:c(t)),E(!1)};return 0!==q.length||Y?(0,a.jsxs)("div",{className:"space-y-2",children:[Y&&(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsxs)("div",{className:"relative flex-1",children:[(0,a.jsx)(A.A,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground pointer-events-none"}),(0,a.jsx)("input",{type:"search",value:j,onChange:e=>N(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),K())},placeholder:u("mapWidget.searchPlaceholder"),className:"w-full rounded border bg-background pl-7 pr-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-violet-400"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>void K(),disabled:w||!j.trim(),className:"rounded border px-2 py-1 text-xs hover:bg-accent disabled:opacity-50 inline-flex items-center gap-1",children:[w?(0,a.jsx)(v.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(A.A,{className:"h-3 w-3"}),u("mapWidget.search")]}),L?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{type:"button",onClick:()=>void H(),className:"rounded px-2 py-1 text-xs bg-violet-600 text-white hover:bg-violet-700 inline-flex items-center gap-1",title:u("mapWidget.saveRouteTitle"),children:[(0,a.jsx)(C.A,{className:"h-3 w-3"})," ",u("mapWidget.save")]}),(0,a.jsx)("button",{type:"button",onClick:()=>{E(!1),P([])},className:"rounded border px-2 py-1 text-xs hover:bg-accent inline-flex items-center gap-1",title:u("mapWidget.cancelTitle"),children:(0,a.jsx)(d.A,{className:"h-3 w-3"})})]}):(0,a.jsxs)("button",{type:"button",onClick:()=>{P(B),E(!0)},disabled:q.length<2,className:"rounded border px-2 py-1 text-xs hover:bg-accent disabled:opacity-50 inline-flex items-center gap-1",title:u("mapWidget.routeButtonTitle"),children:[(0,a.jsx)(C.A,{className:"h-3 w-3"}),u("mapWidget.route")]})]}),W.length>0&&(0,a.jsx)("ul",{className:"rounded border bg-card divide-y text-xs max-h-44 overflow-y-auto",children:W.map((e,t)=>(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",onClick:()=>void V(e),className:"w-full text-left flex items-start gap-2 px-2 py-1.5 hover:bg-accent",children:[(0,a.jsx)(f.A,{className:"h-3 w-3 mt-0.5 text-emerald-700 shrink-0"}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"block font-medium truncate",children:e.display_name.split(",")[0]}),(0,a.jsx)("span",{className:"block text-[10px] text-muted-foreground truncate",children:e.display_name})]})]})},t))}),L&&(0,a.jsx)("div",{className:"rounded border border-violet-200 bg-violet-50 dark:bg-violet-950/30 dark:border-violet-900/50 px-2 py-1.5 text-[11px] text-violet-900 dark:text-violet-200",children:u.rich("mapWidget.routeModeHint",{count:_.length,strong:e=>(0,a.jsx)("strong",{children:e})})})]}),(0,a.jsx)("div",{ref:m,className:"rounded-md border overflow-hidden bg-muted/30",style:{height:280}}),!L&&J.length>=2&&G.length>0&&(0,a.jsx)("div",{className:"rounded border bg-card px-2 py-1.5",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium",children:[(0,a.jsx)(C.A,{className:"h-3 w-3 text-violet-600"}),u("mapWidget.routeLabel",{count:J.length})]}),G.map(e=>(0,a.jsx)(O,{service:e,stops:J},e.id)),Y&&(0,a.jsxs)("button",{type:"button",onClick:()=>void $(),className:"ml-auto text-[10px] text-muted-foreground hover:text-destructive inline-flex items-center gap-0.5",title:u("mapWidget.deleteRouteTitle"),children:[(0,a.jsx)(p.A,{className:"h-3 w-3"}),u("mapWidget.delete")]})]})}),(0,a.jsx)("ul",{className:"space-y-1",children:q.map((e,t)=>{let r=D.indexOf(t);return(0,a.jsxs)("li",{className:"flex items-start gap-2 rounded-md border bg-card px-2 py-1.5 text-xs "+(L&&r>=0?"ring-1 ring-violet-400 border-violet-300":""),children:[L?(0,a.jsx)("button",{type:"button",onClick:()=>P(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t]),className:"h-5 w-5 mt-0.5 shrink-0 rounded-full border text-[10px] font-mono inline-flex items-center justify-center "+(r>=0?"bg-violet-600 text-white border-violet-600":"bg-card text-muted-foreground"),title:r>=0?u("mapWidget.removeFromRoute"):u("mapWidget.addToRoute"),children:r>=0?r+1:"+"}):(0,a.jsx)(S.A,{className:"h-3 w-3 mt-1 shrink-0 "+(B.includes(t)?"text-violet-600":"text-emerald-700")}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"font-medium truncate",children:e.title}),e.description&&(0,a.jsx)("p",{className:"text-muted-foreground leading-snug mt-0.5 line-clamp-2",children:e.description}),(0,a.jsxs)("div",{className:"text-[10px] text-muted-foreground/80 font-mono mt-0.5",children:[e.lat.toFixed(5),", ",e.lng.toFixed(5)]})]}),(0,a.jsx)(I,{point:e,services:G,interactive:Y,onRemove:()=>void Z(t)})]},t)})})]}):(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:u("mapWidget.noPointsReadonly")})},"action-list":function(e){var t;let{rootId:r,data:n,readonly:s,widgetId:l,utility:o}=e,[c,d]=(0,i.useState)(null!=(t=n.groups)?t:[]),[u,p]=(0,i.useState)(null);(0,i.useEffect)(()=>{var e;d(null!=(e=n.groups)?e:[])},[n.groups]);let m=!s&&!!o&&!!l,x=async(e,t)=>{if(o&&l&&(!t.confirm||confirm(t.confirm))){p(e);try{var a,n;let s=await _(r,{utilityId:o.id,utilityScope:o.scope,widgetId:l,actionName:t.actionName,args:{id:e,...null!=(a=t.args)?a:{}}});if(!s.ok)return void F.oR.error(null!=(n=s.error)?n:"Action failed");if(s.inner&&"action-list"===s.inner.kind){let e=s.inner.data;(null==e?void 0:e.groups)&&d(e.groups)}}catch(e){F.oR.error(e instanceof Error?e.message:String(e))}finally{p(null)}}};return 0===c.length?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Nothing here yet."}):(0,a.jsx)("div",{className:"space-y-3",children:c.map((e,t)=>{var r;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:[e.label,e.items.length>0&&(0,a.jsx)("span",{className:"ml-1 text-muted-foreground/70",children:e.items.length})]}),0===e.items.length?(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground/80 italic",children:null!=(r=e.emptyText)?r:"empty"}):(0,a.jsx)("ul",{className:"space-y-1",children:e.items.map(e=>(0,a.jsxs)("li",{className:"flex items-center gap-2 rounded-md border bg-card px-2 py-1.5",children:[e.badge&&(0,a.jsx)("span",{className:"shrink-0 text-[10px] uppercase tracking-wide rounded bg-muted px-1.5 py-0.5 text-muted-foreground",children:e.badge}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"truncate text-xs font-medium",children:e.title}),e.subtitle&&(0,a.jsx)("div",{className:"truncate text-[10px] text-muted-foreground",children:e.subtitle})]}),e.action&&m&&(0,a.jsx)(b.$,{size:"sm",variant:"secondary",className:"h-7 shrink-0 text-[11px]",disabled:null!==u,onClick:()=>void x(e.id,e.action),children:u===e.id?(0,a.jsx)(v.A,{className:"h-3 w-3 animate-spin"}):e.action.label})]},e.id))})]},t)})})},"utility-card":function(e){let{rootId:t,data:r,widgetId:s,readonly:l}=e,c=(0,n.c)("roots"),[d,u]=(0,i.useState)(r.inner),[p,m]=(0,i.useState)(!1),x=(0,i.useRef)(!1);(0,i.useEffect)(()=>{if(l||!s||x.current)return;x.current=!0;let e=!0;return m(!0),(async()=>{try{let r=await q(t,s);e&&r.ok&&r.inner&&u(r.inner)}finally{e&&m(!1)}})(),()=>{e=!1}},[t,s,l]),(0,i.useEffect)(()=>{u(r.inner)},[r.inner]);let h="project"===r.utilityScope?"/utilities/project/".concat(r.utilityId,"?rootId=").concat(encodeURIComponent(t)):"/utilities/global/".concat(r.utilityId);return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px] uppercase tracking-wider text-muted-foreground",children:[(0,a.jsx)(P.A,{className:"h-3 w-3 text-violet-600"}),(0,a.jsx)("span",{children:c("utilityCardWidget.miniAppLabel")}),(0,a.jsx)("span",{className:"font-mono normal-case tracking-normal text-muted-foreground/80",children:r.utilityId}),p&&(0,a.jsx)(v.A,{className:"h-2.5 w-2.5 animate-spin text-muted-foreground"}),(0,a.jsxs)(w(),{href:h,className:"ml-auto inline-flex items-center gap-0.5 text-[10px] text-violet-700 hover:underline normal-case tracking-normal",title:c("utilityCardWidget.openFullTitle"),children:[c("utilityCardWidget.openLabel"),(0,a.jsx)(o.A,{className:"h-2.5 w-2.5"})]})]}),d.title&&(0,a.jsx)("h4",{className:"text-sm font-medium",children:d.title}),d.description&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground -mt-1",children:d.description}),(0,a.jsx)("div",{children:D(t,d.kind,d.data,{readonly:"action-list"!==d.kind||!!l,...s?{widgetId:s}:{},utility:{id:r.utilityId,scope:r.utilityScope}})})]})}};function D(e,t,r,n){var s;let i=B[t];return i?(0,a.jsx)(i,{rootId:e,data:r,readonly:null!=(s=null==n?void 0:n.readonly)&&s,onPatch:null==n?void 0:n.onPatch,widgetId:null==n?void 0:n.widgetId,utility:null==n?void 0:n.utility}):(0,a.jsx)(J,{kind:t})}function J(e){let{kind:t}=e,r=(0,n.c)("roots");return(0,a.jsx)("p",{className:"text-xs text-destructive",children:r.rich("widgetsCommon.unknownKind",{kind:t,code:e=>(0,a.jsx)("code",{className:"font-mono",children:e})})})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6226],{447:(e,r,t)=>{t.d(r,{A:()=>n});var a=t(7911);let n=(0,a.createServerReference)("4075d44f247542613eeee0bc7505c689034714102a",a.callServer,void 0,a.findSourceMapURL,"saveGeminiKeyAction")},15523:(e,r,t)=>{t.d(r,{p:()=>s});var a=t(4624);t(99356);var n=t(13506);function s(e){let{className:r,type:t,...s}=e;return(0,a.jsx)("input",{type:t,"data-slot":"input",className:(0,n.cn)("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",r),...s})}},26288:(e,r,t)=>{t.d(r,{p:()=>j});var a=t(4624),n=t(99356),s=t(49411),o=t(88365),i=t(72461),l=t(43455),c=t(13561),d=t(60532),u=t(3239),m=t(8096),p=t(94151),x=t(65714),b=t(43153),f=t(95265),h=t(56221),g=t(85253),v=t(15523),w=t(7911);let y=(0,w.createServerReference)("409079487f75e4cf3ab9696e1e8d8fc194f0dcd91e",w.callServer,void 0,w.findSourceMapURL,"summarizeYoutubeAction");var k=t(447);function j(e){let{source:r,onSendToChat:t,autoSummarizeYoutube:s}=e,[c,d]=(0,n.useState)(null);return(0,a.jsxs)("div",{className:"prose prose-neutral dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:rounded-md [&_pre]:p-4 [&_pre]:overflow-x-auto [&_pre]:text-sm [&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_pre_code]:text-foreground [&_:not(pre)>code]:bg-muted [&_:not(pre)>code]:px-1.5 [&_:not(pre)>code]:py-0.5 [&_:not(pre)>code]:rounded [&_:not(pre)>code]:text-[0.9em] [&_code]:font-mono [&_table]:text-sm",children:[(0,a.jsx)(o.oz,{remarkPlugins:[i.A],rehypePlugins:[[l.A,{detect:!0,ignoreMissing:!0}]],components:{a:e=>{let{href:r,children:n,...o}=e,i=r?function(e){try{let r=new URL(e),t=r.hostname.replace(/^www\./,"");if("youtu.be"===t){let e=r.pathname.slice(1).split("/")[0];return e&&/^[A-Za-z0-9_-]{6,}$/.test(e)?e:null}if("youtube.com"===t||"m.youtube.com"===t||"youtube-nocookie.com"===t){if("/watch"===r.pathname){let e=r.searchParams.get("v");return e&&/^[A-Za-z0-9_-]{6,}$/.test(e)?e:null}let e=/^\/(shorts|embed|live|v)\/([^/?#]+)/.exec(r.pathname);if(e&&/^[A-Za-z0-9_-]{6,}$/.test(e[2]))return e[2]}}catch(e){}return null}(r):null;return i&&r?(0,a.jsx)(A,{url:r,videoId:i,autoSummarize:null!=s&&s,...t?{onSendToChat:t}:{}}):(0,a.jsx)("a",{href:r,...o,children:n})},img:e=>{let{src:r,alt:t,title:n}=e;return"string"!=typeof r||0===r.length?null:(0,a.jsx)(N,{src:r,alt:"string"==typeof t?t:"",title:"string"==typeof n?n:void 0,onZoom:e=>d(e)})}},children:r}),c&&(0,a.jsx)(_,{src:c.src,alt:c.alt,onClose:()=>d(null)})]})}function N(e){var r;let{src:t,alt:n,title:o,onZoom:i}=e,l=(0,s.c)("roots");return(0,a.jsx)("img",{src:t,alt:n,title:null!=(r=null!=o?o:n)?r:l("markdown.openFullscreen"),onClick:()=>i({src:t,alt:n}),className:"cursor-zoom-in rounded-md border bg-muted/40 transition hover:opacity-90",loading:"lazy"})}function _(e){let{src:r,alt:t,onClose:o}=e,i=(0,s.c)("roots"),l=(0,n.useCallback)(e=>{"Escape"===e.key&&o()},[o]);return(0,n.useEffect)(()=>{document.addEventListener("keydown",l);let e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",l),document.body.style.overflow=e}},[l]),(0,a.jsxs)("div",{className:"fixed inset-0 z-[80] flex items-center justify-center p-6 bg-background/85 backdrop-blur-sm cursor-zoom-out",onClick:o,role:"dialog","aria-label":t||i("markdown.imagePreview"),children:[(0,a.jsx)(g.$,{type:"button",size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-9 w-9 bg-card/80 hover:bg-card",onClick:e=>{e.stopPropagation(),o()},"aria-label":i("markdown.closeAria"),children:(0,a.jsx)(c.A,{className:"h-5 w-5"})}),(0,a.jsx)("img",{src:r,alt:t,className:"max-h-full max-w-full object-contain rounded-lg shadow-2xl",onClick:e=>e.stopPropagation()}),t&&(0,a.jsx)("div",{className:"absolute bottom-6 inset-x-0 mx-auto max-w-3xl px-6 text-center text-sm text-foreground/80 pointer-events-none",children:t})]})}function A(e){let{url:r,videoId:t,onSendToChat:o,autoSummarize:i}=e,l=(0,s.c)("roots"),[w,j]=(0,n.useTransition)(),[N,_]=(0,n.useState)(null),[A,z]=(0,n.useState)(!1),[C,S]=(0,n.useState)(""),[R,$]=(0,n.useState)(!1),E=(0,n.useRef)(!1),L=()=>{_(null),j(async()=>{let e=await y({url:r});if(e.ok){_(e.text),z(!1);return}if(e.needsKey)return void z(!0);h.oR.error(e.error)})};(0,n.useEffect)(()=>{i&&(E.current||(E.current=!0,L()))},[i]);let P=async()=>{if(!C.trim())return void h.oR.error(l("markdown.enterKey"));$(!0);try{let e=await (0,k.A)(C.trim());if(!e.ok)return void h.oR.error(e.error);h.oR.success(l("markdown.geminiKeySaved")),S(""),z(!1),L()}finally{$(!1)}};return(0,a.jsxs)("span",{className:"not-prose my-4 block rounded-lg border bg-card overflow-hidden",children:[(0,a.jsx)("span",{className:"relative block w-full",style:{paddingTop:"56.25%"},children:(0,a.jsx)("iframe",{src:"https://www.youtube-nocookie.com/embed/".concat(t),className:"absolute inset-0 h-full w-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",referrerPolicy:"strict-origin-when-cross-origin",allowFullScreen:!0,title:"YouTube video"})}),(0,a.jsxs)("span",{className:"flex items-center gap-2 p-2 border-t bg-muted/30",children:[(0,a.jsx)(d.A,{className:"h-4 w-4 text-red-600 shrink-0"}),(0,a.jsx)("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:underline truncate flex-1 min-w-0",children:r}),(0,a.jsxs)(g.$,{type:"button",size:"sm",variant:"outline",onClick:L,disabled:w,className:"gap-1 shrink-0 h-7",children:[w?(0,a.jsx)(u.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(m.A,{className:"h-3 w-3"}),l("markdown.summarize")]})]}),A&&(0,a.jsxs)("span",{className:"block border-t bg-amber-50/60 p-3 space-y-2",children:[(0,a.jsxs)("span",{className:"flex items-center gap-2 text-xs text-amber-900",children:[(0,a.jsx)(p.A,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{className:"font-medium",children:l("markdown.needsGeminiKey")})]}),(0,a.jsx)("span",{className:"block text-[11px] text-amber-900/80",children:l.rich("markdown.geminiKeyHelp",{link:()=>(0,a.jsx)("a",{href:"https://aistudio.google.com/apikey",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"aistudio.google.com/apikey"}),path:()=>(0,a.jsx)("code",{className:"font-mono",children:"~/.reflex/api-keys/gemini.json"}),modelsList:()=>(0,a.jsx)("code",{className:"font-mono",children:"models.list"})})}),(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)(v.p,{type:"password",value:C,onChange:e=>S(e.target.value),placeholder:"AIza…",className:"font-mono text-xs h-8 flex-1",disabled:R}),(0,a.jsxs)(g.$,{type:"button",size:"sm",onClick:()=>void P(),disabled:R||!C.trim(),className:"h-8 gap-1",children:[R?(0,a.jsx)(u.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(x.A,{className:"h-3 w-3"}),l("markdown.saveAndContinue")]}),(0,a.jsx)(g.$,{type:"button",size:"icon",variant:"ghost",onClick:()=>z(!1),className:"h-8 w-8",children:(0,a.jsx)(c.A,{className:"h-3.5 w-3.5"})})]})]}),N&&(0,a.jsxs)("span",{className:"block border-t p-3 space-y-2",children:[(0,a.jsxs)("span",{className:"flex items-center gap-2 text-[11px] uppercase tracking-wider text-muted-foreground",children:[(0,a.jsx)(b.A,{className:"h-3 w-3 text-emerald-600"}),"Gemini summary",(0,a.jsxs)(g.$,{type:"button",size:"sm",variant:"ghost",onClick:L,className:"ml-auto h-6 text-[10px] gap-1",disabled:w,children:[w?(0,a.jsx)(u.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(m.A,{className:"h-3 w-3"}),l("markdown.redo")]}),o&&(0,a.jsxs)(g.$,{type:"button",size:"sm",variant:"outline",onClick:()=>o(N,r),className:"h-6 text-[10px] gap-1",children:[(0,a.jsx)(f.A,{className:"h-3 w-3"}),l("markdown.toChat")]})]}),(0,a.jsx)("span",{className:"block",children:(0,a.jsx)("span",{className:"block text-sm whitespace-pre-wrap leading-relaxed",children:N})})]})]})}},28310:(e,r,t)=>{t.d(r,{E:()=>l});var a=t(4624);t(99356);var n=t(60621),s=t(50362),o=t(13506);let i=(0,n.F)("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function l(e){let{className:r,variant:t="default",asChild:n=!1,...l}=e,c=n?s.bL:"span";return(0,a.jsx)(c,{"data-slot":"badge","data-variant":t,className:(0,o.cn)(i({variant:t}),r),...l})}},78825:(e,r,t)=>{t.d(r,{J:()=>o});var a=t(4624);t(99356);var n=t(33976),s=t(13506);function o(e){let{className:r,...t}=e;return(0,a.jsx)(n.Root,{"data-slot":"label",className:(0,s.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",r),...t})}},91074:(e,r,t)=>{t.d(r,{Separator:()=>o});var a=t(4624);t(99356);var n=t(44188),s=t(13506);function o(e){let{className:r,orientation:t="horizontal",decorative:o=!0,...i}=e;return(0,a.jsx)(n.b,{"data-slot":"separator",decorative:o,orientation:t,className:(0,s.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",r),...i})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7922],{8190:(e,t,a)=>{a.d(t,{CommandBar:()=>h});var r=a(4624),s=a(99356),n=a(69285),l=a(49411),i=a(95265),o=a(56221),c=a(18909),d=a(65127),u=a(63602),m=a(63514),x=a(18471);function h(e){let{rootId:t,focusFile:a}=e,h=(0,l.c)("roots"),[,p]=(0,s.useTransition)(),b=(0,n.useRouter)();return(0,r.jsx)(u.E,{label:h("commandBar.label"),children:(0,r.jsx)(x.L,{rootId:t,placeholder:h("commandBar.placeholder"),submitLabel:h("commandBar.submit"),pendingLabel:h("commandBar.submitPending"),SubmitIcon:i.A,onSubmit:async e=>{let{message:r,attachments:s}=e;return await new Promise(e=>{p(async()=>{let n=await (0,c.g)(t,r,s,a);if(!n.ok){var l;o.oR.error(null!=(l=n.error)?l:h("commandBar.startFailed")),e(!1);return}(0,m.$d)(m.Zi.topicsChanged(t)),r.trim()&&(0,d.h)(t,n.topicId,r).then(e=>{e.ok&&(0,m.$d)(m.Zi.topicsChanged(t))}),b.push("/roots/".concat(t,"/chat/").concat(n.topicId)),e(!0)})})}})})}},18909:(e,t,a)=>{a.d(t,{g:()=>s});var r=a(7911);let s=(0,r.createServerReference)("78c3f2500c42332a8c114501958483c62375d5516b",r.callServer,void 0,r.findSourceMapURL,"startTopicAction")},22841:(e,t,a)=>{a.d(t,{bq:()=>u,eb:()=>x,gC:()=>m,l6:()=>c,yv:()=>d});var r=a(4624);a(99356);var s=a(69709),n=a(43153),l=a(59728),i=a(85314),o=a(13506);function c(e){let{...t}=e;return(0,r.jsx)(i.Root,{"data-slot":"select",...t})}function d(e){let{...t}=e;return(0,r.jsx)(i.Value,{"data-slot":"select-value",...t})}function u(e){let{className:t,size:a="default",children:n,...l}=e;return(0,r.jsxs)(i.Trigger,{"data-slot":"select-trigger","data-size":a,className:(0,o.cn)("flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",t),...l,children:[n,(0,r.jsx)(i.Icon,{asChild:!0,children:(0,r.jsx)(s.A,{className:"size-4 opacity-50"})})]})}function m(e){let{className:t,children:a,position:s="item-aligned",align:n="center",...l}=e;return(0,r.jsx)(i.Portal,{children:(0,r.jsxs)(i.Content,{"data-slot":"select-content",className:(0,o.cn)("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","popper"===s&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:s,align:n,...l,children:[(0,r.jsx)(h,{}),(0,r.jsx)(i.Viewport,{className:(0,o.cn)("p-1","popper"===s&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:a}),(0,r.jsx)(p,{})]})})}function x(e){let{className:t,children:a,...s}=e;return(0,r.jsxs)(i.Item,{"data-slot":"select-item",className:(0,o.cn)("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...s,children:[(0,r.jsx)("span",{"data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,r.jsx)(i.ItemIndicator,{children:(0,r.jsx)(n.A,{className:"size-4"})})}),(0,r.jsx)(i.ItemText,{children:a})]})}function h(e){let{className:t,...a}=e;return(0,r.jsx)(i.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,r.jsx)(l.A,{className:"size-4"})})}function p(e){let{className:t,...a}=e;return(0,r.jsx)(i.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,r.jsx)(s.A,{className:"size-4"})})}},27344:(e,t,a)=>{a.d(t,{N:()=>s});var r=a(7911);let s=(0,r.createServerReference)("00bf2ed558954da84ef1a017e0c8acd1eff544205f",r.callServer,void 0,r.findSourceMapURL,"getTunnelStatusAction")},32669:(e,t,a)=>{a.d(t,{InsertImageButton:()=>z});var r=a(4624),s=a(99356),n=a(69285),l=a(39160),i=a(49411),o=a(85253),c=a(13561),d=a(8096),u=a(43863),m=a(23262),x=a(56221),h=a(15523),p=a(71651),b=a(78825),g=a(22841),f=a(49881),v=a(80192),j=a(43504),y=a(7911);let w=(0,y.createServerReference)("40cb4644bf54ca43f67a50aae9bc00059722399550",y.callServer,void 0,y.findSourceMapURL,"generateAction"),N=(0,y.createServerReference)("40b0f04935fd3239c9748740e170377bf3ba03c080",y.callServer,void 0,y.findSourceMapURL,"searchAction"),k=(0,y.createServerReference)("40eb32af5e902a48dc90ace231fb06d6e109138ea1",y.callServer,void 0,y.findSourceMapURL,"attachAction"),S=(0,y.createServerReference)("400965a1f9fc3db1981b899965b0a0edd5fe5418d6",y.callServer,void 0,y.findSourceMapURL,"uploadAction"),R=["1:1","16:9","9:16","4:3","3:4","21:9"];function C(e){let{rootId:t,open:a,onOpenChange:n,onInsert:y}=e,C=(0,i.c)("app"),[z,A]=(0,s.useState)(""),[T,P]=(0,s.useState)("gemini"),[L,I]=(0,s.useState)("1:1"),[U,_]=(0,s.useState)(!0),[B,E]=(0,s.useState)(null),[K,$]=(0,s.useTransition)(),[M,F]=(0,s.useState)(""),[V,q]=(0,s.useState)("unsplash"),[J,X]=(0,s.useState)([]),[O,D]=(0,s.useTransition)(),[G,Z]=(0,s.useState)(null),[H,W]=(0,s.useState)(!0),[Q,Y]=(0,s.useState)(""),[ee,et]=(0,s.useState)(!0),[ea,er]=(0,s.useTransition)();if((0,s.useEffect)(()=>{if(!a)return;let e=e=>{"Escape"===e.key&&n(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a,n]),!a)return null;let es=()=>{M.trim()&&(X([]),D(async()=>{let e=await N({rootId:t,query:M.trim(),provider:V,count:12});if(!e.ok)return void x.oR.error(e.error);X(e.results)}))};return(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:e=>{e.target===e.currentTarget&&n(!1)},children:[(0,r.jsx)("div",{"aria-hidden":!0,className:"absolute inset-0 bg-background/80 backdrop-blur-sm",onClick:()=>n(!1)}),(0,r.jsxs)("div",{className:"relative bg-card border rounded-lg shadow-xl w-full max-w-3xl max-h-[85vh] flex flex-col",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b",children:[(0,r.jsx)(l.A,{className:"h-4 w-4 text-violet-600"}),(0,r.jsx)("h2",{className:"text-sm font-medium flex-1",children:C("images.titleHeader")}),(0,r.jsx)(o.$,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>n(!1),children:(0,r.jsx)(c.A,{className:"h-4 w-4"})})]}),(0,r.jsxs)(f.tU,{defaultValue:"generate",className:"flex-1 min-h-0 flex flex-col",children:[(0,r.jsxs)(f.j7,{className:"mx-4 mt-3 self-start",children:[(0,r.jsxs)(f.Xi,{value:"generate",children:[(0,r.jsx)(d.A,{className:"mr-1 h-3.5 w-3.5"})," ",C("images.tabGenerate")]}),(0,r.jsxs)(f.Xi,{value:"search",children:[(0,r.jsx)(u.A,{className:"mr-1 h-3.5 w-3.5"})," ",C("images.tabSearch")]}),(0,r.jsxs)(f.Xi,{value:"upload",children:[(0,r.jsx)(m.A,{className:"mr-1 h-3.5 w-3.5"})," ",C("images.tabUpload")]})]}),(0,r.jsxs)(v.F,{className:"flex-1 min-h-0",children:[(0,r.jsxs)(f.av,{value:"generate",className:"px-4 py-4 space-y-3",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(b.J,{htmlFor:"img-prompt",children:C("images.promptLabel")}),(0,r.jsx)(p.T,{id:"img-prompt",value:z,onChange:e=>A(e.target.value),placeholder:C("images.promptPlaceholder"),rows:4})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(b.J,{children:C("images.providerLabel")}),(0,r.jsxs)(g.l6,{value:T,onValueChange:e=>P(e),children:[(0,r.jsx)(g.bq,{children:(0,r.jsx)(g.yv,{})}),(0,r.jsxs)(g.gC,{children:[(0,r.jsx)(g.eb,{value:"gemini",children:"Gemini Nano Banana"}),(0,r.jsx)(g.eb,{value:"codex",children:"Codex $imagegen"})]})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(b.J,{children:C("images.aspectLabel")}),(0,r.jsxs)(g.l6,{value:L,onValueChange:I,children:[(0,r.jsx)(g.bq,{children:(0,r.jsx)(g.yv,{})}),(0,r.jsx)(g.gC,{children:R.map(e=>(0,r.jsx)(g.eb,{value:e,children:e},e))})]})]})]}),(0,r.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,r.jsx)("input",{type:"checkbox",checked:U,onChange:e=>_(e.target.checked)}),C("images.saveToKb")]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(o.$,{type:"button",size:"sm",onClick:()=>{z.trim()&&(E(null),$(async()=>{let e=await w({rootId:t,prompt:z.trim(),provider:T,aspectRatio:L,attachToKb:U});if(!e.ok)return void x.oR.error(e.error);E({url:e.url,markdown:e.markdown,...e.kbRelPath?{kbRelPath:e.kbRelPath}:{}})}))},disabled:K||!z.trim(),children:K?C("images.generating"):C("images.generate")}),K&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:C("images.takesAMinute")})]}),K?(0,r.jsx)(j.E,{className:"h-64 w-full"}):B?(0,r.jsxs)("div",{className:"space-y-2 border rounded p-3",children:[(0,r.jsx)("img",{src:B.url,alt:z,className:"max-h-80 mx-auto rounded"}),(0,r.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,r.jsx)(o.$,{type:"button",size:"sm",variant:"outline",onClick:()=>E(null),children:C("images.again")}),(0,r.jsx)(o.$,{type:"button",size:"sm",onClick:()=>{B&&(null==y||y(B),x.oR.success(B.kbRelPath?C("images.savedToKb",{path:B.kbRelPath}):C("images.ready")),n(!1))},children:C("images.insert")})]})]}):null]}),(0,r.jsxs)(f.av,{value:"search",className:"px-4 py-4 space-y-3",children:[(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(h.p,{value:M,onChange:e=>F(e.target.value),placeholder:C("images.searchPlaceholder"),onKeyDown:e=>{"Enter"===e.key&&es()}}),(0,r.jsxs)(g.l6,{value:V,onValueChange:e=>q(e),children:[(0,r.jsx)(g.bq,{className:"w-36",children:(0,r.jsx)(g.yv,{})}),(0,r.jsxs)(g.gC,{children:[(0,r.jsx)(g.eb,{value:"unsplash",children:"Unsplash"}),(0,r.jsx)(g.eb,{value:"pexels",children:"Pexels"}),(0,r.jsx)(g.eb,{value:"brave",children:C("images.braveWeb")})]})]}),(0,r.jsx)(o.$,{type:"button",size:"sm",onClick:es,disabled:O||!M.trim(),children:C("images.find")})]}),(0,r.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,r.jsx)("input",{type:"checkbox",checked:H,onChange:e=>W(e.target.checked)}),C("images.saveToKb")]}),O&&0===J.length?(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2",children:Array.from({length:6}).map((e,t)=>(0,r.jsx)(j.E,{className:"h-32 w-full"},t))}):J.length>0?(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2",children:J.map(e=>(0,r.jsxs)("button",{type:"button",disabled:null!==G,onClick:()=>{Z(e.url),D(async()=>{let a=await k({rootId:t,sourceUrl:e.url,alt:M.trim()||"image",attribution:e.attribution,attachToKb:H});if(Z(null),!a.ok)return void x.oR.error(a.error);null==y||y({url:a.url,markdown:a.markdown,...a.kbRelPath?{kbRelPath:a.kbRelPath}:{}}),x.oR.success(a.kbRelPath?C("images.savedToKb",{path:a.kbRelPath}):C("images.savedToProject")),n(!1)})},className:"group relative overflow-hidden rounded border hover:border-violet-500 disabled:opacity-50",title:"".concat(e.attribution.name," \xb7 ").concat(e.provider),children:[(0,r.jsx)("img",{src:e.thumb,alt:"",className:"h-32 w-full object-cover"}),(0,r.jsx)("div",{className:"absolute bottom-0 inset-x-0 px-1.5 py-0.5 text-[10px] bg-black/60 text-white truncate",children:e.attribution.name}),G===e.url&&(0,r.jsx)("div",{className:"absolute inset-0 bg-black/40 flex items-center justify-center text-xs text-white",children:C("images.saving")})]},e.url))}):(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:C("images.noKeys")})]}),(0,r.jsxs)(f.av,{value:"upload",className:"px-4 py-4 space-y-3",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(b.J,{htmlFor:"img-alt",children:C("images.altLabel")}),(0,r.jsx)(h.p,{id:"img-alt",value:Q,onChange:e=>Y(e.target.value),placeholder:C("images.altPlaceholder")})]}),(0,r.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,r.jsx)("input",{type:"checkbox",checked:ee,onChange:e=>et(e.target.checked)}),C("images.saveToKb")]}),(0,r.jsx)(h.p,{type:"file",accept:"image/*",disabled:ea,onChange:e=>{var a;let r=null==(a=e.target.files)?void 0:a[0];r&&er(async()=>{let e=function(e){let t=new Uint8Array(e),a="";for(let e=0;e<t.length;e+=32768){let r=t.subarray(e,e+32768);a+=String.fromCharCode.apply(null,Array.from(r))}return btoa(a)}(await r.arrayBuffer()),a=await S({rootId:t,base64:e,mime:r.type,alt:Q||r.name.replace(/\.[^.]+$/,""),attachToKb:ee});if(!a.ok)return void x.oR.error(a.error);null==y||y({url:a.url,markdown:a.markdown,...a.kbRelPath?{kbRelPath:a.kbRelPath}:{}}),x.oR.success(a.kbRelPath?C("images.savedToKb",{path:a.kbRelPath}):C("images.uploaded")),n(!1)})}}),ea&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:C("images.uploading")})]})]})]})]})]})}function z(e){let{rootId:t,redirectToKb:a=!0}=e,[c,d]=(0,s.useState)(!1),u=(0,n.useRouter)(),m=(0,i.c)("app");return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>d(!0),children:[(0,r.jsx)(l.A,{className:"mr-1 h-4 w-4"})," ",m("images.button")]}),(0,r.jsx)(C,{rootId:t,open:c,onOpenChange:d,onInsert:e=>{let{kbRelPath:r}=e;if(a&&r){let e=r.split("/").map(encodeURIComponent).join("/");u.push("/roots/".concat(t,"/kb/").concat(e))}}})]})}},43504:(e,t,a)=>{a.d(t,{E:()=>n});var r=a(4624),s=a(13506);function n(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"skeleton",className:(0,s.cn)("animate-pulse rounded-md bg-accent",t),...a})}},49881:(e,t,a)=>{a.d(t,{Xi:()=>d,av:()=>u,j7:()=>c,tU:()=>i});var r=a(4624);a(99356);var s=a(60621),n=a(86631),l=a(13506);function i(e){let{className:t,orientation:a="horizontal",...s}=e;return(0,r.jsx)(n.Root,{"data-slot":"tabs","data-orientation":a,orientation:a,className:(0,l.cn)("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",t),...s})}let o=(0,s.F)("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function c(e){let{className:t,variant:a="default",...s}=e;return(0,r.jsx)(n.List,{"data-slot":"tabs-list","data-variant":a,className:(0,l.cn)(o({variant:a}),t),...s})}function d(e){let{className:t,...a}=e;return(0,r.jsx)(n.Trigger,{"data-slot":"tabs-trigger",className:(0,l.cn)("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",t),...a})}function u(e){let{className:t,...a}=e;return(0,r.jsx)(n.Content,{"data-slot":"tabs-content",className:(0,l.cn)("flex-1 outline-none",t),...a})}},65127:(e,t,a)=>{a.d(t,{h:()=>s});var r=a(7911);let s=(0,r.createServerReference)("7044d226c44bc09b7f8a89033c20eab29f5d5002f9",r.callServer,void 0,r.findSourceMapURL,"generateTopicTitleAction")},80192:(e,t,a)=>{a.d(t,{F:()=>l});var r=a(4624);a(99356);var s=a(14884),n=a(13506);function l(e){let{className:t,children:a,...l}=e;return(0,r.jsxs)(s.Root,{"data-slot":"scroll-area",className:(0,n.cn)("relative",t),...l,children:[(0,r.jsx)(s.Viewport,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:a}),(0,r.jsx)(i,{}),(0,r.jsx)(s.Corner,{})]})}function i(e){let{className:t,orientation:a="vertical",...l}=e;return(0,r.jsx)(s.ScrollAreaScrollbar,{"data-slot":"scroll-area-scrollbar",orientation:a,className:(0,n.cn)("flex touch-none p-px transition-colors select-none","vertical"===a&&"h-full w-2.5 border-l border-l-transparent","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent",t),...l,children:(0,r.jsx)(s.ScrollAreaThumb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}},86049:(e,t,a)=>{a.d(t,{ShareButton:()=>p});var r=a(4624),s=a(99356),n=a(30441),l=a(43153),i=a(9598),o=a(13561),c=a(3024),d=a(56221),u=a(49411),m=a(7911);let x=(0,m.createServerReference)("40e4d6691f4a6b81fe3319ae635d5d56fd16ed6b66",m.callServer,void 0,m.findSourceMapURL,"createShareAction");var h=a(27344);function p(e){let t=(0,u.c)("app"),[a,m]=(0,s.useState)(!1),[p,b]=(0,s.useState)(""),[g,f]=(0,s.useTransition)(),[v,j]=(0,s.useState)(null);return a?v?(0,r.jsxs)("div",{className:"rounded border bg-card p-2 text-xs space-y-1.5 w-full max-w-sm",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 text-emerald-700",children:[(0,r.jsx)(l.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{className:"font-medium",children:t("share.button.createdTitle")})]}),(0,r.jsx)("a",{href:v.url,target:"_blank",rel:"noopener noreferrer",className:"block font-mono text-[11px] text-violet-700 hover:underline break-all",children:v.url}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>void navigator.clipboard.writeText(v.url).then(()=>d.oR.success(t("share.button.copied"))),className:"inline-flex items-center gap-1 rounded border px-2 py-0.5 hover:bg-accent",children:[(0,r.jsx)(i.A,{className:"h-3 w-3"}),t("share.button.copy")]}),(0,r.jsx)("button",{type:"button",onClick:()=>{j(null),m(!1),b("")},className:"text-muted-foreground hover:text-foreground",children:t("share.button.done")})]})]}):(0,r.jsxs)("div",{className:"rounded border bg-card p-2 text-xs space-y-1.5 w-full max-w-sm",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)(n.A,{className:"h-3.5 w-3.5 text-violet-600"}),(0,r.jsx)("span",{className:"font-medium",children:t("share.button.newLink")}),(0,r.jsx)("button",{type:"button",onClick:()=>m(!1),className:"ml-auto text-muted-foreground hover:text-foreground",children:(0,r.jsx)(o.A,{className:"h-3 w-3"})})]}),(0,r.jsx)("label",{className:"block text-[10px] text-muted-foreground",children:t("share.button.passwordLabel")}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(c.A,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground pointer-events-none"}),(0,r.jsx)("input",{type:"password",value:p,onChange:e=>b(e.target.value),autoFocus:!0,placeholder:t("share.button.passwordPlaceholder"),className:"w-full rounded border bg-background pl-6 pr-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-violet-400"})]}),(0,r.jsx)("button",{type:"button",onClick:()=>{f(async()=>{var a;let r=await (0,h.N)(),s=await x({kind:e.kind,...e.rootId?{rootId:e.rootId}:{},...e.utilityScope?{utilityScope:e.utilityScope}:{},...e.utilityId?{utilityId:e.utilityId}:{},...e.kbRelPath?{kbRelPath:e.kbRelPath}:{},...e.label?{label:e.label}:{},...p.trim()?{password:p.trim()}:{}});if(!s.ok)return void d.oR.error(s.error);let n=null!=(a=r.status.publicUrl)?a:window.location.origin,l=new URL("/share/".concat(s.share.id),n).toString();j({share:s.share,url:l}),navigator.clipboard.writeText(l).catch(()=>null),d.oR.success(r.status.running?t("share.button.created"):t("share.button.createdNoTunnel"))})},disabled:g,className:"w-full rounded bg-violet-600 text-white px-2 py-1 hover:bg-violet-700 disabled:opacity-50 inline-flex items-center justify-center gap-1",children:g?t("share.button.creating"):t("share.button.create")}),(0,r.jsx)("p",{className:"text-[10px] text-muted-foreground",children:t("share.button.footer")})]}):(0,r.jsxs)("button",{type:"button",onClick:()=>m(!0),className:e.iconOnly?"p-1 rounded hover:bg-accent text-muted-foreground hover:text-violet-700":"inline-flex items-center gap-1 rounded border px-2 py-1 text-xs hover:bg-accent",title:t("share.button.title"),children:[(0,r.jsx)(n.A,{className:"h-3.5 w-3.5"}),!e.iconOnly&&t("share.button.label")]})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9624],{3239:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(45804).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},8096:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(45804).A)("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]])},13506:(e,t,r)=>{r.d(t,{cn:()=>i});var a=r(47989),s=r(55701);function i(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,s.QP)((0,a.$)(t))}},13561:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(45804).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},60621:(e,t,r)=>{r.d(t,{F:()=>n});var a=r(47989);let s=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,i=a.$,n=(e,t)=>r=>{var a;if((null==t?void 0:t.variants)==null)return i(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:n,defaultVariants:l}=t,o=Object.keys(n).map(e=>{let t=null==r?void 0:r[e],a=null==l?void 0:l[e];if(null===t)return null;let i=s(t)||s(a);return n[e][i]}),d=r&&Object.entries(r).reduce((e,t)=>{let[r,a]=t;return void 0===a||(e[r]=a),e},{});return i(e,o,null==t||null==(a=t.compoundVariants)?void 0:a.reduce((e,t)=>{let{class:r,className:a,...s}=t;return Object.entries(s).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...l,...d}[t]):({...l,...d})[t]===r})?[...e,r,a]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},71651:(e,t,r)=>{r.d(t,{T:()=>i});var a=r(4624);r(99356);var s=r(13506);function i(e){let{className:t,...r}=e;return(0,a.jsx)("textarea",{"data-slot":"textarea",className:(0,s.cn)("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",t),...r})}},79624:(e,t,r)=>{r.d(t,{UtilityIframe:()=>f});var a=r(4624),s=r(99356),i=r(8096),n=r(13561),l=r(3239),o=r(95265),d=r(56221),c=r(49411),u=r(85253),p=r(71651),v=r(7911);let h=(0,v.createServerReference)("408c0a7dd30a0bd18e85787c67a8bc6f8fc6163ba5",v.callServer,void 0,v.findSourceMapURL,"startUtilityHelperChatAction");function m(e){let{utilityId:t,utilityName:r,rootId:v,requestSnapshot:m}=e,f=(0,c.c)("app"),[g,x]=(0,s.useState)(!1),[b,y]=(0,s.useState)(""),[k,w]=(0,s.useTransition)(),j=(0,s.useRef)(null);(0,s.useEffect)(()=>{var e;g&&(null==(e=j.current)||e.focus())},[g]);let N=!v,z=()=>{let e=b.trim();e&&v&&!k&&w(async()=>{let a;try{let e=await Promise.race([m(),new Promise(e=>setTimeout(()=>e(void 0),600))]);void 0!==e&&(a="string"==typeof e?e:JSON.stringify(e,null,2))}catch(e){}let s=await h({rootId:v,utilityId:t,utilityName:null!=r?r:t,question:e,...a?{context:a}:{}});if(!s.ok)return void d.oR.error(s.error);window.open("/roots/".concat(v,"/chat/").concat(s.topicId),"_blank"),y(""),x(!1)})};return g?(0,a.jsx)("div",{className:"absolute right-3 bottom-3 z-10 w-[min(28rem,calc(100%-1.5rem))]",children:(0,a.jsxs)("div",{className:"rounded-xl border bg-card shadow-xl",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border-b",children:[(0,a.jsx)(i.A,{className:"h-3.5 w-3.5 text-violet-600 shrink-0"}),(0,a.jsx)("span",{className:"text-sm font-medium truncate",children:f("utilities.ask.title",{name:null!=r?r:t})}),(0,a.jsx)("button",{type:"button",onClick:()=>x(!1),className:"ml-auto p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground shrink-0",title:f("utilities.ask.close"),"aria-label":f("utilities.ask.close"),children:(0,a.jsx)(n.A,{className:"h-3.5 w-3.5"})})]}),(0,a.jsxs)("div",{className:"p-2",children:[N?(0,a.jsx)("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:f("utilities.helper.projectOnly")}):(0,a.jsxs)("div",{className:"flex items-end gap-2",children:[(0,a.jsx)(p.T,{ref:j,value:b,onChange:e=>y(e.target.value),onKeyDown:e=>{if("Escape"===e.key){e.preventDefault(),x(!1);return}"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),z())},placeholder:f("utilities.ask.placeholder"),rows:1,disabled:k,className:"resize-none min-h-[44px] max-h-40 text-sm bg-background/70 py-2.5 flex-1"}),(0,a.jsx)(u.$,{type:"button",size:"lg",onClick:z,disabled:k||!b.trim(),className:"h-11 px-5 shadow-md shrink-0",children:k?(0,a.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(o.A,{className:"h-4 w-4"})})]}),(0,a.jsx)("p",{className:"px-1 pt-1.5 text-[10px] text-muted-foreground",children:f("utilities.ask.hint")})]})]})}):(0,a.jsx)("button",{type:"button",onClick:()=>x(!0),className:"absolute right-3 bottom-3 z-10 inline-flex h-10 w-10 items-center justify-center rounded-full reflex-gradient text-white shadow-lg hover:opacity-90",title:f("utilities.iframe.openHelper"),"aria-label":f("utilities.iframe.openHelper"),children:(0,a.jsx)(i.A,{className:"h-4 w-4"})})}function f(e){let{scope:t,id:r,rootId:i,className:n,title:l,agentChat:o,utilityName:d}=e,c=(0,s.useRef)(null),u=(0,s.useRef)(null),p=i?"?rootId=".concat(encodeURIComponent(i)):"",v="/api/utilities/".concat(t,"/").concat(r,"/iframe").concat(p),h="/api/utilities/".concat(t,"/").concat(r,"/host").concat(p);(0,s.useEffect)(()=>{let e=async e=>{var t,r,a,s,i,n;let l=e.data;if(!l||e.source!==(null==(t=c.current)?void 0:t.contentWindow))return;if("snapshot-payload"===l.type){let e=u.current;e&&(clearTimeout(e.timer),u.current=null,e.resolve(l.snapshot));return}if("host-rpc"!==l.type)return;let o=l.id;try{let e=await fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:l.method,args:l.args})}),t=await e.json();null==(a=c.current)||null==(r=a.contentWindow)||r.postMessage(t.ok?{type:"host-rpc-result",id:o,ok:!0,result:t.result}:{type:"host-rpc-result",id:o,ok:!1,error:null!=(s=t.error)?s:"HTTP ".concat(e.status)},"*")}catch(e){null==(n=c.current)||null==(i=n.contentWindow)||i.postMessage({type:"host-rpc-result",id:o,ok:!1,error:e instanceof Error?e.message:String(e)},"*")}};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[h]);let f=(0,a.jsx)("iframe",{ref:c,src:v,sandbox:"allow-scripts allow-forms allow-same-origin",className:null!=n?n:"h-full w-full border-0 bg-white",title:null!=l?l:"utility-".concat(r)});return o?(0,a.jsxs)("div",{className:"relative h-full w-full",children:[f,(0,a.jsx)(m,{utilityId:r,...d?{utilityName:d}:{},...i?{rootId:i}:{},requestSnapshot:()=>{var e;let t=null==(e=c.current)?void 0:e.contentWindow;return t?(u.current&&(clearTimeout(u.current.timer),u.current.resolve(void 0),u.current=null),new Promise(e=>{let r=setTimeout(()=>{var t;(null==(t=u.current)?void 0:t.resolve)===e&&(u.current=null,e(void 0))},500);u.current={resolve:e,timer:r};try{t.postMessage({type:"request-snapshot"},"*")}catch(t){clearTimeout(r),u.current=null,e(void 0)}})):Promise.resolve(void 0)}})]}):f}},85253:(e,t,r)=>{r.d(t,{$:()=>o});var a=r(4624);r(99356);var s=r(60621),i=r(50362),n=r(13506);let l=(0,s.F)("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function o(e){let{className:t,variant:r="default",size:s="default",asChild:o=!1,...d}=e,c=o?i.bL:"button";return(0,a.jsx)(c,{"data-slot":"button","data-variant":r,"data-size":s,className:(0,n.cn)(l({variant:r,size:s,className:t})),...d})}},95265:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(45804).A)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
package/.next/static/chunks/app/api/roots/[id]/chat/[topicId]/stream/route-5d0cd3b754198853.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
package/.next/static/chunks/app/api/utilities/[scope]/[id]/bundle.js/route-5d0cd3b754198853.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
package/.next/static/chunks/app/api/utilities/[scope]/[id]/host-api.mjs/route-5d0cd3b754198853.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
package/.next/static/chunks/app/api/utilities/[scope]/[id]/host-ui.mjs/route-5d0cd3b754198853.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
package/.next/static/chunks/app/api/utilities/[scope]/[id]/style.css/route-5d0cd3b754198853.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8,803,1064,1119,2047,2295,3373,4751,5618,5650,5867,6058,6062,6475,7200,7812,8818,9749],{93480:()=>{}},_=>{_.O(0,[4933,146,7358],()=>_(_.s=93480)),_N_E=_.O()}]);
|