@bendyline/gezel-service 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NOTICE.md +3 -3
- package/dist/bin/gezeld.js +8471 -5311
- package/dist/handboek-content/technical/building-connected-apps-with-gezel-app-sdk.md +78 -0
- package/dist/handboek-content/whats-new/{1.26250.md → 1.26251.md} +5 -5
- package/dist/index-store/static-index-worker.js +160 -51
- package/dist/index.d.ts +416 -71
- package/dist/index.js +8465 -5305
- package/dist/memory/embed-worker.js +132 -4
- package/dist/memory/image-embed-worker.js +14 -5
- package/dist/providers/mlx/python/cache_persist.py +52 -8
- package/dist/providers/mlx/python/gezel_mlx_server.py +44 -1
- package/dist/providers/mlx/python/qwen4_ple.py +159 -0
- package/dist/providers/mlx/python/spec_decode.py +73 -31
- package/dist/providers/mlx/python/tool_call_stream.py +10 -2
- package/dist/providers/mlx/python/tool_grammar.py +16 -0
- package/dist/ui/assets/{AmbientDashboardCard-DcVHxEdC.js → AmbientDashboardCard-_xnAQGnk.js} +1 -1
- package/dist/ui/assets/{AudioEngineSettings-BFM2S1mm.js → AudioEngineSettings-CgXgbX0i.js} +1 -1
- package/dist/ui/assets/{BenchmarksView-84-YeULA.js → BenchmarksView-BlExZpYA.js} +1 -1
- package/dist/ui/assets/CatalogBrowser-DYXUZQ_t.js +1 -0
- package/dist/ui/assets/{ChannelsSettings-7NAVUk4k.js → ChannelsSettings-EH27HcqZ.js} +1 -1
- package/dist/ui/assets/ChatTimelineView-Dn1TNyVn.js +7 -0
- package/dist/ui/assets/{ConnectedAppsPanel-CIgF4Q3R.js → ConnectedAppsPanel-BROry-Y0.js} +1 -1
- package/dist/ui/assets/CraftbookEditor-B2RNJnFf.js +1 -0
- package/dist/ui/assets/{CraftbookScriptEditorView-Ck5tzj3Y.js → CraftbookScriptEditorView-B-vySmHP.js} +1 -1
- package/dist/ui/assets/{CraftbookTabContent-BWg7FhK_.js → CraftbookTabContent-BW_2KC89.js} +1 -1
- package/dist/ui/assets/{CraftbookToolsetSetup-EuFOiUzR.js → CraftbookToolsetSetup-J7rEa835.js} +1 -1
- package/dist/ui/assets/{CraftbooksView-BIzQ1VVn.js → CraftbooksView-BjBUWPGF.js} +1 -1
- package/dist/ui/assets/DiffpackReviewView-CD4qJmgT.js +1 -0
- package/dist/ui/assets/DocumentDetail-SYozruTJ.js +1 -0
- package/dist/ui/assets/DocumentsView-DE7eL49Z.js +1 -0
- package/dist/ui/assets/{Ds4Settings-9soZCSeO.js → Ds4Settings-DGzc7JcD.js} +1 -1
- package/dist/ui/assets/{EmbeddedChat-Cce7nxXT.js → EmbeddedChat-D92TaJQ8.js} +1 -1
- package/dist/ui/assets/{FaceRecognitionCard-BVZyOwB8.js → FaceRecognitionCard-CB1Dt9X4.js} +1 -1
- package/dist/ui/assets/FileMapView-kVBG22FU.js +1 -0
- package/dist/ui/assets/FoldersSettings-BWFQU5B4.js +1 -0
- package/dist/ui/assets/GezelDetail-Br4v42Nv.js +1 -0
- package/dist/ui/assets/{GezelJsonEditor-DXXt165-.js → GezelJsonEditor-B9XEiW5Y.js} +1 -1
- package/dist/ui/assets/GezellenView-DheEBAy4.js +1 -0
- package/dist/ui/assets/{GildeUpdatesCard-CtY8mUTA.js → GildeUpdatesCard-BeIYv09f.js} +1 -1
- package/dist/ui/assets/{GithubSignInChip-DT3l6E0Q.js → GithubSignInChip-eEGCe9ar.js} +1 -1
- package/dist/ui/assets/{HandboekMediaProvider-ByJ4NAzz.js → HandboekMediaProvider-D0zcbbpf.js} +1 -1
- package/dist/ui/assets/HandboekView-p0BZT1rH.js +1 -0
- package/dist/ui/assets/{HistoryView-CkinzFEC.js → HistoryView-CKWcWW-Y.js} +1 -1
- package/dist/ui/assets/{HomeView-DNBrQnwy.js → HomeView-b_TT5oV3.js} +1 -1
- package/dist/ui/assets/{ImageEngineSettings-BfM9HSd_.js → ImageEngineSettings-CJfk4OJ4.js} +1 -1
- package/dist/ui/assets/{ImageRecognitionSettings-CaSQu5Br.js → ImageRecognitionSettings-DzbvZk5S.js} +1 -1
- package/dist/ui/assets/{IncompleteDownloads-C36lTCMG.js → IncompleteDownloads-C8_XyP8O.js} +1 -1
- package/dist/ui/assets/{KnowledgeCatalogsCard-CK9bqdf6.js → KnowledgeCatalogsCard-CHopG_j-.js} +1 -1
- package/dist/ui/assets/KnowledgeView-CXNKZUJq.js +1 -0
- package/dist/ui/assets/{LlamaCppSettings-CdNMHBbp.js → LlamaCppSettings-ohcM7kes.js} +1 -1
- package/dist/ui/assets/{MarkdownField-Dugmfr_e.js → MarkdownField-BX0qsaFq.js} +1 -1
- package/dist/ui/assets/{MemoriesTree-CgFqUNEr.js → MemoriesTree-BPj5Rod8.js} +1 -1
- package/dist/ui/assets/{MicrophoneSettings-DzDe9y1q.js → MicrophoneSettings-CWjeYnfI.js} +1 -1
- package/dist/ui/assets/MlxSettings-Dq6dRpcl.js +1 -0
- package/dist/ui/assets/{ModelPicker-BVkJhNAH.js → ModelPicker-0Ue-eEKj.js} +1 -1
- package/dist/ui/assets/NewPathDialog-BhAZm9dp.js +1 -0
- package/dist/ui/assets/{NewScriptDialog-TEAd0KLl.js → NewScriptDialog-DuryIe50.js} +1 -1
- package/dist/ui/assets/NewTaskDialog-BX24flMY.js +2 -0
- package/dist/ui/assets/{OllamaSettings-CPy2vxyZ.js → OllamaSettings-Boj8Nd1G.js} +1 -1
- package/dist/ui/assets/ProjectChat-Dhw_M5bq.js +5 -0
- package/dist/ui/assets/ProjectConnectionsTab-BwpMQNrg.js +1 -0
- package/dist/ui/assets/{ProjectGitStatusBar-BgHZ2ijN.js → ProjectGitStatusBar-BORGYx5l.js} +1 -1
- package/dist/ui/assets/{ProjectGithubView-BV2uTNU0.js → ProjectGithubView-CTP1BOMv.js} +1 -1
- package/dist/ui/assets/{ProjectMailTab-DLtJdXSL.js → ProjectMailTab-qFmAeV3M.js} +1 -1
- package/dist/ui/assets/{ProjectOverviewView-ZMs9nL5N.js → ProjectOverviewView-Cq1FsoaT.js} +1 -1
- package/dist/ui/assets/{ProjectTimeline-CTPcn4Kc.js → ProjectTimeline-Cqae2Z92.js} +1 -1
- package/dist/ui/assets/ProjectsView-D0uJjUB-.js +7 -0
- package/dist/ui/assets/{RecommendedBadge-iUoisQBi.js → RecommendedBadge-CN1jEmSn.js} +1 -1
- package/dist/ui/assets/{RemoteServersPanel-CTVJ0IRh.js → RemoteServersPanel-CMakvCCM.js} +1 -1
- package/dist/ui/assets/{ScriptEditorTabs-CCDFZjdC.js → ScriptEditorTabs-st6dJePd.js} +2 -2
- package/dist/ui/assets/{ScriptEditorView-CergLqKj.js → ScriptEditorView-BkySh57_.js} +2 -2
- package/dist/ui/assets/{ScriptsView-v7ckdhDi.js → ScriptsView-7uPKwjDB.js} +1 -1
- package/dist/ui/assets/{SecurityComplianceSettings-Bd0-66Gs.js → SecurityComplianceSettings-Tsv_pXfy.js} +1 -1
- package/dist/ui/assets/SessionSwitcher-D0fSeeHO.js +1 -0
- package/dist/ui/assets/SettingsView-cli_z8ZW.js +3 -0
- package/dist/ui/assets/{SquisqIntegration-C5l_OPvD.js → SquisqIntegration-BTZ1kBlg.js} +1 -1
- package/dist/ui/assets/{StorageCleanupDialog-3kv9-2mT.js → StorageCleanupDialog-CDBjl8JQ.js} +1 -1
- package/dist/ui/assets/{StorageUsageCard-7sWTrZFa.js → StorageUsageCard-DXY1j0dZ.js} +1 -1
- package/dist/ui/assets/TaskTabContent-C0P681SL.js +1 -0
- package/dist/ui/assets/TasksView-Ddwz10ri.js +1 -0
- package/dist/ui/assets/{TerminalCodeEditor-ChmdzmCz.js → TerminalCodeEditor-BkNQ6QoQ.js} +2 -2
- package/dist/ui/assets/ToolsetsEditor-KVigemfL.js +8 -0
- package/dist/ui/assets/{TransformToolbarButton-gzIxUBH7.js → TransformToolbarButton-8wfJR1bO.js} +2 -2
- package/dist/ui/assets/{UnrecognizedModels-0hptopv6.js → UnrecognizedModels-BzdU1clO.js} +1 -1
- package/dist/ui/assets/{VideoEngineSettings-BdNzCEdR.js → VideoEngineSettings-f79ff57u.js} +1 -1
- package/dist/ui/assets/{WorkspaceIndexPane-DnsOO916.js → WorkspaceIndexPane-fu5V6o1W.js} +1 -1
- package/dist/ui/assets/{api-C0I7spBl.js → api-CmrgM5Rf.js} +1 -1
- package/dist/ui/assets/chat-thread-memory-8MCtb17Q.js +1 -0
- package/dist/ui/assets/{chunk-6ECMNUIP-BvCy0HUI.js → chunk-6ECMNUIP-D5AA6ozp.js} +1 -1
- package/dist/ui/assets/{chunk-A6N6IN3I-ofeM4l8g.js → chunk-A6N6IN3I-BpxihS5H.js} +1 -1
- package/dist/ui/assets/{chunk-ATWVNF7D-CYuW1Yc6.js → chunk-ATWVNF7D-CKIWh7bN.js} +1 -1
- package/dist/ui/assets/{chunk-UBFT2CDQ-FexGDigd.js → chunk-CW24CH7I-BD0FIooX.js} +1 -1
- package/dist/ui/assets/{chunk-DXYWKZ52-zxe8pjH4.js → chunk-DXYWKZ52-DMKPZnpo.js} +1 -1
- package/dist/ui/assets/chunk-IIQYS2YH-BtDJt4Xr.js +1 -0
- package/dist/ui/assets/{chunk-KGWT454C-v5-l6U5m.js → chunk-KGWT454C-DsQOBuLg.js} +1 -1
- package/dist/ui/assets/{chunk-Q77KNJIN-BLuPdsQF.js → chunk-Q77KNJIN-BdWizq9s.js} +1 -1
- package/dist/ui/assets/{chunk-USU6HTKB-B_p-YcDp.js → chunk-USU6HTKB-DyGZplh4.js} +1 -1
- package/dist/ui/assets/{chunk-UXEANVBI-Bt0kX-0Z.js → chunk-UXEANVBI-BUBXvqyE.js} +1 -1
- package/dist/ui/assets/{chunk-O7JILDEF-CqcO1qaI.js → chunk-X7BNDUNI-D14WIvlD.js} +2 -2
- package/dist/ui/assets/{chunk-AE3IUKMM-mZjzzO8Z.js → chunk-ZSU5DJLX-CrjQf-vs.js} +1 -1
- package/dist/ui/assets/{container-BI8hxN1N.js → container-iFj1r6Hk.js} +1 -1
- package/dist/ui/assets/csv-Di411Mv-.js +1 -0
- package/dist/ui/assets/data-Q05qqAp4.js +1 -0
- package/dist/ui/assets/{dist-APSIK7H3.js → dist-1FNFiksd.js} +3 -3
- package/dist/ui/assets/dist-BMZhqfv7.js +2 -0
- package/dist/ui/assets/dist-CE5CbmDb.js +225 -0
- package/dist/ui/assets/doc-BHcGsJZd.js +587 -0
- package/dist/ui/assets/{document-import-DPK4r8Am.js → document-import-B2Ya6sbf.js} +1 -1
- package/dist/ui/assets/{docx-DRLuCTaC.js → docx-B8Pwz5Ih.js} +1 -1
- package/dist/ui/assets/{epub-a0p2Xb1b.js → epub-BQ4g8Q9j.js} +1 -1
- package/dist/ui/assets/{export-options-BqYFyzWx.js → export-options-Dylv69b3.js} +1 -1
- package/dist/ui/assets/file-browser-BLOPfnS0.js +5 -0
- package/dist/ui/assets/{html-BbQNmJ5X.js → html-BnA7qFwq.js} +1 -1
- package/dist/ui/assets/icons-CyM7Cg4E.js +1 -0
- package/dist/ui/assets/index-DW6qHqhU.css +1 -0
- package/dist/ui/assets/index-DivKnJyx.js +36 -0
- package/dist/ui/assets/{mail-link-CWfsP5Aq.js → mail-link-NtlcX5OE.js} +1 -1
- package/dist/ui/assets/{markdown-ryKA_OmY.js → markdown-CLKH_zzl.js} +1 -1
- package/dist/ui/assets/markdown-baseline-0dqv9qbV.js +1 -0
- package/dist/ui/assets/materialize-G4WC5UG3-xq2dcwS8.js +1 -0
- package/dist/ui/assets/{monaco-base-C0VTMpv-.js → monaco-base-BSvdAweA.js} +1 -1
- package/dist/ui/assets/{monaco-setup-CX8q88c5.js → monaco-setup-CT7LZ0o_.js} +1 -1
- package/dist/ui/assets/{new-project-meta-ZmDPGYzC.js → new-project-meta-5Y9Blozr.js} +1 -1
- package/dist/ui/assets/outside-in-Msmhxf_U.js +3 -0
- package/dist/ui/assets/{pdf-BHrygJa5.js → pdf-C4BhW3zg.js} +1 -1
- package/dist/ui/assets/{pending-drafts-27ujtQxX.js → pending-drafts-BD227X9H.js} +1 -1
- package/dist/ui/assets/{poppetje-CfaAvFkE.js → poppetje-DvCJO36y.js} +3 -3
- package/dist/ui/assets/{pptx-nDW64jAN.js → pptx-B6uaM2s7.js} +3 -3
- package/dist/ui/assets/{run-export-86KzLZ7R.js → run-export-TscWwR6y.js} +2 -2
- package/dist/ui/assets/{standalone-source-7QdiNsDW.js → standalone-source-Cw9SF7Zk.js} +1 -1
- package/dist/ui/assets/storage-Cmhlwx70.js +1 -0
- package/dist/ui/assets/styles-BjDaWeMA.css +1 -0
- package/dist/ui/assets/styles-CqO-rmOt.js +554 -0
- package/dist/ui/assets/{terminal-monaco-setup-Bar-sYKd.js → terminal-monaco-setup-me523-j-.js} +1 -1
- package/dist/ui/assets/{transform-CmAXy0Ck.js → transform-DxJCwK68.js} +1 -1
- package/dist/ui/assets/{use-local-model-manager-D1yiurrC.js → use-local-model-manager-8wvk-I-y.js} +1 -1
- package/dist/ui/assets/{useCompactLayout-BDtPQcDh.js → useCompactLayout-cm4E9Vja.js} +0 -0
- package/dist/ui/assets/{useCopilotAvailability-BHOfHrfT.js → useCopilotAvailability-D9hglSH_.js} +1 -1
- package/dist/ui/assets/{useDiffpacks-B0kYhlWQ.js → useDiffpacks-1BN2XJWg.js} +1 -1
- package/dist/ui/assets/{useGitSync-DOt-ODiw.js → useGitSync-7m9YA7h5.js} +1 -1
- package/dist/ui/assets/{useShowWorkInProgressFeatures-BtpredG7.js → useShowWorkInProgressFeatures-D6QOaTUT.js} +1 -1
- package/dist/ui/assets/{useTotalRamBytes-B8NFM27w.js → useTotalRamBytes-Durk383U.js} +1 -1
- package/dist/ui/assets/{xlsx-B_pu1ZvY.js → xlsx-BbHA9bxA.js} +1 -1
- package/dist/ui/index.html +15 -15
- package/package.json +12 -11
- package/dist/ui/assets/CatalogBrowser-7_jHy5Q3.js +0 -1
- package/dist/ui/assets/ChatTimelineView-Cg_kLK_U.js +0 -7
- package/dist/ui/assets/CraftbookEditor-BKAIsnXv.js +0 -1
- package/dist/ui/assets/DiffpackReviewView-B2a3zgE-.js +0 -1
- package/dist/ui/assets/DocumentDetail-GCYhwQqV.js +0 -1
- package/dist/ui/assets/DocumentsView-Cm3RaQ5N.js +0 -1
- package/dist/ui/assets/FileMapView-BKJovLcL.js +0 -1
- package/dist/ui/assets/FoldersSettings-CuJd2JdE.js +0 -1
- package/dist/ui/assets/GezelDetail-D_KIPDhQ.js +0 -1
- package/dist/ui/assets/GezellenView-BOOW1QQU.js +0 -1
- package/dist/ui/assets/HandboekView-gRzJcIbJ.js +0 -1
- package/dist/ui/assets/KnowledgeView-DJ3cJVHA.js +0 -1
- package/dist/ui/assets/MlxSettings-45mBFHbA.js +0 -1
- package/dist/ui/assets/NewTaskDialog-CIXVunZn.js +0 -2
- package/dist/ui/assets/ProjectChat-BiJRweob.js +0 -5
- package/dist/ui/assets/ProjectConnectionsTab-CQgaIzuv.js +0 -1
- package/dist/ui/assets/ProjectsView-BUdR76n6.js +0 -7
- package/dist/ui/assets/SessionSwitcher-BgZqyiRn.js +0 -1
- package/dist/ui/assets/SettingsView-DLhOYiR5.js +0 -3
- package/dist/ui/assets/TaskTabContent-CG2KmfwV.js +0 -1
- package/dist/ui/assets/TasksView-Dy5Ue4zS.js +0 -1
- package/dist/ui/assets/ToolsetsEditor-J9XxQ5Ms.js +0 -8
- package/dist/ui/assets/chat-thread-memory-CI2-giEq.js +0 -1
- package/dist/ui/assets/chunk-IIQYS2YH-DEkyBlHg.js +0 -1
- package/dist/ui/assets/csv-B0D9jJG2.js +0 -1
- package/dist/ui/assets/data-BIL84EaT.js +0 -1
- package/dist/ui/assets/dist-CJqyWK6E.js +0 -2
- package/dist/ui/assets/dist-DOqbRmFj.js +0 -225
- package/dist/ui/assets/doc-C2Ph2FWI.js +0 -584
- package/dist/ui/assets/document-companion-aDThLOwl.js +0 -1
- package/dist/ui/assets/file-browser-DVyWN0LD.js +0 -5
- package/dist/ui/assets/icons-DWaUNQbT.js +0 -1
- package/dist/ui/assets/index-DDu8nyO6.js +0 -34
- package/dist/ui/assets/index-DEDUSiCx.css +0 -1
- package/dist/ui/assets/markdown-baseline-9B52XlX2.js +0 -1
- package/dist/ui/assets/materialize-G4WC5UG3-BlZQe-88.js +0 -1
- package/dist/ui/assets/outside-in-BmIIeMid.js +0 -3
- package/dist/ui/assets/storage-B-vhjyV2.js +0 -1
- package/dist/ui/assets/styles-BvkZd-EV.js +0 -550
- package/dist/ui/assets/styles-IQ4adxWr.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{c as t}from"./outside-in-Msmhxf_U.js";var n=e({DROPPABLE_DOCUMENT_EXTENSIONS:()=>i,canDropDocumentFile:()=>f,importDroppedFiles:()=>m}),r=new Set([`md`,`markdown`,`mdx`,`txt`,`csv`,`json`,`yaml`,`yml`]),i=[...r,`html`,`htm`,`docx`,`pdf`,`pptx`,`xlsx`],a=new Set(i);function o(e){let t=e.lastIndexOf(`.`);return t>0?e.slice(t+1).toLocaleLowerCase(`en-US`):``}function s(e){return[...e].map(e=>{let t=e.charCodeAt(0);return e===`/`||e===`\\`||t<32?`-`:e}).join(``).trim()}function c(e,t){let n=e.replace(/^\/+|\/+$/g,``);return n?`${n}/${t}`:t}function l(e){let t=e.lastIndexOf(`.`);return t<=0?{stem:e,extension:``}:{stem:e.slice(0,t),extension:e.slice(t)}}function u(e,n,r){let{stem:i,extension:a}=l(n),o=c(e,n),s=2,u=e=>{if(r.has(e.toLocaleLowerCase(`en-US`)))return!0;let n=t(e);if(!n)return!1;let i=n.companionDirectory.toLocaleLowerCase(`en-US`);return[...r].some(e=>e===i||e.startsWith(`${i}/`))};for(;u(o);)o=c(e,`${i} ${s}${a}`),s+=1;r.add(o.toLocaleLowerCase(`en-US`));let d=t(o);return d&&r.add(d.companionDirectory.toLocaleLowerCase(`en-US`)),o}function d(e,t){if(t)return t;switch(o(e)){case`md`:case`markdown`:case`mdx`:return`text/markdown`;case`html`:case`htm`:return`text/html`;case`docx`:return`application/vnd.openxmlformats-officedocument.wordprocessingml.document`;case`pdf`:return`application/pdf`;case`pptx`:return`application/vnd.openxmlformats-officedocument.presentationml.presentation`;case`xlsx`:return`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`;default:return`application/octet-stream`}}function f(e){return a.has(o(e.name))}async function p(e,n,r){let i=t(r);if(!i)throw Error(`${n.name} is not a supported rendered document.`);return await e.writeBinary(i.targetPath,n,d(r,n.type)),[]}async function m(e){let n=e.destination?.replace(/^\/+|\/+$/g,``)??``,i=new Set(e.existingPaths.map(e=>e.toLocaleLowerCase(`en-US`))),a={importedPaths:[],warnings:[],rejected:[]};for(let c of e.files){let l=s(c.name);if(!l||!f({name:l})){a.rejected.push({name:c.name||`Unnamed file`,reason:`Unsupported document type`});continue}let d=u(n,l,i);try{if(t(d))a.warnings.push(...await p(e.target,c,d));else if(r.has(o(l)))await e.target.writeText(d,await c.text());else throw Error(`Unsupported document type`);a.importedPaths.push(d)}catch(e){a.rejected.push({name:c.name,reason:e instanceof Error?e.message:String(e)})}}return a}export{m as n,n as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{I as e}from"./doc-
|
|
1
|
+
import{I as e}from"./doc-BHcGsJZd.js";import{l as t}from"./chunk-X7BNDUNI-D14WIvlD.js";import{O as n}from"./chunk-GAZKTT4R-w1SNypWQ.js";import{l as r}from"./markdown-CLKH_zzl.js";import"./schemas-BvLZUsGm.js";import"./chunk-7AWFHP5U-MiVVPFTx.js";import{B as i,E as a,F as o,H as s,I as c,J as l,L as u,M as d,Q as f,R as p,U as m,V as h,W as g,a as ee,at as _,c as te,et as ne,i as re,it as v,k as y,l as ie,n as ae,nt as b,o as oe,r as se,rt as x,s as ce,tt as S,u as le,z as ue}from"./chunk-S5PCVMKU-Df5XzhSE.js";import{a as de,n as C,t as w}from"./chunk-JU2RHXUB-ClblWDJZ.js";import{a as fe,i as T,n as pe,r as me,t as he}from"./chunk-A6N6IN3I-BpxihS5H.js";import{t as ge}from"./chunk-B7GEAZBI-Divd2h1k.js";import{t as _e}from"./chunk-ILCJ3WFD-CLZxw4Ge.js";import{r as ve}from"./chunk-BXWNU4T5-CFA9w1DZ.js";import{t as ye}from"./chunk-IIQYS2YH-BtDJt4Xr.js";import{a as be,i as xe,n as Se,r as Ce}from"./chunk-USU6HTKB-DyGZplh4.js";var we={Heading1:1,Heading2:2,Heading3:3,Heading4:4,Heading5:5,Heading6:6,heading1:1,heading2:2,heading3:3,heading4:4,heading5:5,heading6:6,Title:1,Subtitle:2},Te={1:`Heading1`,2:`Heading2`,3:`Heading3`,4:`Heading4`,5:`Heading5`,6:`Heading6`},Ee=new Set([`Quote`,`IntenseQuote`,`quote`,`BlockQuote`]),De=new Set([`Code`,`CodeBlock`,`HTMLCode`,`PlainText`]),Oe=new Set([`CodeChar`,`HTMLCodeChar`,`VerbatimChar`]),ke=new Set([`bullet`,`none`]),Ae=`Calibri`,je=`Calibri Light`,E=22,D=`Consolas`,O=20,Me={1:32,2:26,3:24,4:22,5:22,6:22},Ne=`0563C1`;function Pe(e){return Math.round(e*20)}async function Fe(e,n={}){n.signal?.throwIfAborted();let r=n.themeId===void 0?{...n,themeId:t(e.frontmatter)}:n,i=new Le(r,e),a=Ie(e.children);i.setRelationshipSource(`document`);let o=A(a.body,i);i.setRelationshipSource(`header`);let s=A(a.header,i);i.setRelationshipSource(`footer`);let c=A(a.footer,i);return i.setRelationshipSource(`document`),st(o,s,c,i,r)}function Ie(e){let t={body:[],header:[],footer:[]};for(let n of e)n.type===`containerDirective`&&n.name===`docx-header`?t.header.push(...n.children):n.type===`containerDirective`&&n.name===`docx-footer`?t.footer.push(...n.children):t.body.push(n);return t}var Le=class{constructor(t,r){this.relIds=new he,this.nextNumId=1,this.nextFootnoteId=1,this.relationships=[],this.relationshipSource=`document`,this.numberingDefs=[],this.footnotes=new Map,this.footnoteIdMap=new Map,this.images=[],this.hasLists=!1,this.hasFootnotes=!1,this.iconFamilies=new Set,this.nextDocPrId=1;let i,a,o,s,c,l;if(t.themeId){let u=e(r,t.themeId,t.themeRegistry);i=Re(n(u.typography?.bodyFont,``)),a=Re(n(u.typography?.titleFont,``)),o=T(u.colors?.primary),s=T(u.colors?.text),c=T(u.colors?.textMuted),l=T(u.colors?.background)}this.font=t.defaultFont??i??Ae,this.headingFont=a??this.font,this.fontSize=t.defaultFontSize?t.defaultFontSize*2:E,this.headingColor=o,this.bodyColor=s,this.mutedColor=c,this.backgroundColor=l,this.resolvedImages=t.images??new Map,this.allowRelativeHyperlinks=t.allowRelativeHyperlinks??!1,this.signal=t.signal}allocRelId(){return this.allocRelIdFor(this.relationshipSource)}allocRelIdFor(e){return this.relIds.alloc(k(e))}setRelationshipSource(e){this.relationshipSource=e}addHyperlink(e){let t=fe(e,{allowRelative:this.allowRelativeHyperlinks});if(!t)return null;let n=this.allocRelId();return this.relationships.push({id:n,type:i,target:t,targetMode:`External`,source:this.relationshipSource}),n}addImage(e,t,n){let r=this.allocRelId(),i=this.nextDocPrId++,a=`word/media/${n}`;return this.images.push({relId:r,path:a,data:e,contentType:t}),this.relationships.push({id:r,type:h,target:`media/${n}`,source:this.relationshipSource}),{relId:r,docPrId:i}}allocNumbering(e){let t=this.nextNumId++;return this.numberingDefs.push({numId:t,ordered:e}),this.hasLists=!0,t}getFootnoteId(e){let t=this.footnoteIdMap.get(e);return t===void 0&&(t=this.nextFootnoteId++,this.footnoteIdMap.set(e,t),this.hasFootnotes=!0),t}};function k(e){return e===`header`?`word/header1.xml`:e===`footer`?`word/footer1.xml`:`word/document.xml`}function Re(e){if(!e)return``;let t=new Set([`sans-serif`,`serif`,`monospace`,`system-ui`,`cursive`,`fantasy`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`,`inherit`,`initial`]);for(let n of e.split(`,`)){let e=n.trim().replace(/^["']|["']$/g,``);if(e&&!t.has(e.toLowerCase()))return e}return``}function A(e,t){let n=[];for(let r=0;r<e.length;r++){r&255||t.signal?.throwIfAborted();let i=e[r];n.push(j(i,t,0))}return n.join(``)}function j(e,t,n){switch(e.type){case`heading`:return ze(e,t);case`paragraph`:return Be(e,t);case`blockquote`:return Ve(e,t);case`list`:return He(e,t,n);case`code`:return We(e);case`table`:return Ge(e,t);case`thematicBreak`:return Je();case`htmlBlock`:return Ye(e);case`math`:return Xe(e);case`footnoteDefinition`:return Ze(e,t);case`containerDirective`:return A(e.children,t);default:return``}}function ze(e,t){let n=Te[e.depth]??`Heading1`,r=N(e.children,t);return`<w:p><w:pPr><w:pStyle w:val="${n}"/></w:pPr>`+r+`</w:p>`}function Be(e,t){return`<w:p>${N(e.children,t,M(t))}</w:p>`}function M(e){return e.bodyColor?{color:e.bodyColor}:{}}function Ve(e,t){let n=[];for(let r of e.children)if(r.type===`paragraph`){let e=t.mutedColor?{color:t.mutedColor}:M(t),i=N(r.children,t,e);n.push(`<w:p><w:pPr><w:pStyle w:val="Quote"/><w:ind w:left="${Pe(36)}"/><w:pBdr><w:left w:val="single" w:sz="12" w:space="4" w:color="CCCCCC"/></w:pBdr></w:pPr>`+i+`</w:p>`)}else n.push(j(r,t,0));return n.join(``)}function He(e,t,n){let r=t.allocNumbering(e.ordered??!1),i=[];for(let a of e.children)i.push(Ue(a,t,r,n));return i.join(``)}function Ue(e,t,n,r){let i=[];for(let a of e.children)if(a.type===`paragraph`){let e=N(a.children,t,M(t));i.push(`<w:p><w:pPr><w:pStyle w:val="ListParagraph"/><w:numPr><w:ilvl w:val="${r}"/><w:numId w:val="${n}"/></w:numPr></w:pPr>`+e+`</w:p>`)}else a.type===`list`?i.push(He(a,t,r+1)):i.push(j(a,t,r));return i.join(``)}function We(e){let t=e.value.split(`
|
|
2
2
|
`),n=[];for(let e of t)n.push(`<w:p><w:pPr><w:pStyle w:val="Code"/><w:pBdr><w:top w:val="single" w:sz="4" w:space="1" w:color="CCCCCC"/><w:left w:val="single" w:sz="4" w:space="4" w:color="CCCCCC"/><w:bottom w:val="single" w:sz="4" w:space="1" w:color="CCCCCC"/><w:right w:val="single" w:sz="4" w:space="4" w:color="CCCCCC"/></w:pBdr><w:shd w:val="clear" w:color="auto" w:fill="F5F5F5"/></w:pPr><w:r><w:rPr><w:rFonts w:ascii="${D}" w:hAnsi="${D}"/><w:sz w:val="${O}"/></w:rPr><w:t xml:space="preserve">${w(e)}</w:t></w:r></w:p>`);return n.join(``)}function Ge(e,t){let n=[];for(let r=0;r<e.children.length;r++){let i=e.children[r];n.push(Ke(i,t,r===0,e.align))}return`<w:tbl><w:tblPr><w:tblStyle w:val="TableGrid"/><w:tblW w:w="0" w:type="auto"/><w:tblBorders><w:top w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:left w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:bottom w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:right w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:insideH w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:insideV w:val="single" w:sz="4" w:space="0" w:color="auto"/></w:tblBorders></w:tblPr><w:tblGrid/>`+n.join(``)+`</w:tbl>`}function Ke(e,t,n,r){let i=[];for(let a=0;a<e.children.length;a++){let o=e.children[a],s=r?.[a]??null;i.push(qe(o,t,n,s))}return`<w:tr>${n?`<w:trPr><w:tblHeader/></w:trPr>`:``}${i.join(``)}</w:tr>`}function qe(e,t,n,r){let i=N(e.children,t,M(t)),a=n?`<w:rPr><w:b/></w:rPr>`:``,o=r?`<w:jc w:val="${{left:`left`,center:`center`,right:`right`}[r]}"/>`:``;return`<w:tc><w:p>${a||o?`<w:pPr>${o}</w:pPr>`:``}${i}</w:p></w:tc>`}function Je(){return`<w:p><w:pPr><w:pBdr><w:bottom w:val="single" w:sz="6" w:space="1" w:color="auto"/></w:pBdr></w:pPr></w:p>`}function Ye(e){let t=de(e.rawHtml);return t.trim()?`<w:p><w:r><w:t xml:space="preserve">${w(t)}</w:t></w:r></w:p>`:``}function Xe(e){return`<w:p><w:pPr><w:jc w:val="center"/></w:pPr><w:r><w:rPr><w:rFonts w:ascii="Cambria Math" w:hAnsi="Cambria Math"/><w:i/></w:rPr><w:t xml:space="preserve">${w(e.value)}</w:t></w:r></w:p>`}function Ze(e,t){let n=t.getFootnoteId(e.identifier),r=[];for(let n of e.children)if(n.type===`paragraph`){let e=N(n.children,t,M(t));r.push(`<w:p>${e}</w:p>`)}let i=`<w:footnote w:id="${n}">`+(r.length>0?r.join(``):`<w:p/>`)+`</w:footnote>`;return t.footnotes.set(n,i),``}function Qe(e){return{run:(e,t)=>P(e,t),link:(t,n)=>tt(t,e,n),image:t=>it(t,e),icon:(t,n)=>et(t,n,e),lineBreak:()=>`<w:r><w:br/></w:r>`,footnoteRef:t=>ot(t,e)}}function N(e,t,n={}){return me(e,Qe(t),n)}function $e(e,t,n){return pe(e,Qe(t),n)}function P(e,t){if(!e)return``;let n=[];return t.code&&n.push(`<w:rFonts w:ascii="${D}" w:hAnsi="${D}"/>`),t.bold&&n.push(`<w:b/>`),t.italic&&n.push(`<w:i/>`),t.strike&&n.push(`<w:strike/>`),t.color&&n.push(`<w:color w:val="${t.color}"/>`),t.code&&n.push(`<w:sz w:val="${O}"/>`),t.vertAlign&&n.push(`<w:vertAlign w:val="${t.vertAlign}"/>`),`<w:r>${n.length>0?`<w:rPr>${n.join(``)}</w:rPr>`:``}<w:t xml:space="preserve">${w(e)}</w:t></w:r>`}function et(e,t,n){let r=xe(e.family,e.name);if(!r)return P(`{[${e.token}]}`,t);let i=Se(e.family);n.iconFamilies.add(e.family);let a=w(i.typeface),o=[`<w:rFonts w:ascii="${a}" w:hAnsi="${a}" w:eastAsia="${a}" w:cs="${a}"/>`];return t.strike&&o.push(`<w:strike/>`),t.color&&o.push(`<w:color w:val="${t.color}"/>`),`<w:r><w:rPr>${o.join(``)}</w:rPr><w:t xml:space="preserve">${w(r)}</w:t></w:r>`}function tt(e,t,n){let r=t.addHyperlink(e.url);return r?`<w:hyperlink r:id="${r}">${nt(e.children,t,n)}</w:hyperlink>`:N(e.children,t,n)}function nt(e,t,n){let r=[];for(let i of e)i.type===`text`?r.push(rt(i.value,n)):r.push($e(i,t,n));return r.join(``)}function rt(e,t){if(!e)return``;let n=[`<w:rStyle w:val="Hyperlink"/>`];return t.bold&&n.push(`<w:b/>`),t.italic&&n.push(`<w:i/>`),n.push(`<w:color w:val="${Ne}"/>`,`<w:u w:val="single"/>`),`<w:r><w:rPr>${n.join(``)}</w:rPr><w:t xml:space="preserve">${w(e)}</w:t></w:r>`}function it(e,t){let n=t.resolvedImages.get(e.url);if(!n)return P(`[Image: ${e.alt||e.url}]`,{italic:!0});let{data:r,contentType:i}=n,a=i.split(`/`)[1]?.replace(`jpeg`,`jpg`)||`png`,o=`image${t.images.length+1}.${a}`,{relId:s,docPrId:c}=t.addImage(r,i,o),l=at(r),u=914400,d=6*u,f,p;if(l){let e=l.width/96*u,t=l.height/96*u;if(e>d){let n=d/e;f=d,p=Math.round(t*n)}else f=Math.round(e),p=Math.round(t)}else f=5*u,p=3*u;let m=w(e.alt||o),h=`http://schemas.openxmlformats.org/drawingml/2006/main`,g=`http://schemas.openxmlformats.org/drawingml/2006/picture`;return`<w:r><w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${f}" cy="${p}"/><wp:docPr id="${c}" name="${m}"/><wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="${h}" noChangeAspect="1"/></wp:cNvGraphicFramePr><a:graphic xmlns:a="${h}"><a:graphicData uri="${g}"><pic:pic xmlns:pic="${g}"><pic:nvPicPr><pic:cNvPr id="0" name="${m}"/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${s}"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${f}" cy="${p}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></w:drawing></w:r>`}function at(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);if(t.length<24)return null;if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71)return{width:t[16]<<24|t[17]<<16|t[18]<<8|t[19],height:t[20]<<24|t[21]<<16|t[22]<<8|t[23]};if(t[0]===255&&t[1]===216){let e=2;for(;e<t.length-9&&t[e]===255;){let n=t[e+1];if(n===192||n===194){let n=t[e+5]<<8|t[e+6];return{width:t[e+7]<<8|t[e+8],height:n}}let r=t[e+2]<<8|t[e+3];e+=2+r}}return t[0]===71&&t[1]===73&&t[2]===70?{width:t[6]|t[7]<<8,height:t[8]|t[9]<<8}:null}function ot(e,t){return`<w:r><w:rPr><w:rStyle w:val="FootnoteReference"/><w:vertAlign w:val="superscript"/></w:rPr><w:footnoteReference w:id="${t.getFootnoteId(e.identifier)}"/></w:r>`}async function st(e,t,n,r,i){let a=_e(),d=Ce(r.iconFamilies),f=t.trim().length>0,h=n.trim().length>0,_=r.allocRelIdFor(`document`),ne=r.allocRelIdFor(`document`),v=r.allocRelIdFor(`document`),y=r.hasLists?r.allocRelIdFor(`document`):void 0,b=r.hasFootnotes?r.allocRelIdFor(`document`):void 0,x=f?r.allocRelIdFor(`document`):void 0,S=h?r.allocRelIdFor(`document`):void 0,de=ct(e,r.backgroundColor,x,S);a.addPart(`word/document.xml`,de,ae),f&&a.addPart(`word/header1.xml`,F(`header`,t),oe),h&&a.addPart(`word/footer1.xml`,F(`footer`,n),re);let C=lt(i,r);a.addPart(`word/styles.xml`,C,le);let w=dt(r.backgroundColor!==void 0);a.addPart(`word/settings.xml`,w,ie);let fe=ft(i,d);a.addPart(`word/fontTable.xml`,fe,se);for(let e=0;e<d.length;e++){let t=d[e],n=`${t.fileStem}.odttf`;a.addBinaryPart(`word/fonts/${n}`,be(t),te),a.addRelationship(`word/fontTable.xml`,{id:`rId${e+1}`,type:o,target:`fonts/${n}`})}if(r.hasLists){let e=pt(r);a.addPart(`word/numbering.xml`,e,ce)}if(r.hasFootnotes){let e=mt(r);a.addPart(`word/footnotes.xml`,e,ee)}a.addRelationship(``,{id:`rId1`,type:m,target:`word/document.xml`}),a.addRelationship(`word/document.xml`,{id:_,type:l,target:`styles.xml`}),a.addRelationship(`word/document.xml`,{id:ne,type:g,target:`settings.xml`}),a.addRelationship(`word/document.xml`,{id:v,type:c,target:`fontTable.xml`}),y&&a.addRelationship(`word/document.xml`,{id:y,type:s,target:`numbering.xml`}),b&&a.addRelationship(`word/document.xml`,{id:b,type:p,target:`footnotes.xml`}),x&&a.addRelationship(`word/document.xml`,{id:x,type:ue,target:`header1.xml`}),S&&a.addRelationship(`word/document.xml`,{id:S,type:u,target:`footer1.xml`});for(let e of r.relationships)a.addRelationship(k(e.source),{id:e.id,type:e.type,target:e.target,...e.targetMode?{targetMode:e.targetMode}:{}});for(let e of r.images)a.addBinaryPart(e.path,e.data,e.contentType);return(i.title||i.author||i.description)&&a.setCoreProperties({title:i.title,creator:i.author,description:i.description,created:new Date().toISOString(),modified:new Date().toISOString()}),a.toArrayBuffer()}function ct(e,t,n,r){let i=t?`<w:background w:color="${t}"/>`:``,o=(n?`<w:headerReference w:type="default" r:id="${n}"/>`:``)+(r?`<w:footerReference w:type="default" r:id="${r}"/>`:``);return C()+`<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="${a}" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="${y}" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="${d}" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml">`+i+`<w:body>`+e+`<w:sectPr>`+o+`<w:pgSz w:w="12240" w:h="15840"/><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/><w:cols w:space="720"/></w:sectPr></w:body></w:document>`}function F(e,t){let n=e===`header`?`hdr`:`ftr`;return C()+`<w:${n} xmlns:w="${d}" xmlns:r="${y}" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing">`+t+`</w:${n}>`}function lt(e,t){let n=t.font,r=t.headingFont,i=t.bodyColor?`<w:color w:val="${t.bodyColor}"/>`:``,a=t.mutedColor??`404040`;return C()+`<w:styles xmlns:w="${d}"><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii="${w(n)}" w:hAnsi="${w(n)}" w:eastAsia="${w(n)}" w:cs="${w(n)}"/>`+i+`<w:sz w:val="${E}"/><w:szCs w:val="${E}"/></w:rPr></w:rPrDefault><w:pPrDefault/></w:docDefaults><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/>`+(i?`<w:rPr>${i}</w:rPr>`:``)+`</w:style>`+ut(r,t.headingColor)+`<w:style w:type="paragraph" w:styleId="Quote"><w:name w:val="Quote"/><w:basedOn w:val="Normal"/><w:pPr><w:ind w:left="720"/></w:pPr><w:rPr><w:i/><w:color w:val="${a}"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Code"><w:name w:val="Code"/><w:basedOn w:val="Normal"/><w:rPr><w:rFonts w:ascii="${D}" w:hAnsi="${D}"/><w:sz w:val="${O}"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="ListParagraph"><w:name w:val="List Paragraph"/><w:basedOn w:val="Normal"/><w:pPr><w:ind w:left="720"/></w:pPr></w:style><w:style w:type="character" w:styleId="Hyperlink"><w:name w:val="Hyperlink"/><w:rPr><w:color w:val="${Ne}"/><w:u w:val="single"/></w:rPr></w:style><w:style w:type="character" w:styleId="FootnoteReference"><w:name w:val="footnote reference"/><w:rPr><w:vertAlign w:val="superscript"/></w:rPr></w:style><w:style w:type="table" w:styleId="TableGrid"><w:name w:val="Table Grid"/><w:tblPr><w:tblBorders><w:top w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:left w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:bottom w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:right w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:insideH w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:insideV w:val="single" w:sz="4" w:space="0" w:color="auto"/></w:tblBorders></w:tblPr></w:style></w:styles>`}function ut(e,t){let n=``;for(let r=1;r<=6;r++){let i=Te[r],a=Me[r]??22,o=t?`<w:color w:val="${t}"/>`:``;n+=`<w:style w:type="paragraph" w:styleId="${i}"><w:name w:val="heading ${r}"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:outlineLvl w:val="${r-1}"/><w:spacing w:before="240" w:after="60"/></w:pPr><w:rPr><w:rFonts w:ascii="${w(e)}" w:hAnsi="${w(e)}"/><w:b/>`+o+`<w:sz w:val="${a}"/><w:szCs w:val="${a}"/></w:rPr></w:style>`}return n}function dt(e){return C()+`<w:settings xmlns:w="${d}">`+(e?`<w:displayBackgroundShape/>`:``)+`<w:defaultTabStop w:val="720"/><w:characterSpacingControl w:val="doNotCompress"/><w:compat><w:compatSetting w:name="compatibilityMode" w:uri="http://schemas.microsoft.com/office/word" w:val="15"/><w:compatSetting w:name="overrideTableStyleFontSizeAndJustification" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/><w:compatSetting w:name="enableOpenTypeFeatures" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/><w:compatSetting w:name="doNotFlipMirrorIndents" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/><w:compatSetting w:name="differentiateMultirowTableHeaders" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/></w:compat></w:settings>`}function ft(e,t){let n=e.defaultFont??Ae,r=t.map((e,t)=>`<w:font w:name="${w(e.typeface)}"><w:charset w:val="00"/><w:family w:val="decorative"/><w:pitch w:val="variable"/><w:embedRegular r:id="rId${t+1}" w:fontKey="{${e.docxFontKey}}"/></w:font>`).join(``);return C()+`<w:fonts xmlns:w="${d}" xmlns:r="${y}"><w:font w:name="${w(n)}"><w:panose1 w:val="020F0502020204030204"/><w:charset w:val="00"/><w:family w:val="swiss"/><w:pitch w:val="variable"/></w:font><w:font w:name="${je}"><w:panose1 w:val="020F0302020204030204"/><w:charset w:val="00"/><w:family w:val="swiss"/><w:pitch w:val="variable"/></w:font><w:font w:name="${D}"><w:charset w:val="00"/><w:family w:val="modern"/><w:pitch w:val="fixed"/></w:font>`+r+`</w:fonts>`}function pt(e){let t=[],n=[];for(let r of e.numberingDefs){let e=r.numId,i=[];for(let e=0;e<9;e++)if(r.ordered)i.push(`<w:lvl w:ilvl="${e}"><w:start w:val="1"/><w:numFmt w:val="decimal"/><w:lvlText w:val="%${e+1}."/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${720*(e+1)}" w:hanging="360"/></w:pPr></w:lvl>`);else{let t=[`•`,`◦`,`▪`],n=t[e%t.length];i.push(`<w:lvl w:ilvl="${e}"><w:start w:val="1"/><w:numFmt w:val="bullet"/><w:lvlText w:val="${n}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${720*(e+1)}" w:hanging="360"/></w:pPr></w:lvl>`)}t.push(`<w:abstractNum w:abstractNumId="${e}">`+i.join(``)+`</w:abstractNum>`),n.push(`<w:num w:numId="${r.numId}"><w:abstractNumId w:val="${e}"/></w:num>`)}return C()+`<w:numbering xmlns:w="${d}">`+t.join(``)+n.join(``)+`</w:numbering>`}function mt(e){let t=[];t.push(`<w:footnote w:type="separator" w:id="-1"><w:p><w:r><w:separator/></w:r></w:p></w:footnote>`),t.push(`<w:footnote w:type="continuationSeparator" w:id="0"><w:p><w:r><w:continuationSeparator/></w:r></w:p></w:footnote>`);for(let[n,r]of e.footnotes)t.push(r);return C()+`<w:footnotes xmlns:w="${d}" xmlns:r="${y}">`+t.join(``)+`</w:footnotes>`}var I=`word/document.xml`;async function ht(e,t={}){let n=await x(e,t),r=v(n,I,`DOCX`),i=await _t(n,t,r),a=await b(n,r);if(!a)throw Error(`Invalid DOCX package: main document part "${r}" could not be parsed.`);let o=Lt(a,`body`);if(!o)return{type:`document`,children:[]};let s={type:`document`,children:await L(o,i)};return ve(s),s}async function gt(e,t={}){let n=await x(e,t),i=v(n,I,`DOCX`),a=await _t(n,{...t,extractImages:!0},i),o=await b(n,i);if(!o)throw Error(`Invalid DOCX package: main document part "${i}" could not be parsed.`);let s=Lt(o,`body`);return s?ye(r({type:`document`,children:await L(s,a)}),a.extractedImages):ye(``,[])}async function _t(e,t,n=I){let r={headingStyles:new Map,quoteStyles:new Set,codeStyles:new Set,inlineCodeStyles:new Set,documentRels:new Map,numbering:new Map,footnotes:new Map,endnotes:new Map,currentPartPath:n,mainPartPath:n,pkg:e,options:t,extractedImages:new Map,imageCounter:0};for(let[e,t]of Object.entries(we))r.headingStyles.set(e,t);for(let e of Ee)r.quoteStyles.add(e);for(let e of De)r.codeStyles.add(e);for(let e of Oe)r.inlineCodeStyles.add(e);await vt(e,r);let i=await S(e,n);for(let e of i)r.documentRels.set(e.id,e);return await yt(e,r),await bt(e,r),await xt(e,r),r}async function vt(e,t){let n=await b(e,`word/styles.xml`);if(!n)return;let r=n.getElementsByTagNameNS(d,`style`),i=r.length>0?r:n.getElementsByTagName(`style`);for(let e=0;e<i.length;e++){let n=i[e],r=n.getAttributeNS(`http://schemas.openxmlformats.org/wordprocessingml/2006/main`,`styleId`)??n.getAttribute(`w:styleId`);if(!r)continue;let a=J(n,`name`),o=(a?.getAttributeNS(`http://schemas.openxmlformats.org/wordprocessingml/2006/main`,`val`)??a?.getAttribute(`w:val`)??``).match(/^heading\s+(\d+)$/i);if(o){let e=parseInt(o[1],10);e>=1&&e<=6&&t.headingStyles.set(r,e)}let s=J(n,`pPr`);if(s){let e=J(s,`outlineLvl`);if(e){let n=e.getAttributeNS(`http://schemas.openxmlformats.org/wordprocessingml/2006/main`,`val`)??e.getAttribute(`w:val`);if(n!==null){let e=parseInt(n,10)+1;e>=1&&e<=6&&t.headingStyles.set(r,e)}}}}}async function yt(e,t){let n=await b(e,`word/numbering.xml`);if(!n)return;let r=new Map,i=X(n,`abstractNum`);for(let e of i){let t=Z(e,`abstractNumId`);if(!t)continue;let n=new Map,i=Y(e,`lvl`);for(let e of i){let t=Z(e,`ilvl`);if(t===null)continue;let r=parseInt(t,10),i=J(e,`numFmt`),a=i?Z(i,`val`):null,o=a!==null&&!ke.has(a);n.set(r,o)}r.set(t,n)}let a=X(n,`num`);for(let e of a){let n=Z(e,`numId`);if(!n)continue;let i=J(e,`abstractNumId`),a=i?Z(i,`val`):null;if(!a)continue;let o=r.get(a);o&&t.numbering.set(n,{levels:o})}}async function bt(e,t){let n=await b(e,`word/footnotes.xml`);if(!n)return;let r=X(n,`footnote`);for(let e of r){let n=Z(e,`id`),r=Z(e,`type`);!n||r===`separator`||r===`continuationSeparator`||t.footnotes.set(n,e)}}async function xt(e,t){let n=await b(e,`word/endnotes.xml`);if(!n)return;let r=X(n,`endnote`);for(let e of r){let n=Z(e,`id`),r=Z(e,`type`);!n||r===`separator`||r===`continuationSeparator`||t.endnotes.set(n,e)}}async function L(e,t){let n=await z(e,t),r=await R(e,t,`header`),i=await R(e,t,`footer`),a=await Ft(t);return[...n,...r,...i,...a]}async function R(e,t,n){let r=`/${n}`,i=`${n}Reference`,a=new Map;for(let t of X(e,i)){let e=t.getAttributeNS(`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,`id`)??t.getAttribute(`r:id`);e&&a.set(e,Z(t,`type`)??`default`)}let o=t.documentRels,s=t.currentPartPath,c=[];for(let e of o.values()){if(!e.type.endsWith(r))continue;let i=_(f(t.mainPartPath),e.target),l=await b(t.pkg,i);if(!l?.documentElement)continue;let u=await S(t.pkg,i);t.documentRels=new Map(u.map(e=>[e.id,e])),t.currentPartPath=i;try{let r=await z(l.documentElement,t);if(r.length===0)continue;c.push({type:`containerDirective`,name:`docx-${n}`,attributes:{type:a.get(e.id)??`default`,source:i},children:r})}finally{t.documentRels=o,t.currentPartPath=s}}return c}async function z(e,t){return B(Array.from(e.children),t)}async function B(e,t){let n=[],r=0;for(;r<e.length;){let i=e[r],a=i.localName;if(a===`p`){if(q(i)){let{node:i,consumed:a}=await At(e,r,t);n.push(i),r+=a;continue}let a=await St(i,t);a&&n.push(a),r++}else if(a===`tbl`){let e=await Mt(i,t);e&&n.push(e),r++}else if(a===`sdt`){let e=J(i,`sdtContent`);e&&n.push(...await B(Array.from(e.children),t)),r++}else if(a===`ins`||a===`moveTo`||a===`customXml`||a===`smartTag`||a===`fldSimple`)n.push(...await B(Array.from(i.children),t)),r++;else if(a===`AlternateContent`){let e=J(i,`Choice`)??J(i,`Fallback`);e&&n.push(...await B(Array.from(e.children),t)),r++}else r++}return n}async function St(e,t){let n=Rt(J(e,`pPr`));if(n&&t.headingStyles.has(n)){let r=t.headingStyles.get(n),i=await V(e,t);return i.length===0?null:{type:`heading`,depth:Math.min(Math.max(r,1),6),children:i}}if(n&&t.quoteStyles.has(n)){let n=await V(e,t);return n.length===0?null:{type:`blockquote`,children:[{type:`paragraph`,children:n}]}}if(n&&t.codeStyles.has(n))return{type:`code`,value:zt(e)};let r=await V(e,t);return r.length===0?null:{type:`paragraph`,children:r}}async function V(e,t){return Vt(await H(Array.from(e.children),t))}async function H(e,t){let n=[];for(let r of e){let e=r.localName;if(e===`r`){let e=await Ct(r,t);n.push(...e)}else if(e===`hyperlink`){let e=await Dt(r,t);e&&n.push(e)}else if(e===`sdt`){let e=J(r,`sdtContent`);e&&n.push(...await H(Array.from(e.children),t))}else if(e===`ins`||e===`moveTo`||e===`customXml`||e===`smartTag`||e===`fldSimple`)n.push(...await H(Array.from(r.children),t));else if(e===`AlternateContent`){let e=J(r,`Choice`)??J(r,`Fallback`);e&&n.push(...await H(Array.from(e.children),t))}else(e===`drawing`||e===`pict`)&&n.push(...await wt(r,t))}return n}async function Ct(e,t){let n=[],r=Et(J(e,`rPr`),t);for(let i of Array.from(e.children)){let e=i.localName;if(e===`t`){let e=i.textContent??``;if(!e)continue;if(r.code)n.push({type:`inlineCode`,value:e});else{let t={type:`text`,value:e};r.vertAlign&&(t=r.vertAlign===`superscript`?{type:`superscript`,children:[t]}:{type:`subscript`,children:[t]}),r.strike&&(t={type:`delete`,children:[t]}),r.italic&&(t={type:`emphasis`,children:[t]}),r.bold&&(t={type:`strong`,children:[t]}),n.push(t)}}else if(e===`br`||e===`cr`)n.push({type:`break`});else if(e===`tab`)n.push({type:`text`,value:` `});else if(e===`footnoteReference`){let e=Z(i,`id`);e&&e!==`0`&&e!==`-1`&&n.push({type:`footnoteReference`,identifier:`fn${e}`})}else if(e===`endnoteReference`){let e=Z(i,`id`);e&&e!==`0`&&e!==`-1`&&n.push({type:`footnoteReference`,identifier:`endnote${e}`})}else if(e===`drawing`||e===`pict`||e===`object`)n.push(...await wt(i,t));else if(e===`AlternateContent`){let e=J(i,`Choice`)??J(i,`Fallback`);e&&n.push(...await H(Array.from(e.children),t))}}return n}async function wt(e,t){let n=[],r=kt(e,`txbxContent`);for(let e of r)W(n,await U(e,t));let i=await Ot(e,t);return i&&n.push(i),r.length>0&&n.length>0&&(n[0]?.type!==`break`&&n.unshift({type:`break`}),n[n.length-1]?.type!==`break`&&n.push({type:`break`})),n}async function U(e,t){let n=[];for(let r of Array.from(e.children))if(r.localName===`p`)W(n,await V(r,t));else if(r.localName===`tbl`)W(n,await Tt(r,t));else if(r.localName===`sdt`){let e=J(r,`sdtContent`);e&&W(n,await U(e,t))}else if(r.localName===`ins`||r.localName===`moveTo`||r.localName===`customXml`||r.localName===`smartTag`||r.localName===`fldSimple`)W(n,await U(r,t));else if(r.localName===`AlternateContent`){let e=J(r,`Choice`)??J(r,`Fallback`);e&&W(n,await U(e,t))}else(r.localName===`r`||r.localName===`hyperlink`)&&W(n,await H([r],t));return $(n)}async function Tt(e,t){let n=[];for(let r of Y(e,`tr`))for(let e of Y(r,`tc`))W(n,await U(e,t));return $(n)}function W(e,t){t.length!==0&&(e.length>0&&e[e.length-1]?.type!==`break`&&e.push({type:`break`}),e.push(...t))}function Et(e,t){if(!e)return{bold:!1,italic:!1,strike:!1,code:!1,vertAlign:null};let n=Q(e,`b`)&&!G(J(e,`b`)),r=Q(e,`i`)&&!G(J(e,`i`)),i=Q(e,`strike`)&&!G(J(e,`strike`)),a=J(e,`rStyle`),o=a?Z(a,`val`):null,s=o?t.inlineCodeStyles.has(o):!1,c=J(e,`rFonts`),l=c?Z(c,`ascii`)??Z(c,`hAnsi`)??``:``,u=/consolas|courier|mono/i.test(l),d=J(e,`vertAlign`),f=d?Z(d,`val`):null;return{bold:n,italic:r,strike:i,code:s||u,vertAlign:f===`superscript`||f===`subscript`?f:null}}function G(e){let t=Z(e,`val`);return t===`0`||t===`false`}async function Dt(e,t){let n=e.getAttributeNS(`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,`id`)??e.getAttribute(`r:id`),r=``;if(n){let e=t.documentRels.get(n);e&&(r=e.target)}if(!r){let t=e.getAttributeNS(`http://schemas.openxmlformats.org/wordprocessingml/2006/main`,`anchor`)??e.getAttribute(`w:anchor`);t&&(r=`#${t}`)}let i=await H(Array.from(e.children),t);return i.length===0?null:{type:`link`,url:r,children:$(i)}}async function Ot(e,t){let n=K(e,`blip`),r=K(e,`imagedata`),i=n?n.getAttributeNS(`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,`embed`)??n.getAttribute(`r:embed`):r?.getAttributeNS(`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,`id`)??r?.getAttribute(`r:id`)??r?.getAttribute(`o:relid`);if(!i)return null;let a=t.documentRels.get(i);if(!a||a.targetMode===`External`)return null;let o=_(f(t.currentPartPath),a.target),s=await ne(t.pkg,o);if(!s)return null;let c=o.lastIndexOf(`.`),l=c===-1?`.png`:o.slice(c).toLowerCase(),u=ge(l);t.imageCounter++;let d=`images/image${t.imageCounter}${l}`;t.extractedImages.set(d,{data:s,mimeType:u});let p=K(e,`docPr`),m=K(e,`shape`);return{type:`image`,url:d,alt:p?.getAttribute(`descr`)||p?.getAttribute(`title`)||m?.getAttribute(`alt`)||m?.getAttribute(`title`)||`Image`}}function K(e,t){for(let n of Array.from(e.children)){if(n.localName===t)return n;let e=K(n,t);if(e)return e}return null}function kt(e,t){let n=[];for(let r of Array.from(e.children))r.localName===t&&n.push(r),n.push(...kt(r,t));return n}async function At(e,t,n){let r=q(e[t]),{numId:i}=r,a=n.numbering.get(i),o=a?.levels.get(0)??!1,s=[],c=0,l=t;for(;l<e.length;){let t=e[l];if(t.localName!==`p`)break;let o=q(t);if(!o||o.numId!==i)break;let u=await V(t,n);if(u.length>0){let t={type:`paragraph`,children:u};if(o.ilvl>r.ilvl){let t=await jt(e,l,n,r.ilvl);if(s.length>0){let e=s[s.length-1],n={type:`list`,ordered:a?.levels.get(o.ilvl)??!1,children:t.items};e.children.push(n)}else s.push(...t.items);l+=t.consumed,c+=t.consumed;continue}s.push({type:`listItem`,children:[t]})}l++,c++}return{node:{type:`list`,ordered:o,children:s},consumed:c}}async function jt(e,t,n,r){let i=[],a=0,o=t;for(;o<e.length;){let t=e[o];if(t.localName!==`p`)break;let s=q(t);if(!s||s.ilvl<=r)break;let c=await V(t,n);if(c.length>0){let e={type:`paragraph`,children:c};i.push({type:`listItem`,children:[e]})}o++,a++}return{items:i,consumed:a}}function q(e){let t=J(e,`pPr`);if(!t)return null;let n=J(t,`numPr`);if(!n)return null;let r=J(n,`ilvl`),i=J(n,`numId`),a=r?Z(r,`val`):null,o=i?Z(i,`val`):null;return!o||o===`0`?null:{numId:o,ilvl:a?parseInt(a,10):0}}async function Mt(e,t){let n=[],r=Y(e,`tr`);for(let e=0;e<r.length;e++){let i=await Nt(r[e],t,e===0);n.push(i)}return n.length===0?null:{type:`table`,children:n}}async function Nt(e,t,n){let r=[],i=Y(e,`tc`);for(let e of i){let i=await Pt(e,t,n);r.push(i)}return{type:`tableRow`,children:r}}async function Pt(e,t,n){return{type:`tableCell`,isHeader:n,children:$(await U(e,t))}}async function Ft(e){return[...await It(e,e.footnotes,`fn`,`word/footnotes.xml`),...await It(e,e.endnotes,`endnote`,`word/endnotes.xml`)]}async function It(e,t,n,r){let i=[],a=e.documentRels,o=e.currentPartPath,s=await S(e.pkg,r);e.documentRels=new Map(s.map(e=>[e.id,e])),e.currentPartPath=r;try{for(let[r,a]of t){let t=await z(a,e);t.length>0&&i.push({type:`footnoteDefinition`,identifier:`${n}${r}`,children:t})}}finally{e.documentRels=a,e.currentPartPath=o}return i}function J(e,t){for(let n of Array.from(e.children??[]))if(n.localName===t)return n;return null}function Y(e,t){let n=[];for(let r of Array.from(e.children))r.localName===t&&n.push(r);return n}function X(e,t){let n=`getElementsByTagNameNS`in e?e.getElementsByTagNameNS(d,t):null;if(n&&n.length>0)return Array.from(n);let r=e.getElementsByTagName(`w:${t}`);return r.length>0?Array.from(r):Array.from(e.getElementsByTagName(t))}function Lt(e,t){let n=X(e,t);return n.length>0?n[0]:null}function Z(e,t){return e.getAttributeNS(`http://schemas.openxmlformats.org/wordprocessingml/2006/main`,t)||e.getAttribute(`w:${t}`)||null}function Q(e,t){return J(e,t)!==null}function Rt(e){if(!e)return null;let t=J(e,`pStyle`);return t?Z(t,`val`):null}function zt(e){let t=[];function n(e){e.localName===`t`&&t.push(e.textContent??``);for(let t of Array.from(e.children))n(t)}return n(e),t.join(``)}function $(e){if(e.length<=1)return e;let t=[];for(let n of e){let e=t[t.length-1];n.type===`text`&&e?.type===`text`?e.value+=n.value:t.push(n)}return t}function Bt(e){return e.type===`emphasis`||e.type===`strong`||e.type===`delete`||e.type===`superscript`||e.type===`subscript`||e.type===`link`}function Vt(e){let t=[],n=[],r=()=>{let e=Ht(n);Ut(e),Wt(e),t.push(...$(e)),n=[]};for(let i of e)i.type===`break`?(r(),t.push(i)):n.push(i);return r(),t}function Ht(e){let t=[];for(let n of e){if(!Bt(n)){t.push(n);continue}let e=Ht(n.children),r=Ut(e),i=Wt(e);r&&t.push({type:`text`,value:r}),e.length>0&&t.push({...n,children:e}),i&&t.push({type:`text`,value:i})}return $(t)}function Ut(e){let t=e[0];if(t?.type!==`text`)return``;let n=/^[\t ]+/.exec(t.value);return n?(t.value=t.value.slice(n[0].length),t.value||e.shift(),n[0]):``}function Wt(e){let t=e[e.length-1];if(t?.type!==`text`)return``;let n=/[\t ]+$/.exec(t.value);return n?(t.value=t.value.slice(0,-n[0].length),t.value||e.pop(),n[0]):``}export{gt as docxToContainer,ht as docxToMarkdownDoc,Fe as markdownDocToDocx};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{I as t}from"./doc-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{I as t}from"./doc-BHcGsJZd.js";import{l as n}from"./chunk-X7BNDUNI-D14WIvlD.js";import{O as r}from"./chunk-GAZKTT4R-w1SNypWQ.js";import{I as i}from"./chunk-CW24CH7I-BD0FIooX.js";import"./markdown-CLKH_zzl.js";import"./schemas-BvLZUsGm.js";import{t as a}from"./jszip.min-DhiFe-R7.js";import{r as o,t as s}from"./chunk-JU2RHXUB-ClblWDJZ.js";import{n as c,t as l}from"./chunk-BXWNU4T5-CFA9w1DZ.js";import{i as u,r as d,t as f}from"./chunk-USU6HTKB-DyGZplh4.js";import{n as p,r as m}from"./chunk-VPWPEMZJ-DRKoa_j0.js";var h=e(a(),1);async function g(e,t={}){t.signal?.throwIfAborted();let r=e.frontmatter?.title,i=e.frontmatter?.author,a=t.title??(typeof r==`string`?r:`Untitled`),o=t.author??(typeof i==`string`?i:``),c=t.language??`en`,u=t.description??``,p=t.publisher??``,g=O(),v=d(f(e)),x=_(e.children),C=new l(e),w=new Set;b(e.children,w);let T=C.ordered().filter(e=>e.definition&&!w.has(e.identifier)).map(e=>e.identifier),E=y(e.children),D=new Map,A=new Set;if(t.images){let e=0;for(let n of E){e++&63||t.signal?.throwIfAborted();let r=t.images.get(n);if(r){let e=j(k(n,`image`),A);A.add(e),D.set(n,{data:r,mime:m(e),filename:e})}}}let N=L(t.themeId??n(e.frontmatter),e,t.themeRegistry,v),R=new h.default;R.file(`mimetype`,`application/epub+zip`,{compression:`STORE`}),R.file(`META-INF/container.xml`,P),R.file(`OEBPS/styles.css`,N);for(let e of v)R.file(`OEBPS/fonts/${e.fileStem}.otf`,e.data);for(let[,e]of D)t.signal?.throwIfAborted(),R.file(`OEBPS/images/${e.filename}`,e.data);let z;if(t.coverImage){let e=new Uint8Array(t.coverImage);z=j(e.length>=4&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71?`cover.png`:`cover.jpg`,A),A.add(z),R.file(`OEBPS/images/${z}`,t.coverImage);let n=`<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<!DOCTYPE html>
|
|
3
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
|
|
4
4
|
<head>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./api-
|
|
1
|
+
import{t as e}from"./api-CmrgM5Rf.js";function t(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)}var n={docx:`Word Document (.docx)`,pdf:`PDF (.pdf)`,pptx:`PowerPoint (.pptx)`,md:`Markdown (.md)`,html:`HTML (.html)`},r={docx:`.docx`,pdf:`.pdf`,pptx:`.pptx`,md:`.md`,html:`.html`},i=`gezel-export-options`,a={format:`pdf`,themeId:`standard`,transformStyle:`documentary`,pageSize:`letter`,htmlStyle:`plain`,htmlBundle:`single`},o=new Set([`docx`,`pdf`,`pptx`,`md`,`html`]),s=new Set([`letter`,`a4`]),c=new Set([`rendered`,`plain`]),l=new Set([`single`,`zip`]);function u(e){if(!e||typeof e!=`object`)return null;let t=e;if(!t.format||!o.has(t.format))return null;let n={...a,...t};return typeof n.themeId!=`string`||!n.themeId||typeof n.transformStyle!=`string`||!n.transformStyle||!s.has(n.pageSize)||!c.has(n.htmlStyle)||!l.has(n.htmlBundle)?null:n}function d(e){try{localStorage.setItem(i,JSON.stringify(e))}catch{}}function f(){try{let e=localStorage.getItem(i);return e?u(JSON.parse(e)):null}catch{return null}}async function p(t){d(t),await e.updateConfig({documentExportOptions:t}).catch(()=>{})}async function m(){let t=f();try{let n=u((await e.getConfig()).documentExportOptions);return n?(d(n),n):t}catch{return t}}export{p as a,f as i,r as n,m as o,n as r,t as s,a as t};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ironcalc-BAi5gOlE.js","assets/preload-helper-Czpn1I53.js","assets/run-export-TscWwR6y.js","assets/chunk-CW24CH7I-BD0FIooX.js","assets/rolldown-runtime-aKtaBQYM.js","assets/chunk-X7BNDUNI-D14WIvlD.js","assets/chunk-4VOD55SX-BFSSw0c8.js","assets/markdown-CLKH_zzl.js","assets/export-options-Dylv69b3.js","assets/api-CmrgM5Rf.js","assets/dist-BMZhqfv7.js","assets/dist-CE5CbmDb.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{t as r}from"./react-dom-OL4w_gzs.js";import{t as i}from"./api-CmrgM5Rf.js";import{H as a,J as o,K as s,U as c,W as l,Y as u,q as d}from"./primitives-CWrGZpPI.js";import{C as f,S as p,_ as m,b as h,d as g,g as _,n as v,r as y,t as b,v as x,w as S,x as C}from"./NewPathDialog-BhAZm9dp.js";import{l as w,n as T,o as E,r as D,s as O}from"./DropdownMenu-DlrvEmoV.js";import{t as k}from"./relative-time-B2kBaekd.js";import{t as A}from"./ConfirmDialog-Dt1ed4Fh.js";import{t as j}from"./chunk-X7BNDUNI-D14WIvlD.js";import{v as M}from"./chunk-GAZKTT4R-w1SNypWQ.js";import{n as N}from"./chunk-CW24CH7I-BD0FIooX.js";import"./markdown-CLKH_zzl.js";import"./schemas-BvLZUsGm.js";import{t as P}from"./preload-helper-Czpn1I53.js";import{l as F,r as I}from"./styles-CqO-rmOt.js";import{s as L}from"./chunk-ZSU5DJLX-CrjQf-vs.js";import{D as R,f as z,h as B,m as ee,p as V}from"./index-DivKnJyx.js";import"./transform-DxJCwK68.js";import{a as H,i as U,n as te,o as W,r as ne,s as re,t as G}from"./export-options-Dylv69b3.js";import"./SquisqIntegration-BTZ1kBlg.js";import{c as K,o as ie}from"./outside-in-Msmhxf_U.js";import{n as ae}from"./document-import-B2Ya6sbf.js";function oe(e){return e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}function q(e){try{return e.split(`/`).map(e=>decodeURIComponent(e)).join(`/`)}catch{return e}}function se(e){let t={mutationLock:e.mutationLock??e,readFile:t=>e.readFile(q(t)),writeFile:(t,n,r)=>e.writeFile(q(t),n,r),removeFile:t=>e.removeFile(q(t)),async listFiles(t){return(await e.listFiles(t?q(t):void 0)).map(e=>({...e,path:oe(e.path)}))},exists:t=>e.exists(q(t)),async getDocumentPath(){let t=await e.getDocumentPath();return t===null?null:oe(t)},async readDocument(){let e=await t.getDocumentPath();if(e===null)return null;let n=await t.readFile(e);return n===null?null:new TextDecoder().decode(n)},writeDocument:(t,n)=>e.writeDocument(t,n?q(n):void 0)};return e.writeFileExclusive&&(t.writeFileExclusive=(t,n,r)=>e.writeFileExclusive(q(t),n,r)),t}function ce(e,t){let n=e.replace(/\/[^/]*$/,``);return n&&t.startsWith(`${n}/`)?t.slice(n.length+1):t}function le(e){let{client:t,currentDocumentPath:n,limit:r=20,source:i=`documents`,projectId:a}=e;return async e=>{let o=e.trim().toLowerCase();try{return(i===`project-artifacts`&&a?await t.listProjectArtifacts(a,void 0,!0):await t.listDocuments(void 0,!0)).files.filter(e=>!e.isDirectory).filter(e=>e.path!==n).filter(e=>/\.(md|markdown|mdx|txt)$/i.test(e.name)).filter(e=>!o||e.name.toLowerCase().includes(o)||e.path.toLowerCase().includes(o)).slice(0,r).map(e=>({path:ce(n,e.path),label:e.name.replace(/\.(md|markdown|mdx|txt)$/i,``),description:e.path}))}catch{return[]}}}var ue=`/assets/wasm_bg-DW9Xt_vt.wasm`,de=async e=>{let{createIronCalcEngine:t}=await P(async()=>{let{createIronCalcEngine:e}=await import(`./ironcalc-BAi5gOlE.js`);return{createIronCalcEngine:e}},__vite__mapDeps([0,1]));return t({...e,wasmSource:ue})},J=e(t(),1),Y=n(),fe=[`pdf`,`docx`,`pptx`,`html`,`md`],pe={pdf:`PDF`,docx:`Word`,pptx:`PowerPoint`,html:`HTML`,md:`Markdown`},me=[{key:`plain`,label:`Plain`,hint:`A lightweight static HTML document.`},{key:`rendered`,label:`Rendered`,hint:`Renders via SquisqPlayer with themes and playback support.`}],he=[{key:`single`,label:`Single file`,hint:`One .html file with images embedded as base64 data URIs.`},{key:`zip`,label:`ZIP archive`,hint:`A .zip with index.html plus separate image (and JS) files.`}];function ge({name:e,value:t,options:n,onChange:r}){return(0,Y.jsx)(`fieldset`,{className:`gezel-export-choice-tray gz-tray`,"aria-label":e,children:n.map(n=>{let i=n.key===t;return(0,Y.jsxs)(`label`,{className:`gz-key${i?` gz-key-active`:``}`,title:n.title,children:[(0,Y.jsx)(`input`,{type:`radio`,className:`gezel-export-choice-radio`,name:e,value:n.key,checked:i,onChange:()=>r(n.key)}),n.label]},n.key)})})}function _e({initial:e,exporting:t,error:n=null,onExport:r,onClose:i}){let[f,p]=(0,J.useState)(e.format),[m,h]=(0,J.useState)(e.themeId),[g,_]=(0,J.useState)(e.transformStyle),[v,y]=(0,J.useState)(e.pageSize),[b,x]=(0,J.useState)(e.htmlStyle),[S,C]=(0,J.useState)(e.htmlBundle),w=M(),T=L(),E=f===`docx`||f===`pdf`||f===`pptx`||f===`html`&&b===`rendered`,D=f===`pptx`,O=f===`pdf`,k=f===`html`,A=(0,J.useCallback)(e=>{e.preventDefault(),r({format:f,themeId:m,transformStyle:g,pageSize:v,htmlStyle:b,htmlBundle:S})},[f,m,g,v,b,S,r]);return(0,Y.jsx)(o,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Y.jsxs)(d,{children:[(0,Y.jsx)(s,{}),(0,Y.jsx)(l,{className:`gezel-export-dialog`,children:(0,Y.jsxs)(`form`,{onSubmit:A,children:[(0,Y.jsxs)(`div`,{className:`gezel-export-dialog-header`,children:[(0,Y.jsx)(u,{children:`Export document`}),(0,Y.jsx)(c,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,className:`gezel-export-dialog-close`,"aria-label":`Close`,children:`×`})})]}),(0,Y.jsxs)(`div`,{className:`gezel-export-dialog-body`,children:[(0,Y.jsxs)(`div`,{className:`gezel-export-field`,children:[(0,Y.jsx)(`span`,{className:`gezel-export-label`,children:`Format`}),(0,Y.jsx)(ge,{name:`Format`,value:f,options:fe.map(e=>({key:e,label:pe[e],title:ne[e]})),onChange:p})]}),k&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`gezel-export-field`,children:[(0,Y.jsx)(`span`,{className:`gezel-export-label`,children:`Style`}),(0,Y.jsx)(ge,{name:`Style`,value:b,options:me,onChange:x}),(0,Y.jsx)(`span`,{className:`gezel-export-hint`,children:me.find(e=>e.key===b)?.hint})]}),(0,Y.jsxs)(`div`,{className:`gezel-export-field`,children:[(0,Y.jsx)(`span`,{className:`gezel-export-label`,children:`Bundle`}),(0,Y.jsx)(ge,{name:`Bundle`,value:S,options:he,onChange:C}),(0,Y.jsx)(`span`,{className:`gezel-export-hint`,children:he.find(e=>e.key===S)?.hint})]})]}),E&&(0,Y.jsxs)(`div`,{className:`gezel-export-field`,children:[(0,Y.jsx)(`label`,{className:`gezel-export-label`,htmlFor:`gezel-export-theme`,children:`Theme`}),(0,Y.jsx)(`select`,{id:`gezel-export-theme`,className:`gezel-export-select`,value:m,onChange:e=>h(e.target.value),children:w.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,Y.jsx)(`span`,{className:`gezel-export-hint`,children:w.find(e=>e.id===m)?.description})]}),D&&(0,Y.jsxs)(`div`,{className:`gezel-export-field`,children:[(0,Y.jsx)(`label`,{className:`gezel-export-label`,htmlFor:`gezel-export-transform`,children:`Transform`}),(0,Y.jsx)(`select`,{id:`gezel-export-transform`,className:`gezel-export-select`,value:g,onChange:e=>_(e.target.value),children:T.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,Y.jsx)(`span`,{className:`gezel-export-hint`,children:T.find(e=>e.id===g)?.description})]}),O&&(0,Y.jsxs)(`div`,{className:`gezel-export-field`,children:[(0,Y.jsx)(`label`,{className:`gezel-export-label`,htmlFor:`gezel-export-pagesize`,children:`Page size`}),(0,Y.jsxs)(`select`,{id:`gezel-export-pagesize`,className:`gezel-export-select`,value:v,onChange:e=>y(e.target.value),children:[(0,Y.jsx)(`option`,{value:`letter`,children:`US Letter`}),(0,Y.jsx)(`option`,{value:`a4`,children:`A4`})]})]}),n&&(0,Y.jsx)(`p`,{className:`error small`,role:`alert`,children:n})]}),(0,Y.jsxs)(a,{children:[(0,Y.jsx)(c,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,disabled:t,children:`Cancel`})}),(0,Y.jsx)(`button`,{type:`submit`,className:`primary`,disabled:t,children:t?`Exporting…`:`Export`})]})]})})]})})}function ve(e){let t=e instanceof Error?e.message.trim():``;return t?`Export failed: ${t}`:`Export failed. The document was not exported.`}function ye(e){let t=te[e.format].toUpperCase().replace(`.`,``),n=e.format===`html`&&e.htmlBundle===`zip`?`ZIP`:t,r=[];if(e.format===`html`&&e.htmlStyle===`rendered`&&r.push(`rendered`),e.themeId!==`standard`&&(e.format!==`html`||e.htmlStyle===`rendered`)){let t=M().find(t=>t.id===e.themeId);t&&r.push(t.name)}if(e.format===`pptx`&&e.transformStyle){let t=L().find(t=>t.id===e.transformStyle);t&&r.push(t.name)}return r.length>0?`Export ${n} with ${r.join(` + `)}`:`Export ${n}`}function be({selectedFile:e,mediaContainer:t,mediaSource:n}){let{markdownSource:r}=F(),[c,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(null),[y,b]=(0,J.useState)(!1),[x,S]=(0,J.useState)(null),[C,k]=(0,J.useState)(()=>U()),A=(0,J.useRef)(null);(0,J.useEffect)(()=>()=>A.current?.abort(),[]),(0,J.useEffect)(()=>{let e=!1;return W().then(t=>{e||k(t)}),()=>{e=!0}},[]);let j=(0,J.useCallback)(()=>{f(!1),S(null),m(!0)},[]),M=(0,J.useCallback)(()=>{y||(m(!1),S(null))},[y]),N=(0,J.useCallback)(async t=>{if(!e||!n)return;let a=new AbortController;A.current?.abort(),A.current=a,f(!1),g(t),v(null);try{let o=await i.exportDocumentMedia({markdown:r,selectedFile:e,format:t,source:n},a.signal);if(a.signal.aborted)return;re(o,`${(e.split(`/`).pop()??e).replace(/\.[^.]+$/,``)||`document`}.${t}`),g(null)}catch(e){if(a.signal.aborted)return;v(ve(e))}finally{A.current===a&&(A.current=null)}},[r,n,e]),I=(0,J.useCallback)(()=>{A.current?.abort(),A.current=null,g(null),v(null)},[]),L=(0,J.useCallback)(async n=>{b(!0),S(null),k(n);try{await H(n);let{runExport:i}=await P(async()=>{let{runExport:e}=await import(`./run-export-TscWwR6y.js`);return{runExport:e}},__vite__mapDeps([2,3,4,5,6,7,1,8,9,10,11]));await i(r,e,n,t),m(!1)}catch(e){S(ve(e))}finally{b(!1)}},[r,e,t]),R=(0,J.useCallback)(async()=>{if(C){f(!1),b(!0),S(null);try{let{runExport:n}=await P(async()=>{let{runExport:e}=await import(`./run-export-TscWwR6y.js`);return{runExport:e}},__vite__mapDeps([2,3,4,5,6,7,1,8,9,10,11]));await n(r,e,C,t)}catch(e){S(ve(e)),m(!0)}finally{b(!1)}}},[C,r,e,t]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(O,{open:c,onOpenChange:f,children:[(0,Y.jsx)(w,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`squisq-toolbar-button gezel-export-trigger`,"aria-label":`Export document`,title:`Export document`,disabled:y,children:[(0,Y.jsx)(xe,{}),(0,Y.jsx)(`span`,{children:`Export`})]})}),(0,Y.jsx)(E,{children:(0,Y.jsxs)(T,{className:`app-nav-menu gezel-export-menu`,sideOffset:4,align:`end`,children:[C&&(0,Y.jsx)(D,{className:`app-nav-menu-item`,onSelect:()=>void R(),disabled:y,children:ye(C)}),(0,Y.jsx)(D,{className:`app-nav-menu-item`,onSelect:j,children:`Export…`}),e&&n&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`gezel-export-menu-divider`,role:`separator`,tabIndex:-1}),(0,Y.jsx)(D,{className:`app-nav-menu-item`,onSelect:()=>void N(`mp4`),children:`Export video…`}),(0,Y.jsx)(D,{className:`app-nav-menu-item`,onSelect:()=>void N(`gif`),children:`Export animated GIF…`})]})]})})]}),p&&(0,Y.jsx)(_e,{initial:C??G,exporting:y,error:x,onExport:e=>void L(e),onClose:M}),(h||_)&&(0,Y.jsx)(o,{open:!0,onOpenChange:e=>!e&&I(),children:(0,Y.jsxs)(d,{children:[(0,Y.jsx)(s,{}),(0,Y.jsxs)(l,{className:`gezel-export-loading-dialog`,children:[(0,Y.jsx)(u,{children:h===`gif`?`Exporting animated GIF`:`Exporting video`}),(0,Y.jsx)(`p`,{className:_?`error`:`muted`,role:_?`alert`:`status`,children:_??`Rendering with the ffmpeg installed on this computer. This can take a while…`}),(0,Y.jsx)(a,{children:(0,Y.jsx)(`button`,{type:`button`,onClick:I,children:_?`Close`:`Cancel`})})]})]})})]})}function xe(){return(0,Y.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M8 10.5V1.75`}),(0,Y.jsx)(`path`,{d:`M5.25 4.5 8 1.75l2.75 2.75`}),(0,Y.jsx)(`path`,{d:`M4.25 6.75h-1a1.5 1.5 0 0 0-1.5 1.5v4.5a1.5 1.5 0 0 0 1.5 1.5h9.5a1.5 1.5 0 0 0 1.5-1.5v-4.5a1.5 1.5 0 0 0-1.5-1.5h-1`})]})}var Se=e(r(),1),Ce=class e{context;onChange;static create(t){let n=globalThis,r=n.AudioContext??n.webkitAudioContext;if(!r)return null;try{return new e(new r,t)}catch{return null}}chunks=[];pending=new Map;sources=new Set;bufferedDuration=0;playbackOffset=0;playbackStartedAt=0;playing=!1;complete=!1;disposed=!1;endTimer=null;constructor(e,t){this.context=e,this.onChange=t}prime(){this.context.resume().catch(()=>void 0)}async appendWav(e,t){if(this.disposed||e<this.chunks.length||this.pending.has(e))return this.snapshot();let n=await this.context.decodeAudioData(t.slice(0));if(this.disposed)return this.snapshot();for(this.pending.set(e,n);this.pending.has(this.chunks.length);){let e=this.chunks.length,t=this.pending.get(e);this.pending.delete(e);let n={index:e,start:this.bufferedDuration,buffer:t};this.chunks.push(n),this.bufferedDuration+=t.duration,this.playing&&this.scheduleChunk(n)}return this.refreshEndTimer(),this.emit(),this.snapshot()}async play(){if(this.disposed||this.bufferedDuration<=0)return!1;if(this.playing)return!0;if(this.playbackOffset>=this.bufferedDuration-.02){if(!this.complete)return this.emit(),!1;this.playbackOffset=0}await this.context.resume(),this.stopSources(),this.playing=!0,this.playbackStartedAt=this.context.currentTime+.025;for(let e of this.chunks)this.scheduleChunk(e);return this.refreshEndTimer(),this.emit(),!0}pause(){this.playing&&(this.playbackOffset=this.currentTime(),this.playing=!1,this.stopSources(),this.clearEndTimer(),this.emit())}seek(e){let t=this.playing;this.playbackOffset=Math.max(0,Math.min(this.bufferedDuration,e)),this.playing=!1,this.stopSources(),this.clearEndTimer(),t?this.play():this.emit()}finish(){this.complete=!0,this.refreshEndTimer(),this.emit()}snapshot(){let e=this.currentTime();return{currentTime:e,bufferedDuration:this.bufferedDuration,isPlaying:this.playing,waitingForAudio:!this.complete&&!this.playing&&this.bufferedDuration>0&&e>=this.bufferedDuration-.05,complete:this.complete}}dispose(){this.disposed||(this.disposed=!0,this.playing=!1,this.stopSources(),this.clearEndTimer(),this.context.close().catch(()=>void 0))}currentTime(){return this.playing?Math.min(this.bufferedDuration,this.playbackOffset+Math.max(0,this.context.currentTime-this.playbackStartedAt)):this.playbackOffset}scheduleChunk(e){let t=e.start+e.buffer.duration;if(!this.playing||t<=this.playbackOffset+.005)return;let n=Math.max(0,this.playbackOffset-e.start),r=this.playbackStartedAt+Math.max(0,e.start-this.playbackOffset);if(r<this.context.currentTime&&(n+=this.context.currentTime-r,r=this.context.currentTime),n>=e.buffer.duration-.005)return;let i=this.context.createBufferSource();i.buffer=e.buffer,i.connect(this.context.destination),i.addEventListener(`ended`,()=>this.sources.delete(i),{once:!0}),this.sources.add(i),i.start(r,n)}refreshEndTimer(){if(this.clearEndTimer(),!this.playing)return;let e=Math.max(20,(this.bufferedDuration-this.currentTime())*1e3+40);this.endTimer=setTimeout(()=>{if(this.playing){if(this.currentTime()<this.bufferedDuration-.05){this.refreshEndTimer();return}this.playbackOffset=this.bufferedDuration,this.playing=!1,this.stopSources(),this.clearEndTimer(),this.emit()}},e)}stopSources(){for(let e of this.sources)try{e.stop()}catch{}this.sources.clear()}clearEndTimer(){this.endTimer&&clearTimeout(this.endTimer),this.endTimer=null}emit(){this.disposed||this.onChange(this.snapshot())}};function we(e){return e.replace(/\u00a0/g,` `).replace(/[ \t]+\n/g,`
|
|
3
|
+
`).replace(/\n{3,}/g,`
|
|
4
|
+
|
|
5
|
+
`).trim()}function Te(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n}function Ee(e){let t=new Uint8Array(e.byteLength);return t.set(e),t.buffer}function X(e){let t=Number.isFinite(e)&&e>0?Math.floor(e):0;return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`}function De(e,t){return`${(e?.split(/[\\/]/).pop()?.replace(/\.[^.]+$/,``)||`document`).replace(/[^a-z0-9._-]+/gi,`-`).replace(/^-+|-+$/g,``)||`document`}-${t}-narration.wav`}function Oe(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.style.display=`none`,document.body.append(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),0)}function ke({fileName:e,projectId:t}){let{markdownDoc:n,markdownSource:r}=F(),a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=(0,J.useRef)(null),f=(0,J.useRef)(0),p=(0,J.useRef)(0),m=(0,J.useRef)(0),h=(0,J.useRef)(0),g=(0,J.useRef)(!1),[_,v]=(0,J.useState)(`idle`),[y,b]=(0,J.useState)(`document`),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(!1),[T,E]=(0,J.useState)(0),[D,O]=(0,J.useState)(0),[k,A]=(0,J.useState)(null),[M,P]=(0,J.useState)(0),[L,R]=(0,J.useState)(0),[z,B]=(0,J.useState)(!1),ee=(0,J.useMemo)(()=>{try{return we(j(n??N(r)))}catch{return we(r)}},[n,r]),V=(0,J.useCallback)(()=>{u.current?.dispose(),u.current=null,o.current?.(),o.current=null;let e=a.current;e&&(e.pause(),e.removeAttribute(`src`)),a.current=null,s.current&&URL.revokeObjectURL(s.current),s.current=null,c.current=null},[]),H=(0,J.useCallback)(()=>{l.current?.abort(),l.current=null,V(),v(`idle`),S(null),w(!1),E(0),O(0),R(0),B(!1),A(null),d.current=null,g.current=!1},[V]);(0,J.useEffect)(()=>()=>{l.current?.abort(),V()},[V]),(0,J.useEffect)(()=>{if(_!==`creating`)return;let e=f.current||performance.now();P(0);let t=window.setInterval(()=>{P(Math.floor((performance.now()-e)/1e3))},1e3);return()=>window.clearInterval(t)},[_]),(0,J.useEffect)(()=>{if(_===`idle`||!u.current)return;let e=window.setInterval(()=>{let e=u.current?.snapshot();e&&(E(e.currentTime),R(e.bufferedDuration),w(e.isPlaying),B(e.waitingForAudio))},200);return()=>window.clearInterval(e)},[_]);let U=(0,J.useCallback)(async(e,n)=>{let r=we(e);if(!r)return;l.current?.abort(),V();let _=Ce.create(e=>{E(e.currentTime),R(e.bufferedDuration),w(e.isPlaying),B(e.waitingForAudio)});u.current=_,_?.prime();let y=new AbortController;l.current=y,f.current=performance.now(),p.current=0,m.current=0,h.current=0,d.current=null,g.current=!1,b(n),v(`creating`),S(null),w(!1),E(0),O(0),R(0),B(!1),A(null);try{let e=await i.synthesizeSpeechWithProgress({text:r,...t?{projectId:t}:{},inline:!0},{onProgress:e=>{d.current=e,A(e)},onChunk:async e=>{if(y.signal.aborted||u.current!==_||!_)return;let t=await _.appendWav(e.index,Ee(Te(e.b64Wav))),n=performance.now(),r=d.current;if(p.current===0&&(p.current=n,m.current=t.bufferedDuration,h.current=r?.completedCharacters??0),t.isPlaying||g.current)return;let i=(n-p.current)/1e3,a=t.bufferedDuration-m.current,o=i>.25?a/i:0,s=(r?.completedCharacters??0)-h.current,c=i>.25?s/i:0,l=r&&c>0?(r.totalCharacters-r.completedCharacters)/c:1/0,f=t.bufferedDuration-t.currentTime;f>=4&&(o>=1.15||f>=l+3)&&await _.play()}},y.signal);if(y.signal.aborted)return;if(!e.b64Wav)throw Error(`The speech engine did not return playable audio.`);let n=new Blob([Ee(Te(e.b64Wav))],{type:`audio/wav`});if(c.current=n,_&&_.snapshot().bufferedDuration>0){_.finish(),R(_.snapshot().bufferedDuration),O(e.meta?.durationSeconds??_.snapshot().bufferedDuration),v(`ready`),l.current=null,!_.snapshot().isPlaying&&!g.current&&await _.play();return}_?.dispose(),u.current===_&&(u.current=null);let f=URL.createObjectURL(n),b=new Audio(f),x=()=>{E(b.currentTime||0),Number.isFinite(b.duration)&&O(b.duration)},C=()=>w(!0),T=()=>w(!1),D=()=>w(!1),k=()=>{S(`The narration was created, but this device could not play it.`),v(`error`)};b.addEventListener(`loadedmetadata`,x),b.addEventListener(`durationchange`,x),b.addEventListener(`timeupdate`,x),b.addEventListener(`play`,C),b.addEventListener(`pause`,T),b.addEventListener(`ended`,D),b.addEventListener(`error`,k),o.current=()=>{b.removeEventListener(`loadedmetadata`,x),b.removeEventListener(`durationchange`,x),b.removeEventListener(`timeupdate`,x),b.removeEventListener(`play`,C),b.removeEventListener(`pause`,T),b.removeEventListener(`ended`,D),b.removeEventListener(`error`,k)},s.current=f,a.current=b,O(e.meta?.durationSeconds??0),v(`ready`),l.current=null,await b.play().catch(()=>void 0)}catch(e){if(y.signal.aborted){l.current===y&&v(`idle`);return}_?.dispose(),u.current===_&&(u.current=null),S(e instanceof Error?e.message:`Could not create the narration.`),v(`error`),l.current=null}},[t,V]);I((0,J.useMemo)(()=>[{id:`gezel.narrate-selection`,label:`Narrate selection`,group:`narration`,when:`selection`,disabled:_===`creating`,icon:(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,Y.jsx)(`path`,{d:`M4 9v6h4l5 4V5L8 9H4Zm12.5 3a4.5 4.5 0 0 0-2-3.74v7.48a4.5 4.5 0 0 0 2-3.74Z`})}),onSelect:({selectedText:e})=>U(e,`selection`)}],[U,_]));let te=(0,J.useCallback)(()=>{let e=u.current;if(e){e.snapshot().isPlaying?(g.current=!0,e.pause()):(g.current=!1,e.play().catch(e=>{S(e instanceof Error?e.message:`Could not play the narration.`),v(`error`)}));return}let t=a.current;t&&(t.paused?(Number.isFinite(t.duration)&&t.currentTime>=t.duration&&(t.currentTime=0),t.play().catch(e=>{S(e instanceof Error?e.message:`Could not play the narration.`),v(`error`)})):t.pause())},[]),W=(0,J.useCallback)(e=>{let t=u.current;if(t){let n=t.snapshot();t.seek(n.currentTime+e);return}let n=a.current;if(!n)return;let r=Number.isFinite(n.duration)?n.duration:1/0;n.currentTime=Math.max(0,Math.min(r,n.currentTime+e)),E(n.currentTime)},[]),ne=(0,J.useCallback)(e=>{let t=u.current;if(t){t.seek(e);return}let n=a.current;n&&(n.currentTime=e,E(e))},[]),re=(0,J.useCallback)(()=>{let t=c.current;t&&Oe(t,De(e,y))},[e,y]),G=k?.phase===`encoding`?100:Math.min(100,Math.round((k?.completedCharacters??0)/(k?.totalCharacters||1)*100)),K=L>0?Math.min(G,T/L*G):0,ie=_===`idle`?null:(0,Se.createPortal)((0,Y.jsxs)(`aside`,{className:`document-narration-transport`,"aria-label":`Narration controls`,children:[_===`creating`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`document-narration-summary`,"aria-live":`polite`,children:[(0,Y.jsx)(`strong`,{children:C?`Playing while creating…`:z&&!g.current?`Buffering narration…`:`Creating narration…`}),(0,Y.jsx)(`span`,{children:L>0?`${X(T)} played · ${X(L)} buffered`:`${y===`document`?`Full document`:`Selected text`} · ${k?.phase===`loading`?`Preparing voice`:`Starting speech`} · ${X(M)} elapsed`})]}),L>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,className:`document-narration-control`,"aria-label":`Back 30 seconds`,title:`Back 30 seconds`,onClick:()=>W(-30),children:[`↶`,(0,Y.jsx)(`small`,{children:`30`})]}),(0,Y.jsx)(`button`,{type:`button`,className:`document-narration-control document-narration-play`,"aria-label":C?`Pause narration`:`Play buffered narration`,title:C?`Pause`:`Play buffered audio`,onClick:te,children:C?`Ⅱ`:`▶`}),(0,Y.jsxs)(`button`,{type:`button`,className:`document-narration-control`,"aria-label":`Forward 30 seconds`,title:`Forward within buffered audio`,onClick:()=>W(30),children:[`↷`,(0,Y.jsx)(`small`,{children:`30`})]})]}),(0,Y.jsxs)(`div`,{className:`document-narration-progress`,role:`progressbar`,"aria-label":`Creating narration`,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0,"aria-valuenow":G,title:`${X(L)} generated · ${G}% complete`,children:[(0,Y.jsx)(`span`,{className:`document-narration-progress-buffered`,style:{width:`${G}%`}}),(0,Y.jsx)(`span`,{className:`document-narration-progress-played`,style:{width:`${K}%`}})]}),(0,Y.jsxs)(`span`,{className:`document-narration-progress-value`,children:[G,`% · `,X(L)]}),(0,Y.jsx)(`button`,{type:`button`,className:`document-narration-cancel`,onClick:H,children:`Cancel`})]}),_===`ready`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`document-narration-summary`,"aria-live":`polite`,children:[(0,Y.jsx)(`strong`,{children:y===`document`?`Document narration`:`Selection narration`}),(0,Y.jsx)(`span`,{children:C?`Playing`:`Paused`})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`document-narration-control`,"aria-label":`Back 30 seconds`,title:`Back 30 seconds`,onClick:()=>W(-30),children:[`↶`,(0,Y.jsx)(`small`,{children:`30`})]}),(0,Y.jsx)(`button`,{type:`button`,className:`document-narration-control document-narration-play`,"aria-label":C?`Pause narration`:`Play narration`,title:C?`Pause`:`Play`,onClick:te,children:C?`Ⅱ`:`▶`}),(0,Y.jsxs)(`button`,{type:`button`,className:`document-narration-control`,"aria-label":`Forward 30 seconds`,title:`Forward 30 seconds`,onClick:()=>W(30),children:[`↷`,(0,Y.jsx)(`small`,{children:`30`})]}),(0,Y.jsxs)(`label`,{className:`document-narration-timeline`,children:[(0,Y.jsx)(`span`,{className:`sr-only`,children:`Narration position`}),(0,Y.jsx)(`input`,{type:`range`,min:0,max:Math.max(D,.1),step:.1,value:Math.min(T,Math.max(D,.1)),onChange:e=>ne(Number(e.currentTarget.value))}),(0,Y.jsxs)(`span`,{"aria-hidden":`true`,children:[X(T),` / `,X(D)]})]}),(0,Y.jsx)(`button`,{type:`button`,className:`document-narration-download`,"aria-label":`Download WAV`,title:`Download WAV`,onClick:re,children:(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,Y.jsx)(`path`,{d:`M12 3v11m0 0 4-4m-4 4-4-4M5 17v3h14v-3`})})}),(0,Y.jsx)(`button`,{type:`button`,className:`document-narration-close`,"aria-label":`Close narration`,title:`Close`,onClick:H,children:`×`})]}),_===`error`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`document-narration-summary`,role:`alert`,children:[(0,Y.jsx)(`strong`,{children:`Narration unavailable`}),(0,Y.jsx)(`span`,{children:x})]}),(0,Y.jsx)(`button`,{type:`button`,className:`document-narration-cancel`,onClick:H,children:`Close`})]})]}),document.body);return(0,Y.jsxs)(`span`,{className:`document-narration-root`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`squisq-toolbar-button document-narration-trigger`,"aria-label":`Narrate document`,title:`Narrate document`,disabled:!ee||_===`creating`,onClick:()=>void U(ee,`document`),children:(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,Y.jsx)(`path`,{d:`M4 9v6h4l5 4V5L8 9H4Zm12.5 3a4.5 4.5 0 0 0-2-3.74v7.48a4.5 4.5 0 0 0 2-3.74Zm-2-8.65v2.12a7.5 7.5 0 0 1 0 13.06v2.12a9.5 9.5 0 0 0 0-17.3Z`})})}),ie]})}function Ae({entries:e,selectedPath:t,onSelect:n,iconFor:r=y,trailingForEntry:i,detailForEntry:a,actionsForEntry:o,emptyMessage:s}){return e.length===0?s?(0,Y.jsx)(`div`,{className:`file-flat-empty muted`,children:s}):null:(0,Y.jsx)(`div`,{className:`file-flat-list`,children:e.map(e=>{let s=x(e.path),c=i?.(e),l=a?.(e),u=o?.(e)??[],d=(0,Y.jsxs)(`div`,{className:`tree-row${t===e.path?` tree-row-selected`:``}${l?` file-flat-row-card`:``}`,children:[(0,Y.jsx)(`span`,{className:`tree-toggle-spacer`}),(0,Y.jsxs)(`button`,{type:`button`,className:`tree-label${l?` file-flat-card`:``}`,onClick:()=>n(e),children:[(0,Y.jsxs)(`span`,{className:`file-flat-card-name`,children:[r(e),e.name,s&&(0,Y.jsx)(`span`,{className:`file-flat-parent`,children:s})]}),l&&(0,Y.jsx)(`span`,{className:`file-flat-card-detail`,children:l})]}),c&&(0,Y.jsx)(`button`,{type:`button`,className:`tree-row-trailing tree-row-trailing-select`,tabIndex:-1,onClick:()=>n(e),children:c}),u.length>0&&(0,Y.jsxs)(O,{children:[(0,Y.jsx)(w,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,className:`tree-actions-trigger`,"aria-label":`Actions for ${e.name}`,title:`Actions for ${e.name}`,children:(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:`⋯`})})}),(0,Y.jsx)(E,{children:(0,Y.jsx)(T,{className:`app-nav-menu tree-actions-menu`,sideOffset:4,align:`end`,children:u.map(t=>(0,Y.jsx)(D,{className:`app-nav-menu-item`,disabled:t.disabled,onSelect:()=>void t.onSelect(e),children:t.label},t.label))})})]})]},e.path);return u.length>0?(0,Y.jsxs)(f,{children:[(0,Y.jsx)(S,{asChild:!0,children:d}),(0,Y.jsx)(p,{children:(0,Y.jsx)(h,{className:`app-nav-menu tree-actions-menu`,children:u.map(t=>(0,Y.jsx)(C,{className:`app-nav-menu-item`,disabled:t.disabled,onSelect:()=>void t.onSelect(e),children:t.label},t.label))})})]},e.path):d})})}var Z={width:14,height:14,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:1.6,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,focusable:!1},je=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M1.8 4.6h3.6l1.4 1.5h7.4v6.9H1.8Z`}),(0,Y.jsx)(`path`,{d:`M6.3 11.2 7.9 7.4l1.6 3.8`,strokeWidth:`1.3`}),(0,Y.jsx)(`path`,{d:`M6.9 10h2`,strokeWidth:`1.3`})]}),Me=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M1.8 4.6h3.6l1.4 1.5h7.4v6.9H1.8Z`}),(0,Y.jsx)(`circle`,{cx:`8`,cy:`9.5`,r:`2.2`,strokeWidth:`1.3`}),(0,Y.jsx)(`path`,{d:`M8 8.5v1l0.9 0.6`,strokeWidth:`1.3`})]}),Ne=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M2.4 3.6h11.2`}),(0,Y.jsx)(`path`,{d:`M2.4 7.4h5`}),(0,Y.jsx)(`path`,{d:`M2.4 11.2h5`}),(0,Y.jsx)(`circle`,{cx:`11.4`,cy:`10.4`,r:`3`,strokeWidth:`1.3`}),(0,Y.jsx)(`path`,{d:`M11.4 9v1.4l1.1 0.7`,strokeWidth:`1.3`})]}),Pe=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M2.4 3.9h7`}),(0,Y.jsx)(`path`,{d:`M2.4 7.7h7`}),(0,Y.jsx)(`path`,{d:`M2.4 11.5h7`}),(0,Y.jsx)(`path`,{d:`M12.6 3.4v5.2`}),(0,Y.jsx)(`path`,{d:`M12.6 11.6v0.01`,strokeWidth:`2.4`})]}),Fe=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M2.8 11.8a5.2 5.2 0 0 1 10.4 0`}),(0,Y.jsx)(`path`,{d:`M8 11.8 10.7 8`}),(0,Y.jsx)(`path`,{d:`M8 11.8v0.01`,strokeWidth:`2.4`})]}),Ie=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M1.4 8S3.8 3.8 8 3.8 14.6 8 14.6 8 12.2 12.2 8 12.2 1.4 8 1.4 8Z`}),(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.9`,strokeWidth:`1.3`})]}),Le=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M1.4 8S3.8 3.8 8 3.8 14.6 8 14.6 8 12.2 12.2 8 12.2 1.4 8 1.4 8Z`}),(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.9`,strokeWidth:`1.3`}),(0,Y.jsx)(`path`,{d:`M2.6 13.4 13.4 2.6`})]}),Re=()=>(0,Y.jsxs)(`svg`,{...Z,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M8.6 2.9H3.1v10h10V7.4`}),(0,Y.jsx)(`path`,{d:`M9.4 6.6 13.4 2.6`}),(0,Y.jsx)(`path`,{d:`M10.3 2.6h3.1v3.1`})]}),ze={"tree-alpha":{label:`Folders, A to Z`,hint:`Folder view — folders and files sorted by name.`,icon:je},"tree-modified":{label:`Folders, newest first`,hint:`Folder view — folders by name, files with the newest changes on top.`,icon:Me},"flat-modified":{label:`All files by last modified`,hint:`Every file across all folders, newest changes on top.`,icon:Ne},"flat-issues":{label:`Files by issues`,hint:`Files with open review issues, most issues on top.`,icon:Pe},"flat-criticality":{label:`Files by criticality`,hint:`Files with open review issues, weighted so major issues rank first.`,icon:Fe}};function Be({value:e,modes:t,onChange:n}){return(0,Y.jsx)(`div`,{className:`gz-tray file-view-tray`,role:`radiogroup`,"aria-label":`File list view`,children:t.map(t=>{let r=ze[t],i=r.icon,a=t===e;return(0,Y.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":a,className:`gz-key gz-key--icon${a?` gz-key-active`:``}`,title:r.hint,"aria-label":r.label,onClick:()=>{a||n(t)},children:(0,Y.jsx)(i,{})},t)})})}function Ve({kind:e,value:t,onChange:n}){return(0,Y.jsx)(`div`,{className:`gz-tray file-hidden-tray`,children:(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":t,className:`gz-key gz-key--icon${t?` gz-key-active`:``}`,title:t?`Hide hidden files again.`:e===`workspace`?`Show hidden files — Office lock files, dot-files, and folders like node_modules.`:e===`artifacts`?`Show hidden files — Office lock files, dot-files, and the generated shadow folder.`:`Show hidden files — Office lock files, dot-files, and companion folders.`,"aria-label":`Show hidden files`,onClick:()=>n(!t),children:(0,Y.jsx)(t?Ie:Le,{})})})}function He({onReveal:e}){return(0,Y.jsx)(`div`,{className:`gz-tray file-reveal-tray`,children:(0,Y.jsx)(`button`,{type:`button`,className:`gz-key gz-key--icon`,title:`Open in file manager`,"aria-label":`Open in file manager`,onClick:e,children:(0,Y.jsx)(Re,{})})})}var Ue=`gezel:project-file-tree-width:v1`,We=`gezel:project-file-tree-collapsed:v1`,Ge=150,Ke=560,Q=240,qe=100,Je=34;function Ye(e){return Number.isFinite(e)?Math.max(Ge,Math.min(Ke,Math.round(e))):Q}function Xe(){if(typeof window>`u`)return Q;try{let e=window.localStorage.getItem(Ue);return e?Ye(Number.parseFloat(e)):Q}catch{return Q}}function Ze(){if(typeof window>`u`)return!1;try{return window.localStorage.getItem(We)===`1`}catch{return!1}}function Qe({source:e,entries:t,truncated:n,viewMode:r,modes:i,onViewModeChange:a,showHidden:o,onShowHiddenChange:s,selectedPath:c,onSelect:l,selectableFolders:u,labelFor:d,emptyMessage:f,mutations:p,viewer:h,extraPane:_,headerExtra:y,titleReplacement:b,notices:x,trailingForEntry:S,actionsForEntry:C,customList:w,layoutClassName:T}){let[E,D]=(0,J.useState)(()=>Xe()),[O,A]=(0,J.useState)(()=>Ze()),j=(0,J.useRef)(null),M=(0,J.useCallback)(e=>{let t=Ye(e);D(t);try{window.localStorage.setItem(Ue,String(t))}catch{}},[]),N=(0,J.useCallback)(e=>{A(e);try{window.localStorage.setItem(We,e?`1`:`0`)}catch{}},[]),P=(0,J.useCallback)(e=>{e.preventDefault(),j.current={startX:e.clientX,startWidth:O?Je:E},document.body.classList.add(`chat-rail-resizing`),document.body.style.cursor=`col-resize`;let t=e=>{let t=j.current;if(!t)return;let n=t.startWidth+(e.clientX-t.startX);if(n<qe){N(!0);return}N(!1),M(n)},n=()=>{j.current=null,document.body.style.cursor=``,document.body.classList.remove(`chat-rail-resizing`),window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)},[O,N,M,E]),F=(0,J.useCallback)(e=>{let t=e.shiftKey?24:8;if(e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault();let n=e.key===`ArrowLeft`?-t:t;if(O){if(n<0)return;N(!1);return}let r=E+n;if(r<qe){N(!0);return}M(r)}else e.key===`Home`?(e.preventDefault(),N(!1),M(Ke)):e.key===`End`&&(e.preventDefault(),N(!0))},[O,N,M,E]),I=r===`tree-alpha`||r===`tree-modified`,L=r===`flat-modified`&&!w?t.filter(e=>!e.isDirectory).slice().sort(g):[],R=e.title.toLowerCase();return(0,Y.jsxs)(`div`,{className:`project-files-layout has-tree-grip${O?` tree-collapsed`:``}${_?` has-index-pane`:``}${T?` ${T}`:``}`,style:{"--file-tree-user-width":`${E}px`},children:[p.dialogs,O&&(0,Y.jsx)(`div`,{className:`file-tree-panel file-tree-panel-collapsed`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`file-tree-expand-btn`,onClick:()=>N(!1),"aria-expanded":!1,"aria-label":`Show ${e.title} files`,title:`Show ${e.title} files`,children:[(0,Y.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`12`,height:`12`,"aria-hidden":`true`,children:(0,Y.jsx)(`path`,{d:`M6 3.5 10.5 8 6 12.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,Y.jsx)(`span`,{className:`file-tree-collapsed-label`,children:e.title})]})}),!O&&(0,Y.jsxs)(`div`,{className:`file-tree-panel document-drop-zone${p.activeDropZone===`tree`?` document-drop-zone-active`:``}`,...p.dropZoneProps(`tree`,``),children:[(0,Y.jsxs)(`div`,{className:`file-tree-header`,children:[b??(0,Y.jsx)(`span`,{className:`file-tree-title`,children:e.title}),(0,Y.jsx)(`div`,{className:`file-tree-header-actions`,children:(p.newFolder||p.newFile)&&(0,Y.jsxs)(`div`,{className:`gz-tray file-create-tray`,children:[p.newFolder&&(0,Y.jsx)(`button`,{type:`button`,className:`gz-key gz-key--icon`,"aria-label":`New folder`,title:`New folder`,onClick:()=>p.newFolder?.(),children:(0,Y.jsx)(`i`,{className:`fa-solid fa-folder-plus`,"aria-hidden":`true`})}),p.newFile&&(0,Y.jsx)(`button`,{type:`button`,className:`gz-key gz-key--icon`,"aria-label":e.kind===`documents`?`New document`:`New file`,title:e.kind===`documents`?`New document`:`New file`,onClick:()=>p.newFile?.(),children:(0,Y.jsx)(`i`,{className:`fa-solid fa-file-circle-plus`,"aria-hidden":`true`})})]})}),y,(0,Y.jsxs)(`div`,{className:`file-tree-toolbar`,children:[(0,Y.jsx)(Be,{value:r,modes:i,onChange:a}),(0,Y.jsx)(Ve,{kind:e.kind,value:o,onChange:s}),e.reveal&&(0,Y.jsx)(He,{onReveal:()=>void e.reveal?.()})]})]}),p.status&&(0,Y.jsx)(`output`,{className:`file-tree-status`,children:p.status}),x,(0,Y.jsxs)(`div`,{className:`file-tree`,children:[w?(0,Y.jsx)(Ae,{entries:w.entries,selectedPath:c,onSelect:w.onSelect??l,trailingForEntry:w.trailingForEntry,detailForEntry:w.detailForEntry,actionsForEntry:w.actionsForEntry??C,emptyMessage:w.emptyMessage}):I?t.length===0?(0,Y.jsx)(`p`,{className:`muted`,style:{padding:`0.5rem`,fontSize:`0.85rem`},children:f}):(0,Y.jsx)(v,{entries:t,selectedPath:c,sortMode:r===`tree-modified`?`modified`:`alpha`,labelFor:d,selectableFolders:u,onSelect:l,onRename:p.rename,onDelete:p.remove,onMove:e.kind===`documents`?p.move:void 0,trailingForEntry:S,actionsForEntry:C}):(0,Y.jsx)(Ae,{entries:L,selectedPath:c,onSelect:l,trailingForEntry:e=>{let t=S?.(e),n=e.mtimeMs===void 0?null:(0,Y.jsx)(`span`,{className:`file-flat-time`,title:k(new Date(e.mtimeMs)),children:m(new Date(e.mtimeMs).toISOString())});return t||n?(0,Y.jsxs)(Y.Fragment,{children:[t,n]}):null},actionsForEntry:C,emptyMessage:`No ${R} files yet.`}),!w&&n&&(0,Y.jsxs)(`p`,{className:`muted`,style:{padding:`0.5rem`,fontSize:`0.8rem`},children:[`This folder has more files than can be shown — the listing is incomplete.`,e.reveal?` Use "Open in file manager" above to browse everything.`:``]})]}),p.activeDropZone===`tree`&&(0,Y.jsxs)(`div`,{className:`document-drop-overlay`,"aria-hidden":`true`,children:[(0,Y.jsx)(`i`,{className:`fa-solid fa-file-arrow-down`}),(0,Y.jsxs)(`span`,{children:[`Drop to add to `,e.title]})]})]}),(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize ${R} files`,tabIndex:0,className:`chat-rail-grip file-tree-grip`,onMouseDown:P,onKeyDown:F,onDoubleClick:()=>N(!O)}),(0,Y.jsxs)(`div`,{className:`file-viewer-panel document-drop-zone${p.activeDropZone===`detail`?` document-drop-zone-active`:``}`,...p.dropZoneProps(`detail`,et(c,t)),children:[h,p.activeDropZone===`detail`&&(0,Y.jsxs)(`div`,{className:`document-drop-overlay`,"aria-hidden":`true`,children:[(0,Y.jsx)(`i`,{className:`fa-solid fa-file-arrow-down`}),(0,Y.jsxs)(`span`,{children:[`Drop to add to `,tt(c,t,e.title)]})]})]}),_]})}function $e(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}function et(e,t){return e?t.find(t=>t.path===e)?.isDirectory?e:$e(e):``}function tt(e,t,n){let r=et(e,t);return r?r.slice(r.lastIndexOf(`/`)+1):n}var nt=`__IMAGE__`,rt=`__VIDEO__`,it=`__AUDIO__`,at=`__BINARY__`,ot=new Set([nt,rt,it,at]);function st(e){return/\.(png|jpe?g|gif|svg|webp|bmp)$/i.test(e)}function ct(e){return/\.(mp4|webm|mov|m4v|avi|mkv|ogv)$/i.test(e)}function lt(e){return/\.(mp3|wav|ogg|oga|m4a|aac|flac|opus)$/i.test(e)}function ut(e){return st(e)?nt:ct(e)?rt:lt(e)?it:null}function dt(e){let t=e.slice(0,4096);if(!t)return!1;let n=0;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e);(r===65533||r<9||r>13&&r<32)&&n++}return n/t.length>.1}function ft({kind:e,path:t,fetchBlob:n}){let[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null);return(0,J.useEffect)(()=>{let e=!1,r=null;return(async()=>{try{let a=await n(t);if(e)return;r=URL.createObjectURL(a),i(r)}catch(t){e||o(t.message)}})(),()=>{e=!0,r&&URL.revokeObjectURL(r)}},[n,t]),a?(0,Y.jsxs)(`p`,{className:`muted small`,children:[`Preview failed: `,a]}):r?e===`image`?(0,Y.jsx)(`img`,{src:r,alt:t}):e===`audio`?(0,Y.jsx)(`audio`,{src:r,controls:!0,style:{width:`100%`}}):(0,Y.jsx)(`video`,{src:r,controls:!0,style:{maxWidth:`100%`,maxHeight:`100%`}}):(0,Y.jsx)(`p`,{className:`muted small`,children:`Loading…`})}function pt({content:e,path:t,fetchBlob:n,sizeBytes:r}){let i=e===`__IMAGE__`?`image`:e===`__VIDEO__`?`video`:e===`__AUDIO__`?`audio`:null;return(0,Y.jsxs)(`div`,{className:`image-preview`,children:[i?(0,Y.jsx)(ft,{kind:i,path:t,fetchBlob:n}):(0,Y.jsx)(`p`,{className:`muted`,style:{textAlign:`center`},children:`Binary file — no text preview available.`}),(0,Y.jsx)(`p`,{className:`muted`,style:{textAlign:`center`},children:r===void 0?t:`${t} · ${_(r)}`})]})}function mt(){return{kind:`documents`,title:`Documents`,canWrite:!0,list:({hidden:e})=>i.listDocuments(``,!0,{stats:!0,hidden:e}),read:e=>i.readDocument(e),fetchBlob:e=>i.fetchDocumentBlob(e),write:async(e,t)=>{await i.writeDocument(e,t)},writeBinary:async(e,t,n)=>{await i.writeDocumentBinary(e,t,n)},remove:async e=>{await i.deleteDocument(e)},mkdir:async e=>{await i.createDocumentFolder(e)},rename:async(e,t)=>{await i.renameDocument(e,t)},reveal:async()=>{await i.revealDocuments()},changeEventPrefix:`gezel:document`}}function ht(e,t,n){let r=t===`workspace`;return{kind:t,title:r?`Workspace`:`Artifacts`,canWrite:n.canWrite,list:({hidden:t})=>r?i.listProjectWorkspace(e,``,!0,{stats:!0,hidden:t}):i.listProjectArtifacts(e,``,!0,{stats:!0,hidden:t}),read:t=>r?i.readProjectWorkspaceFile(e,t):i.readProjectArtifact(e,t),fetchBlob:t=>r?i.fetchProjectWorkspaceBlob(e,t):i.fetchProjectArtifactBlob(e,t),write:async(t,n)=>{r?await i.writeProjectWorkspaceFile(e,{path:t,content:n}):await i.writeProjectArtifact(e,t,n)},writeBinary:async(t,n,a)=>{r?await i.writeProjectWorkspaceBinary(e,t,n,a):await i.writeProjectArtifactBinary(e,t,n,a)},remove:async t=>{r?await i.rmProjectWorkspacePath(e,t,{recursive:!0}):await i.deleteProjectArtifact(e,t)},mkdir:async t=>{r?await i.mkdirProjectWorkspace(e,{path:t}):await i.createProjectArtifactFolder(e,t)},rename:async(t,n)=>{r?await i.renameProjectWorkspacePath(e,{fromPath:t,toPath:n}):await i.renameProjectArtifactPath(e,t,n)},reveal:async()=>{await i.revealProject(e,t)}}}function $(e){return Array.from(e.dataTransfer.types).includes(`Files`)}function gt(e){if(!e||e.isDirectory)return;if(!e.name.includes(`.`))return`.md`;let t=e.name.match(/\.(md|markdown|mdx)$/i);return t?`.${t[1].toLowerCase()}`:void 0}function _t(e,t){return e.some(e=>e.path===t||e.path.startsWith(`${t}/`))}function vt(e,t){let n=e.kind===`documents`?[`document:${t}`]:[`file:${e.kind}:${t}`,`document:${t}`],r=K(t);return r&&n.push(e.kind===`documents`?`outside-in:documents:${r.markdownPath}`:`outside-in:${e.kind}:${r.markdownPath}`),n}function yt(e){let{source:t,entries:n,selectedPath:r,onSelectPath:i,refresh:a}=e,o=e.newFileSuffix??(t.kind===`documents`?`.md`:void 0),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(null),[y,x]=(0,J.useState)(null),[S,C]=(0,J.useState)(null),w=t.canWrite,T=(0,J.useCallback)((e,n)=>{t.changeEventPrefix&&window.dispatchEvent(new CustomEvent(`${t.changeEventPrefix}-${e}`,{detail:{path:n}}))},[t.changeEventPrefix]),E=(0,J.useCallback)(async e=>{if(r&&!(r!==e.path&&!r.startsWith(`${e.path}/`)))for(let e of vt(t,r))await R(e)},[r,t]),D=(0,J.useCallback)(async()=>{let e=h;if(e)try{await E(e);let o=(e.isDirectory?null:K(e.path))?.companionDirectory??(e.isDirectory?null:V(e.path)),s=o?_t(n,o):!1;await t.remove(e.path),o&&s&&await t.remove(o),T(`deleted`,e.path),r&&(r===e.path||r.startsWith(`${e.path}/`))&&i(null),await a()}catch(e){c(`delete failed: ${e.message}`)}finally{g(null)}},[T,h,n,E,i,a,r,t]),O=(0,J.useCallback)(async(e,o)=>{let s=t.rename;if(!s)throw Error(`Moving files is not available here.`);let c=e.isDirectory?null:K(e.path),l=e.isDirectory?null:K(o);if(c&&l?.format!==c.format)throw Error(`Keep the .${c.format} extension when renaming this document.`);let u=c?.companionDirectory??(e.isDirectory?null:V(e.path)),d=l?.companionDirectory??(e.isDirectory?null:V(o));if(!e.isDirectory&&z(e.path)&&!z(o))throw Error(`Keep the Markdown extension when renaming this document.`);if(d&&n.some(e=>e.path===o||(e.path===d||e.path.startsWith(`${d}/`))&&!(u&&(e.path===u||e.path.startsWith(`${u}/`)))))throw Error(`A document or companion folder with that name already exists.`);await E(e);let f=u?_t(n,u):!1;if(await ee(s,e.path,o,f&&u&&d?{from:u,to:d}:null),c&&l&&f)await ie({from:c,to:l,filePaths:n.filter(e=>!e.isDirectory).map(e=>e.path),rename:s,read:async e=>(await t.read(e)).content,write:t.write});else if(f&&!e.isDirectory&&z(e.path)&&z(o)){let n=await t.read(o),r=B(n.content,e.path,o);r!==n.content&&await t.write(o,r)}await a(),r&&(r===e.path||r.startsWith(`${e.path}/`))&&i(`${o}${r.slice(e.path.length)}`),t.changeEventPrefix&&window.dispatchEvent(new CustomEvent(`${t.changeEventPrefix}-renamed`,{detail:{fromPath:e.path,toPath:o,isDirectory:e.isDirectory}}))},[n,E,i,a,r,t]),k=(0,J.useCallback)(async e=>{let n=_;if(!n||!t.rename)return;let r=e.trim();if(!r||/[\\/]/.test(r)){x(`Enter a name without slashes.`);return}let i=n.path.lastIndexOf(`/`),a=`${i>=0?n.path.slice(0,i+1):``}${r}`;if(a===n.path){v(null),x(null);return}try{await O(n,a),v(null),x(null)}catch(e){x(e.message||`Rename failed.`)}},[O,_,t.rename]),j=(0,J.useCallback)(async(e,n)=>{if(!t.rename||!n.isDirectory||e.isDirectory)return;let r=e.path.lastIndexOf(`/`);if((r<0?``:e.path.slice(0,r))===n.path)return;let i=`${n.path}/${e.name}`;c(`Moving ${e.name} to ${n.path}…`);try{await O(e,i),c(`Moved ${e.name} to ${n.path}.`)}catch(e){c(`move failed: ${e.message||`Unknown error.`}`)}},[O,t.rename]),M=(0,J.useCallback)(async e=>{let n=e.trim();if(n)try{await t.write(n,``),u(!1),await a(),i(n),T(`created`,n)}catch(e){c(`create failed: ${e.message}`)}},[T,i,a,t]),N=(0,J.useCallback)(async e=>{let n=e.trim(),r=t.mkdir;if(!(!n||!r))try{await r(n),f(!1),await a(),T(`created`,n)}catch(e){c(`create folder failed: ${e.message}`)}},[T,a,t]),P=(0,J.useCallback)(async(e,r)=>{if(!$(e))return;e.preventDefault(),e.stopPropagation(),C(null);let o=Array.from(e.dataTransfer.files);if(o.length===0)return;c(`Adding ${o.length===1?o[0]?.name:`${o.length} files`}…`);let s=await ae({target:{writeText:(e,n)=>t.write(e,n),writeBinary:(e,n,r)=>t.writeBinary(e,n,r)},files:o,destination:r,existingPaths:n.map(e=>e.path)});if(s.importedPaths.length>0){await a();let e=s.importedPaths.at(-1);i(e),t.changeEventPrefix&&window.dispatchEvent(new CustomEvent(`${t.changeEventPrefix}-created`,{detail:{path:e,paths:s.importedPaths}}))}let l=s.importedPaths.length,u=s.rejected.length;if(u>0){let e=s.rejected[0];c(`${l>0?`Added ${l}; `:``}couldn't add ${e.name}: ${e.reason}${u>1?` (+${u-1} more)`:``}`)}else c(`Added ${l} ${l===1?`file`:`files`}.`)},[n,i,a,t]),F=(0,J.useCallback)((e,t)=>w?{onDragEnterCapture:t=>{$(t)&&(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=`copy`,C(e))},onDragOverCapture:t=>{$(t)&&(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=`copy`,C(t=>t===e?t:e))},onDragLeaveCapture:e=>{if(!$(e))return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||C(null)},onDropCapture:e=>void P(e,t)}:{},[P,w]);return{dialogs:(0,J.useMemo)(()=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(b,{open:l,title:`New ${t.kind===`documents`?`document`:`file`}`,placeholder:t.kind===`documents`?p?`e.g. coding`:`e.g. guidelines/coding`:`e.g. notes/report.md`,submitLabel:`Create`,parentPath:p||void 0,fieldLabel:p?`Name`:`Path`,suffix:o,onSubmit:M,onCancel:()=>u(!1)}),(0,Y.jsx)(b,{open:d,title:`New folder`,placeholder:`e.g. guidelines`,submitLabel:`Create`,initialValue:p,onSubmit:N,onCancel:()=>f(!1)}),(0,Y.jsx)(b,{open:_!==null,title:_?.isDirectory?`Rename folder`:`Rename file`,fieldLabel:`Name`,placeholder:`New name`,submitLabel:`Rename`,initialValue:_?.name??``,suffix:gt(_),error:y,onSubmit:k,onCancel:()=>{v(null),x(null)}}),(0,Y.jsx)(A,{open:h!==null,title:h?.isDirectory?`Delete folder?`:`Delete file?`,message:h?.isDirectory?`This will remove "${h.path}" and everything inside it. This cannot be undone.`:h?`"${h.path}" will be permanently removed.`:``,confirmLabel:`Delete`,danger:!0,onCancel:()=>g(null),onConfirm:D})]}),[D,k,h,M,N,o,p,y,_,l,d,t.kind]),status:s,setStatus:c,newFile:w?(e=``)=>{m(e),u(!0)}:void 0,newFolder:w&&t.mkdir?(e=``)=>{m(e),f(!0)}:void 0,rename:w&&t.rename?e=>{x(null),v(e)}:void 0,remove:w?e=>g(e):void 0,move:w&&t.rename?j:void 0,activeDropZone:S,dropZoneProps:F}}export{nt as a,dt as c,ke as d,be as f,se as h,at as i,ut as l,le as m,mt as n,ot as o,de as p,ht as r,pt as s,yt as t,Qe as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{I as n,ft as r,h as i}from"./doc-
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{I as n,ft as r,h as i}from"./doc-BHcGsJZd.js";import{a,l as o,s}from"./chunk-X7BNDUNI-D14WIvlD.js";import{O as c,p as l}from"./chunk-GAZKTT4R-w1SNypWQ.js";import{F as u,I as d,n as f}from"./chunk-CW24CH7I-BD0FIooX.js";import{l as p}from"./markdown-CLKH_zzl.js";import"./schemas-BvLZUsGm.js";import{t as m}from"./jszip.min-DhiFe-R7.js";import{n as h,t as g}from"./chunk-BXWNU4T5-CFA9w1DZ.js";import{n as _,r as v,t as y}from"./chunk-VPWPEMZJ-DRKoa_j0.js";var b=e(m(),1);function x(e){let t=new Set;function n(e){!e||e.startsWith(`data:`)||e.startsWith(`blob:`)||e.startsWith(`http://`)||e.startsWith(`https://`)||t.add(e)}function r(e){if(e)for(let t of e)t.type===`image`&&n(t.content.src),t.type===`video`&&(n(t.content.src),n(t.content.posterSrc)),t.type===`map`&&n(t.content.staticSrc)}function i(e){r(e.layers),e.contents&&S(e.contents,n),e.children&&e.children.forEach(i)}if(e.blocks.forEach(i),e.startBlock?.heroSrc&&n(e.startBlock.heroSrc),e.persistentLayers){for(let t of e.persistentLayers.bottomLayers??[])`src`in t&&typeof t.src==`string`&&n(t.src);for(let t of e.persistentLayers.topLayers??[])`src`in t&&typeof t.src==`string`&&n(t.src)}for(let n of e.blocks)w(n,t);return t}function S(e,t){for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;e.type===`image`&&typeof e.url==`string`&&t(e.url),(e.type===`htmlBlock`||e.type===`htmlInline`)&&Array.isArray(e.htmlChildren)&&C(e.htmlChildren,t),Array.isArray(e.children)&&S(e.children,t)}}function C(e,t){for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(e.type===`htmlElement`){if(e.tagName===`img`){let n=e.attributes;n&&typeof n.src==`string`&&t(n.src)}Array.isArray(e.children)&&C(e.children,t)}}}function w(e,t){if(!(!e||typeof e!=`object`)){for(let n of[`imageSrc`,`src`,`heroSrc`,`backgroundImage`,`posterSrc`,`staticSrc`,`videoSrc`,`thumbnailSrc`]){let r=e[n];typeof r==`string`&&r&&!r.startsWith(`data:`)&&!r.startsWith(`http`)&&t.add(r),r&&typeof r==`object`&&!Array.isArray(r)&&w(r,t)}if(Array.isArray(e))for(let n of e)n&&typeof n==`object`&&w(n,t);for(let n of[`images`,`accentImage`,`backgroundVideo`,`children`,`blocks`]){let r=e[n];if(Array.isArray(r))for(let e of r)e&&typeof e==`object`&&w(e,t);else r&&typeof r==`object`&&w(r,t)}}}function T(e){return e.replace(/<(?=!--|\/?script)/gi,`\\u003c`)}function ee(e){let t={},n={};if(!e)return{imageMap:t,imageAliases:n};let r=new Map;for(let[i,a]of e.entries()){let e=r.get(a);if(e!==void 0){n[i]=e;continue}r.set(a,i),t[i]=y(a,v(i))}return{imageMap:t,imageAliases:n}}function te(e,t){let{playerScript:n,basePath:r=`.`,images:i,mode:a=`slideshow`,title:o=`Squisq Document`,autoPlay:s=!1,showCodeCopyButton:c=!1,captionStyle:l,captionPosition:u,themeId:d,themeRegistry:f}=t;e=ne(e,d,f);let{imageMap:p,imageAliases:m}=ee(i),h=T(JSON.stringify(e)),g=T(JSON.stringify(p)),_=T(JSON.stringify(m));return`<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-CW24CH7I-BD0FIooX.js";import"./chunk-7ZAAICW4-BsCpYJH6.js";
|