diff --git a/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/bundle.json b/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/bundle.json index f7815fc4e..d2f351255 100644 --- a/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/bundle.json +++ b/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/bundle.json @@ -1,5 +1,5 @@ { "schemaVersion": 1, "id": "builtin-ppt-live", - "version": 167 + "version": 169 } diff --git a/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/dist/ui.bundle.js b/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/dist/ui.bundle.js index 5f9946902..2d80b24a7 100644 --- a/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/dist/ui.bundle.js +++ b/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/dist/ui.bundle.js @@ -1,80 +1,80 @@ -var Mn=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var fs={"en-US":{eyebrow:"AI Deck Studio",title:"PPT Live",newDeck:"New",newTopic:"New topic",blankDeckTitle:"Untitled deck",blankDeckReady:"Blank deck ready.",clusterDraft:"Draft",clusterReview:"Review",clusterExport:"Export",generateOutline:"Outline",generateDeck:"Generate deck",preview:"Preview",exportHtml:"HTML",exportPptx:"PPTX",workflowPrompt:"Prompt",workflowGenerate:"Generate",workflowEdit:"Edit",workflowExport:"Export",slidesPanelTitle:"Slides",slidesPanelSubcopy:"Click a page to edit text directly on canvas.",agentCommandTitle:"Create or edit by prompt",agentCommandSubcopy:"Generate a deck, revise one page, edit the whole deck, insert, or delete.",briefTitle:"Brief",agentRequestTitle:"What should this deck say?",oneBoxTitle:"Describe the deck. Then keep editing by prompt.",oneBoxSubtitle:"One command box handles drafting, page edits, deck edits, insertion, and deletion.",oneBoxPlaceholder:"Example: Build a 10-page AI product strategy deck for executives. Later: make this page more visual, rewrite the whole deck for investors, insert a risk page, or delete this page.",sendPrompt:"Send",promptRequired:"Type what you want PPT Live to do.",topicLabel:"Goal",topicPlaceholder:"Describe the deck you want. Mention page count or URLs only when you need them.",audienceLabel:"Audience",audiencePlaceholder:"Executives, customers, students...",slidesLabel:"Slides",deckTypeLabel:"Deck type",deckTypeStrategy:"Strategy",deckTypeSales:"Sales pitch",deckTypeReport:"Business report",deckTypeTeaching:"Teaching",deckTypeFundraising:"Fundraising",toneLabel:"Tone",toneExecutive:"Executive",toneConcise:"Concise",tonePersuasive:"Persuasive",toneEducational:"Educational",materialLabel:"Source material",materialPlaceholder:"Paste notes, article excerpts, data points, meeting notes, or rough slide requirements.",advancedBrief:"Optional context",processTitle:"Generation process",processSubcopy:"Track the current deck build at a glance.",historyTitle:"History",historySubcopy:"Restore a deck session and continue editing.",historyEmpty:"Generated decks and edits will appear here.",historyMeta:"{{count}} slides \xB7 {{time}}",historyRestored:"Deck session restored.",stopGeneration:"Stop",generationStopped:"Generation stopped. Kept the current view.",generationTimedOut:"Generation took too long, so PPT Live stopped this run.",generationDraftReady:"Preparing the final slides\u2026",generationAgentWorking:"Building your presentation\u2026",backendGenerationFailed:"Generation did not finish. Please retry, or stop and start a new topic.",backendGenerationFailedWithReason:"Generation did not finish: {{reason}}",generationRoundBudgetFailed:"Generation ran out of steps before the deck was ready.",generationRoundBudgetHint:"Try a shorter prompt, fewer pages, or remove extra reference links, then send again.",generationRetrying:"Generation hit an error; retrying automatically ({{attempt}}/{{max}})\u2026",generationRetryAttempt:"Retry attempt {{attempt}}/{{max}}.",generationRecoveryContinuing:"{{stage}} is still incomplete; asking the same Agent Session to continue ({{attempt}}/{{max}})\u2026",generationRecoveryExhausted:"{{stage}} did not finish after {{retries}} retries and {{continuations}} continuation turns.",generationRecoveryFailureDetail:"Last verified reason: {{reason}}",generationStagePlanning:"Planning",generationStageSlide:"Slide {{slide}}",generationStageAudit:"Final audit",agentOnlyRetryHint:"Check your connection and try again in a moment.",generationPlanPhase:"Stage 1/3 \xB7 Research and slide planning",generationPlanningSlides:"Writing per-slide briefs\u2026",generationPlanProgress:"Planning in progress: {{count}} slide briefs written\u2026",generationPlanReady:"Plan ready: {{count}} slides outlined.",generationPlanRetry:"Planning hit an error; retrying the planning stage only ({{attempt}}/{{max}})\u2026",generationAuditRetry:"Final audit is incomplete; retrying the audit stage ({{attempt}}/{{max}})\u2026",generationSlidesPhase:"Stage 2/3 \xB7 Rendering {{count}} slides serially, one Agent turn per page",generationAuditPhase:"Stage 3/3 \xB7 Auditing the full deck against the design skill and style contract",generationRenderingSlide:"Rendering slide {{slide}}/{{total}}\u2026",generationSlideReady:"Slide {{slide}}/{{total}} ready.",generationSlideRetry:"Slide {{slide}} hit an error; retrying it ({{attempt}}/{{max}})\u2026",generationSlideRepair:"Slide {{slide}} failed validation; agent repair ({{attempt}}/{{max}})\u2026",generationResumeFrom:"Resuming from slide {{slide}} \u2014 finished slides are kept.",generationPartialDeck:"Slides {{missing}} did not finish. The finished slides are kept \u2014 send a follow-up prompt to fill the missing pages.",agentWorkingTitle:"Building your deck",agentWorkingKicker:"In progress",agentWorkingClaim:"Your slides will appear in the canvas when generation finishes.",agentWorkingProof:"Progress",agentWorkingDetail:"This is a live preview area while your deck is being created.",agentWorkingSourceNote:"Content is generated from your prompt.",agentWorkingMetric:"Live",agentWorkingMetricLabel:"Waiting for slides",processEventStarted:"Generation started.",processEventWaiting:"Getting ready\u2026",processEventRound:"Organizing structure and copy.",processEventTool:"Reading sources and applying design rules.",processEventText:"Drafting slide layouts.",processEventDone:"Deck received.",generationParsingDeck:"Loading slides into the editor\u2026",processWaitingForEventsTitle:"Ready to generate",processWaitingForEvents:"Send a prompt to start. Progress will show up here.",processEventUnknown:"Update",eventTurnStarted:"Generation started",eventTurnFailed:"Generation failed",eventTurnCancelled:"Generation cancelled",eventRoundCompleted:"Step completed",eventThinkingChunk:"Thinking stream",eventTokenUsage:"Token usage updated",eventUnknownTool:"tool",eventToolDetected:"Detected tool",eventToolParams:"Reading tool input",eventToolQueued:"Queued tool",eventToolWaiting:"Waiting for tool",eventToolStarted:"Started tool",eventToolProgress:"Tool progress",eventToolStreaming:"Tool streaming",eventToolStreamChunk:"Tool output chunk",eventToolConfirmation:"Tool needs confirmation",eventToolConfirmed:"Tool confirmed",eventToolRejected:"Tool rejected",eventToolCompleted:"Completed tool",eventToolFailed:"Tool failed",eventToolCancelled:"Tool cancelled",eventToolQueuePosition:"queue",eventToolSkillName:"PPT design skill",eventToolWebSearchName:"Web search",eventToolWebFetchName:"Web page fetch",eventToolSkillReady:"Design skill loaded",generationProgressPulse:"Still generating\u2026",generationPageProgress:"Generating page {{current}}",generationSlideProgress:"{{count}} slides drafted",generationStepBrief:"Assumptions",generationStepBriefDetail:"Read the prompt and plan the deck.",generationStepSpine:"Outline",generationStepSpineDetail:"Create assertion-led slide titles from the request.",generationStepProof:"Slide copy",generationStepProofDetail:"Ground each page in source facts or clear assumptions.",generationStepDesign:"Visual design",generationStepDesignDetail:"Apply theme, layout, and visual hierarchy.",generationStepCompile:"Load slides",generationStepCompileDetail:"Load the generated deck into the editor.",generationReadingBrief:"Reading your prompt...",generationWritingClaims:"Building the outline...",generationChoosingProof:"Writing slide copy...",generationDesigningLayouts:"Designing slide layouts...",generationCompiled:"Your deck is ready.",generationSpineReady:"Claim spine ready.",generationLocalSpine:"Generation is unavailable. Please try again later.",generationLocalCompiler:"Generation is unavailable. Please try again later.",agentPlanning:"Planning the deck task...",agentPlanningFallback:"Planning is unavailable. Please try again.",outlineTitle:"Outline",outlineSubcopy:"Review the story spine before the deck is composed.",addOutlineItem:"Add outline item",syncOutline:"Sync slides from outline",modeEdit:"Edit",modeSort:"Sort",modePresent:"Present",inspectorTitle:"Inspector",addText:"Text",addList:"List",addShape:"Shape",addMetric:"Metric",addChart:"Chart",addMedia:"Media",addSlide:"Add slide",deleteSlide:"Delete slide",deleteElement:"Delete element",aiTitle:"AI design",aiSubcopy:"Prompt the agent to revise one page, the whole deck, or add a page.",instructionPlaceholder:"Example: make this page more visual, add a competition page, rewrite the whole deck for investors, or delete repetition.",reviseSlide:"Revise this page",reviseDeck:"Revise all",insertSlide:"Insert page",aiRewrite:"Rewrite",aiCondense:"Condense",aiProfessional:"Professional",aiMoreVisual:"More visual",aiNotes:"Speaker notes",aiRedesign:"Redesign slide",aiRestyleDeck:"Restyle deck",styleTitle:"Style",themeLabel:"Theme",themeExecutive:"Executive",themeMarket:"Market",themeMinimal:"Minimal",themeStudio:"Studio",densityLabel:"Density",densityCompact:"Compact",densityStandard:"Standard",densitySpacious:"Spacious",brandPrimaryLabel:"Primary",brandAccentLabel:"Accent",imagePolicyLabel:"Image policy",imagePolicyPlaceholders:"Editable placeholders",imagePolicyNone:"No images",ready:"Ready.",statusPillReady:"Ready",statusPillBusy:"AI",exportReady:"HTML and PPTX export ready after generation.",working:"Working with AI...",outlineReady:"Outline ready. Edit it, then generate the designed deck.",deckReady:"Designed deck generated.",aiUnavailable:"Generation is unavailable right now. Please try again later.",sourceGroundingRequired:"Source could not be verified. Generated a verification-first deck instead of inventing facts.",saved:"Saved.",slideUpdated:"Slide updated.",deckUpdated:"Deck updated.",slideInserted:"Page inserted.",deckRestyled:"Deck restyled.",cannotDelete:"Keep at least one slide.",noSelection:"Select a slide object to edit its content and layout.",elementTypeLabel:"Type",elementTextLabel:"Text",elementItemsLabel:"Items",elementDataLabel:"Chart data",geometryLabel:"Geometry",styleLabel:"Style",speakerNotesLabel:"Speaker notes",kickerLabel:"Kicker",claimLabel:"Claim",proofObjectLabel:"Proof object",supportNoteLabel:"Support note",sourceNoteLabel:"Source note",newSlideTitle:"New slide",defaultDeckTitle:"AI Product Strategy",slidesMeta:"{{count}} slides",exportHtmlDone:"HTML deck downloaded.",exportHtmlWorking:"Exporting HTML...",exportHtmlFailed:"HTML export failed:",exportSavedTo:"Exported to {{path}}",exportPptxWorking:"Rendering editable PPTX...",exportPptxDone:"Editable PPTX downloaded.",exportPptxFailed:"PPTX export failed:",exportPdfWorking:"Rendering PDF...",exportPdfDone:"PDF downloaded.",exportPdfFailed:"PDF export failed:",exportPngWorking:"Rendering PNG slides...",exportPngDone:"PNG slide archive downloaded.",exportPngFailed:"PNG export failed:",exportDeckEmpty:"Generate slides before exporting.",slidesEmptyHint:"Slides appear here after generation.",welcomeTitle:"Describe your deck to get started",welcomeSubcopy:"One prompt creates the outline, designed slides, and an editable deck you can refine page by page.",welcomeTip1:"10-page strategy deck",welcomeTip2:"Investor pitch rewrite",welcomeTip3:"Make this page more visual",deleteSlideDefaultPrompt:"Delete the current slide and keep the deck coherent.",prev:"Previous",next:"Next",assistantHello:"Describe the deck you need. I will build an outline first, then turn it into editable slides.",aiChatApplied:"I applied the instruction to the current slide.",localMetricLabel:"signal to remember",mediaPlaceholder:"Image placeholder",slidesUnit:"slides",closeConfirm:"Confirm the direction",closeOwner:"Choose the owner",closeIteration:"Start the next iteration",pointClaimPrefix:"Claim:",pointProofPrefix:"Proof object:",pointAudiencePrefix:"Audience relevance:",pointEvidenceRule:"Evidence rule: mark assumptions clearly",pointDesignRule:"Design rule: one visual plus one support rail",pointCloseRule:"Close: name the next action",claimCover:"{{topic}} needs a clear decision narrative, not another collection of slides.",claimPressure:"{{title}} is the pressure point the audience must resolve.",claimDecision:"{{title}} changes the decision because it connects evidence to action.",claimProof:"{{title}} becomes credible when the proof object carries the argument.",claimAction:"{{title}} should end with one named decision, owner, or next move.",supportWithSource:"Use the supplied source material to substantiate this claim; make the {{proof}} the dominant evidence.",supportWithAssumption:"Add one concrete example or metric so the {{proof}} can support the claim without filler.",sourceUserMaterial:"Source: user-provided material",sourceDraftAssumption:"Source: draft assumption; verify before external use",defaultSpeakerNote:'Open with the conclusion for "{{title}}", then support it with one concrete example.',proofMarketMap:"market map",proofOperatingModel:"operating model",proofRiskBridge:"risk bridge",proofDecisionTable:"decision table",proofBeforeAfter:"before/after workflow",proofValueBridge:"value bridge",proofCustomerProof:"customer proof",proofImplementationPlan:"implementation plan",proofMetricBridge:"metric bridge",proofTrendChart:"trend chart",proofSourceSummary:"source summary",proofVerificationPlan:"verification plan",proofCapabilityMatrix:"capability matrix",proofEvidenceList:"evidence list",proofVarianceTable:"variance table",proofRiskRegister:"risk register",proofConceptMap:"concept map",proofWorkedExample:"worked example",proofComparison:"comparison",proofPracticePrompt:"practice prompt",proofMarketWedge:"market wedge",proofProductDiagram:"product diagram",proofTractionChart:"traction chart",proofMilestonePlan:"milestone plan",proofVisualProof:"visual proof",sourceFetchedNote:"Sources: {{count}} fetched URL(s)",bpContextTitle:"{{topic}} must be grounded in source facts before claims are made.",bpSourceNeededTitle:"{{topic}} needs source material before factual claims can be made.",bpProblemTitle:"The current question is what the audience can safely believe.",bpSolutionTitle:"{{topic}} should be explained through capabilities, workflow, and evidence.",bpWorkflowTitle:"The workflow shows how the product creates value step by step.",bpProofTitle:"Source-backed evidence should carry the credibility of the deck.",bpVerificationTitle:"Verification gaps must be visible instead of hidden behind fake charts.",bpRiskTitle:"The main risk is overclaiming beyond the available source material.",bpDecisionTitle:"The next step is to verify the claims and choose the strongest story path.",bpSupportSource:"Built from fetched or pasted source material; verify exact wording before external use.",bpSupportMissing:"Source material is insufficient; keep this slide as a verification prompt.",bpMissingFact1:"Paste source notes, a README, metrics, or product description to ground this slide.",bpMissingFact2:"Do not use invented metrics; replace placeholders with verified evidence.",bpMissingFact3:"Use this page to decide what needs to be researched next.",qualityOutOfBounds:"An element extends outside the slide safe area.",qualityTextDense:"Visible text may be too dense for this layout.",qualityChartUngrounded:"Chart data was removed or flagged because it is not grounded in source numbers.",qualityOverlap:"Text or chart elements may overlap.",qualityMissingClaim:"This slide needs one clear claim.",qualityReportTitle:"Quality report",qualityNeedsReview:"Review required",qualityHasWarnings:"Quality warning",exportFormatUnavailable:"This export format is not available yet.",exportTitle:"Export",exportCancel:"Cancel",exportConfirm:"Export file",exportPreviewPrevAria:"Previous slide",exportPreviewNextAria:"Next slide",exportFormat:"Format",exportQuality:"Quality",exportDpi:"Image DPI",exportRange:"Slide range",exportShare:"Share",propertiesStyle:"Style",propertiesLayout:"Layout",propertiesAnimation:"Animation",propertiesThemeColor:"Theme color",propertiesFont:"Font",propertiesColorMode:"Slide colors",propertiesStylePreset:"Style preset",colorModeLight:"Light",colorModeDark:"Dark",fontSansSerif:"Sans-serif",fontSerif:"Serif",propertiesDensity:"Density",propertiesSmartAlign:"Smart align",propertiesPageTransition:"Page transition",propertiesElementAnimation:"Element animation",densityLoose:"Loose"},"zh-CN":{eyebrow:"AI \u6F14\u793A\u5DE5\u574A",title:"PPT Live",newDeck:"\u65B0\u5EFA",newTopic:"\u65B0\u4E3B\u9898",blankDeckTitle:"\u672A\u547D\u540D PPT",blankDeckReady:"\u7A7A\u767D PPT \u5DF2\u5C31\u7EEA\u3002",clusterDraft:"\u521B\u4F5C",clusterReview:"\u5BA1\u9605",clusterExport:"\u4EA4\u4ED8",generateOutline:"\u751F\u6210\u5927\u7EB2",generateDeck:"\u751F\u6210\u6574\u5957",preview:"\u6F14\u793A\u9884\u89C8",exportHtml:"\u5BFC\u51FA HTML",exportPptx:"\u5BFC\u51FA PPTX",workflowPrompt:"\u8F93\u5165",workflowGenerate:"\u751F\u6210",workflowEdit:"\u7F16\u8F91",workflowExport:"\u5BFC\u51FA",slidesPanelTitle:"\u9875\u9762",slidesPanelSubcopy:"\u70B9\u51FB\u9875\u9762\u540E\uFF0C\u53EF\u76F4\u63A5\u5728\u753B\u5E03\u4E0A\u6539\u6587\u5B57\u3002",agentCommandTitle:"\u7528 Prompt \u751F\u6210\u6216\u4FEE\u6539",agentCommandSubcopy:"\u751F\u6210\u6574\u5957 PPT\u3001\u4FEE\u6539\u5355\u9875\u3001\u5168\u5C40\u6539\u5199\u3001\u63D2\u5165\u6216\u5220\u9664\u9875\u9762\u3002",briefTitle:"\u521B\u4F5C\u7B80\u62A5",agentRequestTitle:"\u4F60\u60F3\u505A\u4E00\u4EFD\u4EC0\u4E48 PPT\uFF1F",oneBoxTitle:"\u63CF\u8FF0 PPT\uFF0C\u7136\u540E\u7EE7\u7EED\u7528 Prompt \u4FEE\u6539",oneBoxSubtitle:"\u9996\u7A3F\u3001\u6539\u5355\u9875\u3001\u6539\u6574\u5957\u3001\u63D2\u5165\u548C\u5220\u9664\uFF0C\u90FD\u7531\u8FD9\u4E00\u4E2A\u8F93\u5165\u6846\u5904\u7406\u3002",oneBoxPlaceholder:"\u4F8B\u5982\uFF1A\u4E3A\u9AD8\u7BA1\u751F\u6210 10 \u9875 AI \u4EA7\u54C1\u6218\u7565 PPT\u3002\u4E4B\u540E\u53EF\u4EE5\u5199\uFF1A\u628A\u672C\u9875\u6539\u5F97\u66F4\u89C6\u89C9\u5316\u3001\u6574\u5957\u6539\u6210\u6295\u8D44\u4EBA\u7248\u672C\u3001\u63D2\u5165\u4E00\u9875\u98CE\u9669\u5206\u6790\u3001\u5220\u9664\u672C\u9875\u3002",sendPrompt:"\u53D1\u9001",promptRequired:"\u8BF7\u8F93\u5165\u4F60\u5E0C\u671B PPT Live \u505A\u4EC0\u4E48\u3002",topicLabel:"\u76EE\u6807",topicPlaceholder:"\u76F4\u63A5\u63CF\u8FF0\u4F60\u60F3\u8981\u7684\u6F14\u793A\u7A3F\uFF1B\u4EC5\u5728\u9700\u8981\u65F6\u8BF4\u660E\u9875\u6570\u6216\u53C2\u8003 URL\u3002",audienceLabel:"\u53D7\u4F17",audiencePlaceholder:"\u9AD8\u7BA1\u3001\u5BA2\u6237\u3001\u5B66\u751F\u3001\u56E2\u961F\u6210\u5458...",slidesLabel:"\u9875\u6570",deckTypeLabel:"\u7C7B\u578B",deckTypeStrategy:"\u6218\u7565\u65B9\u6848",deckTypeSales:"\u9500\u552E\u63D0\u6848",deckTypeReport:"\u4E1A\u52A1\u6C47\u62A5",deckTypeTeaching:"\u6559\u5B66\u8BFE\u4EF6",deckTypeFundraising:"\u878D\u8D44\u8DEF\u6F14",toneLabel:"\u8BED\u6C14",toneExecutive:"\u9AD8\u7BA1\u98CE",toneConcise:"\u7CBE\u7B80",tonePersuasive:"\u6709\u8BF4\u670D\u529B",toneEducational:"\u6559\u5B66\u578B",materialLabel:"\u7D20\u6750",materialPlaceholder:"\u7C98\u8D34\u7B14\u8BB0\u3001\u6587\u7AE0\u7247\u6BB5\u3001\u6570\u636E\u70B9\u3001\u4F1A\u8BAE\u8BB0\u5F55\u6216\u7C97\u7565\u9875\u9762\u8981\u6C42\u3002",advancedBrief:"\u53EF\u9009\u4E0A\u4E0B\u6587",processTitle:"\u751F\u6210\u8FC7\u7A0B",processSubcopy:"\u67E5\u770B\u5F53\u524D\u6F14\u793A\u7A3F\u7684\u751F\u6210\u8FDB\u5EA6\u3002",historyTitle:"\u5386\u53F2\u8BB0\u5F55",historySubcopy:"\u6062\u590D\u4E4B\u524D\u7684 PPT \u4F1A\u8BDD\uFF0C\u5E76\u7EE7\u7EED\u4FEE\u6539\u3002",historyEmpty:"\u751F\u6210\u548C\u4FEE\u6539\u8FC7\u7684 PPT \u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002",historyMeta:"{{count}} \u9875 \xB7 {{time}}",historyRestored:"\u5DF2\u6062\u590D PPT \u4F1A\u8BDD\u3002",stopGeneration:"\u505C\u6B62",generationStopped:"\u5DF2\u505C\u6B62\u751F\u6210\uFF0C\u4FDD\u7559\u5F53\u524D\u89C6\u56FE\u3002",generationTimedOut:"\u751F\u6210\u8017\u65F6\u8FC7\u957F\uFF0C\u672C\u6B21\u8FD0\u884C\u5DF2\u505C\u6B62\u3002",generationDraftReady:"\u6B63\u5728\u6574\u7406\u6700\u7EC8\u9875\u9762\u2026",generationAgentWorking:"\u6B63\u5728\u751F\u6210\u4F60\u7684\u6F14\u793A\u7A3F\u2026",backendGenerationFailed:"\u751F\u6210\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u6216\u505C\u6B62\u540E\u91CD\u65B0\u5F00\u59CB\u3002",backendGenerationFailedWithReason:"\u751F\u6210\u672A\u5B8C\u6210\uFF1A{{reason}}",generationRoundBudgetFailed:"\u751F\u6210\u6B65\u9AA4\u8FC7\u591A\uFF0C\u6F14\u793A\u7A3F\u5C1A\u672A\u5B8C\u6210\u3002",generationRoundBudgetHint:"\u53EF\u5C1D\u8BD5\u7F29\u77ED\u63CF\u8FF0\u3001\u51CF\u5C11\u9875\u6570\u6216\u53BB\u6389\u591A\u4F59\u53C2\u8003\u94FE\u63A5\uFF0C\u7136\u540E\u91CD\u65B0\u53D1\u9001\u3002",generationRetrying:"\u751F\u6210\u51FA\u73B0\u9519\u8BEF\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8BD5\uFF08{{attempt}}/{{max}}\uFF09\u2026",generationRetryAttempt:"\u7B2C {{attempt}}/{{max}} \u6B21\u5C1D\u8BD5\u3002",generationRecoveryContinuing:"{{stage}}\u4ECD\u672A\u5B8C\u6210\uFF0C\u6B63\u5728\u8BA9\u540C\u4E00\u4E2A Agent Session \u7EE7\u7EED\u6267\u884C\uFF08{{attempt}}/{{max}}\uFF09\u2026",generationRecoveryExhausted:"{{stage}}\u5728 {{retries}} \u6B21\u91CD\u8BD5\u548C {{continuations}} \u6B21\u7EE7\u7EED\u6267\u884C\u540E\u4ECD\u672A\u5B8C\u6210\u3002",generationRecoveryFailureDetail:"\u6700\u540E\u4E00\u6B21\u53EF\u9A8C\u8BC1\u7684\u5931\u8D25\u539F\u56E0\uFF1A{{reason}}",generationStagePlanning:"\u89C4\u5212\u9636\u6BB5",generationStageSlide:"\u7B2C {{slide}} \u9875",generationStageAudit:"\u6700\u7EC8\u5BA1\u8BA1",agentOnlyRetryHint:"\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\uFF0C\u7A0D\u540E\u518D\u8BD5\u3002",generationPlanPhase:"\u9636\u6BB5 1/3 \xB7 \u7814\u7A76\u4E0E\u5168\u7BC7\u89C4\u5212",generationPlanningSlides:"\u6B63\u5728\u7F16\u5199\u6BCF\u9875\u5185\u5BB9\u7B80\u62A5\u2026",generationPlanProgress:"\u89C4\u5212\u8FDB\u884C\u4E2D\uFF1A\u5DF2\u5199\u5B8C {{count}} \u9875\u7B80\u62A5\u2026",generationPlanReady:"\u89C4\u5212\u5B8C\u6210\uFF1A\u5171 {{count}} \u9875\u3002",generationPlanRetry:"\u89C4\u5212\u9636\u6BB5\u51FA\u9519\uFF0C\u4EC5\u91CD\u8BD5\u89C4\u5212\u9636\u6BB5\uFF08{{attempt}}/{{max}}\uFF09\u2026",generationAuditRetry:"\u6700\u7EC8\u5BA1\u8BA1\u5C1A\u672A\u5B8C\u6210\uFF0C\u6B63\u5728\u91CD\u8BD5\u5BA1\u8BA1\u9636\u6BB5\uFF08{{attempt}}/{{max}}\uFF09\u2026",generationSlidesPhase:"\u9636\u6BB5 2/3 \xB7 \u4E32\u884C\u6E32\u67D3 {{count}} \u9875\uFF0C\u6BCF\u9875\u4E00\u6B21 Agent \u8C03\u7528",generationAuditPhase:"\u9636\u6BB5 3/3 \xB7 \u6309\u8BBE\u8BA1 Skill \u4E0E\u6837\u5F0F\u5951\u7EA6\u5BA1\u8BA1\u6574\u5957\u5E7B\u706F\u7247",generationRenderingSlide:"\u6B63\u5728\u6E32\u67D3\u7B2C {{slide}}/{{total}} \u9875\u2026",generationSlideReady:"\u7B2C {{slide}}/{{total}} \u9875\u5DF2\u5B8C\u6210\u3002",generationSlideRetry:"\u7B2C {{slide}} \u9875\u51FA\u9519\uFF0C\u6B63\u5728\u91CD\u8BD5\uFF08{{attempt}}/{{max}}\uFF09\u2026",generationSlideRepair:"\u7B2C {{slide}} \u9875\u6821\u9A8C\u672A\u901A\u8FC7\uFF0CAgent \u4FEE\u590D\u4E2D\uFF08{{attempt}}/{{max}}\uFF09\u2026",generationResumeFrom:"\u4ECE\u7B2C {{slide}} \u9875\u7EE7\u7EED\u751F\u6210\uFF0C\u5DF2\u5B8C\u6210\u7684\u9875\u9762\u4FDD\u7559\u3002",generationPartialDeck:"\u7B2C {{missing}} \u9875\u672A\u5B8C\u6210\u3002\u5DF2\u5B8C\u6210\u7684\u9875\u9762\u5DF2\u4FDD\u7559\uFF0C\u53EF\u7EE7\u7EED\u53D1\u9001\u6307\u4EE4\u8865\u5168\u7F3A\u5931\u9875\u3002",agentWorkingTitle:"\u6B63\u5728\u751F\u6210\u6F14\u793A\u7A3F",agentWorkingKicker:"\u751F\u6210\u4E2D",agentWorkingClaim:"\u5B8C\u6210\u540E\uFF0C\u6700\u7EC8\u9875\u9762\u4F1A\u51FA\u73B0\u5728\u4E2D\u95F4\u753B\u5E03\u3002",agentWorkingProof:"\u8FDB\u5EA6",agentWorkingDetail:"\u8FD9\u662F\u751F\u6210\u8FC7\u7A0B\u4E2D\u7684\u9884\u89C8\u533A\u57DF\u3002",agentWorkingSourceNote:"\u5185\u5BB9\u5C06\u6839\u636E\u4F60\u7684 Prompt \u81EA\u52A8\u751F\u6210\u3002",agentWorkingMetric:"Live",agentWorkingMetricLabel:"\u7B49\u5F85\u9875\u9762\u751F\u6210",processEventStarted:"\u5DF2\u5F00\u59CB\u751F\u6210\u3002",processEventWaiting:"\u51C6\u5907\u5F00\u59CB\u2026",processEventRound:"\u6B63\u5728\u7EC4\u7EC7\u5185\u5BB9\u4E0E\u7ED3\u6784\u3002",processEventTool:"\u6B63\u5728\u8BFB\u53D6\u7D20\u6750\u5E76\u5E94\u7528\u8BBE\u8BA1\u89C4\u5219\u3002",processEventText:"\u6B63\u5728\u64B0\u5199\u9875\u9762\u5E03\u5C40\u3002",processEventDone:"\u6F14\u793A\u7A3F\u5DF2\u751F\u6210\u3002",generationParsingDeck:"\u6B63\u5728\u52A0\u8F7D\u9875\u9762\u5230\u7F16\u8F91\u5668\u2026",processWaitingForEventsTitle:"\u7B49\u5F85\u5F00\u59CB",processWaitingForEvents:"\u53D1\u9001 Prompt \u540E\uFF0C\u8FD9\u91CC\u4F1A\u663E\u793A\u751F\u6210\u8FDB\u5EA6\u3002",processEventUnknown:"\u8FDB\u5EA6\u66F4\u65B0",eventTurnStarted:"\u5F00\u59CB\u751F\u6210",eventTurnFailed:"\u751F\u6210\u5931\u8D25",eventTurnCancelled:"\u751F\u6210\u5DF2\u53D6\u6D88",eventRoundCompleted:"\u672C\u9636\u6BB5\u5DF2\u5B8C\u6210",eventThinkingChunk:"\u601D\u8003\u6D41",eventTokenUsage:"Token \u7528\u91CF\u66F4\u65B0",eventUnknownTool:"\u5DE5\u5177",eventToolDetected:"\u68C0\u6D4B\u5230\u5DE5\u5177",eventToolParams:"\u6B63\u5728\u8BFB\u53D6\u5DE5\u5177\u53C2\u6570",eventToolQueued:"\u5DE5\u5177\u5DF2\u6392\u961F",eventToolWaiting:"\u7B49\u5F85\u5DE5\u5177\u6267\u884C",eventToolStarted:"\u5F00\u59CB\u8C03\u7528\u5DE5\u5177",eventToolProgress:"\u5DE5\u5177\u8FDB\u5EA6",eventToolStreaming:"\u5DE5\u5177\u6D41\u5F0F\u8F93\u51FA",eventToolStreamChunk:"\u5DE5\u5177\u8F93\u51FA\u7247\u6BB5",eventToolConfirmation:"\u5DE5\u5177\u9700\u8981\u786E\u8BA4",eventToolConfirmed:"\u5DE5\u5177\u5DF2\u786E\u8BA4",eventToolRejected:"\u5DE5\u5177\u5DF2\u62D2\u7EDD",eventToolCompleted:"\u5DE5\u5177\u6267\u884C\u5B8C\u6210",eventToolFailed:"\u5DE5\u5177\u6267\u884C\u5931\u8D25",eventToolCancelled:"\u5DE5\u5177\u5DF2\u53D6\u6D88",eventToolQueuePosition:"\u961F\u5217\u4F4D\u7F6E",eventToolSkillName:"PPT \u8BBE\u8BA1\u89C4\u8303",eventToolWebSearchName:"\u7F51\u9875\u641C\u7D22",eventToolWebFetchName:"\u7F51\u9875\u8BFB\u53D6",eventToolSkillReady:"\u8BBE\u8BA1\u89C4\u8303\u5DF2\u5C31\u7EEA",generationProgressPulse:"\u4ECD\u5728\u751F\u6210\u4E2D\u2026",generationPageProgress:"\u6B63\u5728\u751F\u6210\u7B2C {{current}} \u9875",generationSlideProgress:"\u5DF2\u8D77\u8349 {{count}} \u9875",generationStepBrief:"\u53D1\u5E03\u5047\u8BBE",generationStepBriefDetail:"\u9605\u8BFB Prompt \u5E76\u89C4\u5212\u6F14\u793A\u7A3F\u3002",generationStepSpine:"\u751F\u6210\u5927\u7EB2",generationStepSpineDetail:"\u628A\u9700\u6C42\u8F6C\u6210\u65AD\u8A00\u5F0F\u9875\u9762\u6807\u9898\u3002",generationStepProof:"\u9875\u9762\u6587\u6848",generationStepProofDetail:"\u7528\u7D20\u6750\u4E8B\u5B9E\u6216\u660E\u786E\u5047\u8BBE\u652F\u6491\u6BCF\u9875\u3002",generationStepDesign:"\u8BBE\u8BA1\u6392\u7248",generationStepDesignDetail:"\u5E94\u7528\u4E3B\u9898\u3001\u7248\u5F0F\u4E0E\u89C6\u89C9\u5C42\u6B21\u3002",generationStepCompile:"\u52A0\u8F7D\u9875\u9762",generationStepCompileDetail:"\u5C06\u751F\u6210\u7ED3\u679C\u52A0\u8F7D\u4E3A\u53EF\u7F16\u8F91\u9875\u9762\u3002",generationReadingBrief:"\u6B63\u5728\u7406\u89E3\u4F60\u7684 Prompt\u2026",generationWritingClaims:"\u6B63\u5728\u751F\u6210\u5927\u7EB2\u2026",generationChoosingProof:"\u6B63\u5728\u64B0\u5199\u9875\u9762\u6587\u6848\u2026",generationDesigningLayouts:"\u6B63\u5728\u8BBE\u8BA1\u9875\u9762\u7248\u5F0F\u2026",generationCompiled:"\u6F14\u793A\u7A3F\u5DF2\u5C31\u7EEA\u3002",generationSpineReady:"\u8BBA\u70B9\u4E3B\u7EBF\u5DF2\u751F\u6210\u3002",generationLocalSpine:"\u751F\u6210\u670D\u52A1\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",generationLocalCompiler:"\u751F\u6210\u670D\u52A1\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",agentPlanning:"\u6B63\u5728\u89C4\u5212\u6F14\u793A\u7A3F\u2026",agentPlanningFallback:"\u89C4\u5212\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",outlineTitle:"\u5927\u7EB2",outlineSubcopy:"\u5148\u786E\u8BA4\u6BCF\u4E00\u9875\u7684\u6545\u4E8B\u4E3B\u7EBF\uFF0C\u518D\u751F\u6210\u5B8C\u6574\u9875\u9762\u3002",addOutlineItem:"\u6DFB\u52A0\u5927\u7EB2\u9879",syncOutline:"\u7528\u5927\u7EB2\u540C\u6B65\u9875\u9762",modeEdit:"\u7F16\u8F91",modeSort:"\u6392\u5E8F",modePresent:"\u6F14\u793A",inspectorTitle:"\u68C0\u67E5\u5668",addText:"\u6587\u5B57",addList:"\u5217\u8868",addShape:"\u5F62\u72B6",addMetric:"\u6307\u6807",addChart:"\u56FE\u8868",addMedia:"\u5A92\u4F53",addSlide:"\u6DFB\u52A0\u9875\u9762",deleteSlide:"\u5220\u9664\u9875\u9762",deleteElement:"\u5220\u9664\u5143\u7D20",aiTitle:"AI \u8BBE\u8BA1",aiSubcopy:"\u7528 Prompt \u4FEE\u6539\u5F53\u524D\u9875\u3001\u6574\u5957 PPT\uFF0C\u6216\u63D2\u5165\u65B0\u9875\u3002",instructionPlaceholder:"\u4F8B\u5982\uFF1A\u8BA9\u672C\u9875\u66F4\u89C6\u89C9\u5316\uFF1B\u589E\u52A0\u4E00\u9875\u7ADE\u54C1\u5BF9\u6BD4\uFF1B\u6574\u5957\u6539\u6210\u878D\u8D44\u8DEF\u6F14\u98CE\u683C\uFF1B\u5220\u9664\u91CD\u590D\u5185\u5BB9\u3002",reviseSlide:"\u4FEE\u6539\u672C\u9875",reviseDeck:"\u4FEE\u6539\u6574\u5957",insertSlide:"\u63D2\u5165\u65B0\u9875",aiRewrite:"\u6539\u5199",aiCondense:"\u538B\u7F29",aiProfessional:"\u4E13\u4E1A\u5316",aiMoreVisual:"\u66F4\u89C6\u89C9\u5316",aiNotes:"\u6F14\u8BB2\u5907\u6CE8",aiRedesign:"\u91CD\u6392\u672C\u9875",aiRestyleDeck:"\u91CD\u5851\u6574\u5957\u98CE\u683C",styleTitle:"\u98CE\u683C",themeLabel:"\u4E3B\u9898",themeExecutive:"\u9AD8\u7BA1",themeMarket:"\u5E02\u573A",themeMinimal:"\u6781\u7B80",themeStudio:"\u521B\u610F",densityLabel:"\u5BC6\u5EA6",densityCompact:"\u7D27\u51D1",densityStandard:"\u6807\u51C6",densitySpacious:"\u8212\u5C55",brandPrimaryLabel:"\u4E3B\u8272",brandAccentLabel:"\u5F3A\u8C03\u8272",imagePolicyLabel:"\u56FE\u7247\u7B56\u7565",imagePolicyPlaceholders:"\u53EF\u7F16\u8F91\u5360\u4F4D",imagePolicyNone:"\u4E0D\u4F7F\u7528\u56FE\u7247",ready:"\u51C6\u5907\u5C31\u7EEA\u3002",statusPillReady:"\u5C31\u7EEA",statusPillBusy:"AI",exportReady:"\u751F\u6210\u540E\u53EF\u5BFC\u51FA HTML \u548C\u53EF\u7F16\u8F91 PPTX\u3002",working:"AI \u6B63\u5728\u5904\u7406...",outlineReady:"\u5927\u7EB2\u5DF2\u751F\u6210\u3002\u53EF\u5148\u8C03\u6574\u5927\u7EB2\uFF0C\u518D\u751F\u6210\u8BBE\u8BA1\u7A3F\u3002",deckReady:"\u8BBE\u8BA1\u7A3F\u5DF2\u751F\u6210\u3002",aiUnavailable:"\u751F\u6210\u670D\u52A1\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002",sourceGroundingRequired:"\u6765\u6E90\u65E0\u6CD5\u9A8C\u8BC1\u3002\u5DF2\u751F\u6210\u201C\u5148\u9A8C\u8BC1\u201D\u7684\u6F14\u793A\u7A3F\uFF0C\u800C\u4E0D\u662F\u7F16\u9020\u4E8B\u5B9E\u3002",saved:"\u5DF2\u4FDD\u5B58\u3002",slideUpdated:"\u9875\u9762\u5DF2\u66F4\u65B0\u3002",deckUpdated:"\u6574\u5957\u5DF2\u66F4\u65B0\u3002",slideInserted:"\u65B0\u9875\u9762\u5DF2\u63D2\u5165\u3002",deckRestyled:"\u6574\u5957\u98CE\u683C\u5DF2\u66F4\u65B0\u3002",cannotDelete:"\u81F3\u5C11\u4FDD\u7559\u4E00\u9875\u3002",noSelection:"\u9009\u62E9\u4E00\u4E2A\u9875\u9762\u5143\u7D20\u540E\u53EF\u7F16\u8F91\u5185\u5BB9\u548C\u5E03\u5C40\u3002",elementTypeLabel:"\u7C7B\u578B",elementTextLabel:"\u6587\u5B57",elementItemsLabel:"\u6761\u76EE",elementDataLabel:"\u56FE\u8868\u6570\u636E",geometryLabel:"\u4F4D\u7F6E\u5C3A\u5BF8",styleLabel:"\u6837\u5F0F",speakerNotesLabel:"\u6F14\u8BB2\u5907\u6CE8",kickerLabel:"\u7709\u6807",claimLabel:"\u8BBA\u70B9",proofObjectLabel:"\u8BC1\u636E\u5BF9\u8C61",supportNoteLabel:"\u652F\u6491\u8BF4\u660E",sourceNoteLabel:"\u6765\u6E90\u8BF4\u660E",newSlideTitle:"\u65B0\u9875\u9762",defaultDeckTitle:"AI \u4EA7\u54C1\u6218\u7565",slidesMeta:"{{count}} \u9875",exportHtmlDone:"HTML \u6F14\u793A\u7A3F\u5DF2\u4E0B\u8F7D\u3002",exportHtmlWorking:"\u6B63\u5728\u5BFC\u51FA HTML...",exportHtmlFailed:"HTML \u5BFC\u51FA\u5931\u8D25\uFF1A",exportSavedTo:"\u5DF2\u5BFC\u51FA\u5230 {{path}}",exportPptxWorking:"\u6B63\u5728\u6E32\u67D3\u53EF\u7F16\u8F91 PPTX...",exportPptxDone:"\u53EF\u7F16\u8F91 PPTX \u5DF2\u4E0B\u8F7D\u3002",exportPptxFailed:"PPTX \u5BFC\u51FA\u5931\u8D25\uFF1A",exportPdfWorking:"\u6B63\u5728\u6E32\u67D3 PDF...",exportPdfDone:"PDF \u5DF2\u4E0B\u8F7D\u3002",exportPdfFailed:"PDF \u5BFC\u51FA\u5931\u8D25\uFF1A",exportPngWorking:"\u6B63\u5728\u6E32\u67D3 PNG \u9875\u9762...",exportPngDone:"PNG \u9875\u9762\u538B\u7F29\u5305\u5DF2\u4E0B\u8F7D\u3002",exportPngFailed:"PNG \u5BFC\u51FA\u5931\u8D25\uFF1A",exportDeckEmpty:"\u8BF7\u5148\u751F\u6210\u5E7B\u706F\u7247\u540E\u518D\u5BFC\u51FA\u3002",slidesEmptyHint:"\u751F\u6210\u540E\u9875\u9762\u7F29\u7565\u56FE\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002",welcomeTitle:"\u63CF\u8FF0\u4F60\u7684 PPT\uFF0C\u4E00\u952E\u5F00\u59CB",welcomeSubcopy:"\u4E00\u6761 Prompt \u5373\u53EF\u751F\u6210\u5927\u7EB2\u3001\u8BBE\u8BA1\u9875\u9762\u548C\u53EF\u7F16\u8F91\u6F14\u793A\u7A3F\uFF0C\u4E4B\u540E\u53EF\u9010\u9875\u7EE7\u7EED\u4FEE\u6539\u3002",welcomeTip1:"10 \u9875\u6218\u7565\u65B9\u6848",welcomeTip2:"\u6539\u6210\u6295\u8D44\u4EBA\u7248\u672C",welcomeTip3:"\u672C\u9875\u66F4\u89C6\u89C9\u5316",deleteSlideDefaultPrompt:"\u5220\u9664\u5F53\u524D\u9875\u9762\uFF0C\u5E76\u4FDD\u6301\u6574\u5957 PPT \u7ED3\u6784\u8FDE\u8D2F\u3002",prev:"\u4E0A\u4E00\u9875",next:"\u4E0B\u4E00\u9875",assistantHello:"\u544A\u8BC9\u6211\u4F60\u8981\u505A\u4EC0\u4E48 PPT\u3002\u6211\u4F1A\u5148\u751F\u6210\u5927\u7EB2\uFF0C\u518D\u53D8\u6210\u53EF\u7F16\u8F91\u9875\u9762\u3002",aiChatApplied:"\u5DF2\u628A\u6307\u4EE4\u5E94\u7528\u5230\u5F53\u524D\u9875\u9762\u3002",localMetricLabel:"\u9700\u8981\u8BB0\u4F4F\u7684\u4FE1\u53F7",mediaPlaceholder:"\u56FE\u7247\u5360\u4F4D",slidesUnit:"\u9875",closeConfirm:"\u786E\u8BA4\u65B9\u5411",closeOwner:"\u660E\u786E\u8D1F\u8D23\u4EBA",closeIteration:"\u542F\u52A8\u4E0B\u4E00\u8F6E\u8FED\u4EE3",pointClaimPrefix:"\u8BBA\u70B9\uFF1A",pointProofPrefix:"\u8BC1\u636E\u5BF9\u8C61\uFF1A",pointAudiencePrefix:"\u53D7\u4F17\u5173\u8054\uFF1A",pointEvidenceRule:"\u8BC1\u636E\u89C4\u5219\uFF1A\u660E\u786E\u6807\u6CE8\u5047\u8BBE",pointDesignRule:"\u8BBE\u8BA1\u89C4\u5219\uFF1A\u4E00\u4E2A\u4E3B\u89C6\u89C9\u52A0\u4E00\u4E2A\u652F\u6491\u680F",pointCloseRule:"\u6536\u675F\uFF1A\u8BF4\u6E05\u4E0B\u4E00\u6B65\u884C\u52A8",claimCover:"{{topic}} \u9700\u8981\u4E00\u6761\u6E05\u6670\u7684\u51B3\u7B56\u4E3B\u7EBF\uFF0C\u800C\u4E0D\u662F\u4FE1\u606F\u5806\u780C\u3002",claimPressure:"{{title}} \u662F\u53D7\u4F17\u5FC5\u987B\u89E3\u51B3\u7684\u5173\u952E\u538B\u529B\u70B9\u3002",claimDecision:"{{title}} \u4E4B\u6240\u4EE5\u91CD\u8981\uFF0C\u662F\u56E0\u4E3A\u5B83\u628A\u8BC1\u636E\u8FDE\u63A5\u5230\u884C\u52A8\u3002",claimProof:"{{title}} \u5FC5\u987B\u7531\u9875\u9762\u91CC\u7684\u4E3B\u8BC1\u636E\u5BF9\u8C61\u6765\u627F\u62C5\u8BBA\u8BC1\u3002",claimAction:"{{title}} \u6700\u540E\u8981\u843D\u5230\u4E00\u4E2A\u660E\u786E\u51B3\u7B56\u3001\u8D1F\u8D23\u4EBA\u6216\u4E0B\u4E00\u6B65\u3002",supportWithSource:"\u7528\u5DF2\u63D0\u4F9B\u7D20\u6750\u652F\u6491\u8FD9\u4E2A\u8BBA\u70B9\uFF0C\u5E76\u8BA9\u201C{{proof}}\u201D\u6210\u4E3A\u4E3B\u8BC1\u636E\u3002",supportWithAssumption:"\u8865\u5145\u4E00\u4E2A\u5177\u4F53\u4F8B\u5B50\u6216\u6307\u6807\uFF0C\u8BA9\u201C{{proof}}\u201D\u652F\u6491\u8BBA\u70B9\uFF0C\u800C\u4E0D\u662F\u586B\u5145\u6587\u5B57\u3002",sourceUserMaterial:"\u6765\u6E90\uFF1A\u7528\u6237\u63D0\u4F9B\u7D20\u6750",sourceDraftAssumption:"\u6765\u6E90\uFF1A\u8349\u7A3F\u5047\u8BBE\uFF1B\u5BF9\u5916\u4F7F\u7528\u524D\u9700\u786E\u8BA4",defaultSpeakerNote:"\u5148\u8BB2\u201C{{title}}\u201D\u7684\u7ED3\u8BBA\uFF0C\u518D\u7528\u4E00\u4E2A\u5177\u4F53\u4F8B\u5B50\u6216\u6570\u636E\u652F\u6491\u3002",proofMarketMap:"\u5E02\u573A\u5730\u56FE",proofOperatingModel:"\u8FD0\u8425\u6A21\u578B",proofRiskBridge:"\u98CE\u9669\u6865",proofDecisionTable:"\u51B3\u7B56\u8868",proofBeforeAfter:"\u524D\u540E\u5BF9\u6BD4\u6D41\u7A0B",proofValueBridge:"\u4EF7\u503C\u6865",proofCustomerProof:"\u5BA2\u6237\u8BC1\u636E",proofImplementationPlan:"\u5B9E\u65BD\u8BA1\u5212",proofMetricBridge:"\u6307\u6807\u6865",proofTrendChart:"\u8D8B\u52BF\u56FE",proofSourceSummary:"\u6765\u6E90\u6458\u8981",proofVerificationPlan:"\u9A8C\u8BC1\u8BA1\u5212",proofCapabilityMatrix:"\u80FD\u529B\u77E9\u9635",proofEvidenceList:"\u8BC1\u636E\u5217\u8868",proofVarianceTable:"\u5DEE\u5F02\u8868",proofRiskRegister:"\u98CE\u9669\u6E05\u5355",proofConceptMap:"\u6982\u5FF5\u56FE",proofWorkedExample:"\u6848\u4F8B\u6F14\u7B97",proofComparison:"\u5BF9\u6BD4",proofPracticePrompt:"\u7EC3\u4E60\u63D0\u793A",proofMarketWedge:"\u5E02\u573A\u5207\u5165\u70B9",proofProductDiagram:"\u4EA7\u54C1\u56FE",proofTractionChart:"\u7275\u5F15\u529B\u56FE\u8868",proofMilestonePlan:"\u91CC\u7A0B\u7891\u8BA1\u5212",proofVisualProof:"\u89C6\u89C9\u8BC1\u636E",sourceFetchedNote:"\u6765\u6E90\uFF1A\u5DF2\u8BFB\u53D6 {{count}} \u4E2A URL",bpContextTitle:"{{topic}} \u9700\u8981\u5148\u5EFA\u7ACB\u5728\u6765\u6E90\u4E8B\u5B9E\u4E4B\u4E0A\uFF0C\u518D\u63D0\u51FA\u5224\u65AD\u3002",bpSourceNeededTitle:"{{topic}} \u9700\u8981\u8865\u5145\u6765\u6E90\u7D20\u6750\u540E\u624D\u80FD\u63D0\u51FA\u4E8B\u5B9E\u6027\u7ED3\u8BBA\u3002",bpProblemTitle:"\u5F53\u524D\u5173\u952E\u95EE\u9898\u662F\uFF1A\u53D7\u4F17\u53EF\u4EE5\u5B89\u5168\u76F8\u4FE1\u4EC0\u4E48\u3002",bpSolutionTitle:"{{topic}} \u5E94\u901A\u8FC7\u80FD\u529B\u3001\u6D41\u7A0B\u548C\u8BC1\u636E\u6765\u89E3\u91CA\u3002",bpWorkflowTitle:"\u5DE5\u4F5C\u6D41\u9700\u8981\u5C55\u793A\u4EA7\u54C1\u5982\u4F55\u4E00\u6B65\u6B65\u521B\u9020\u4EF7\u503C\u3002",bpProofTitle:"\u53EF\u4FE1\u5EA6\u5E94\u8BE5\u7531\u6765\u6E90\u8BC1\u636E\u627F\u62C5\uFF0C\u800C\u4E0D\u662F\u7531\u5047\u56FE\u8868\u627F\u62C5\u3002",bpVerificationTitle:"\u9A8C\u8BC1\u7F3A\u53E3\u5FC5\u987B\u663E\u6027\u5C55\u793A\uFF0C\u4E0D\u80FD\u85CF\u5728\u865A\u6784\u56FE\u8868\u540E\u9762\u3002",bpRiskTitle:"\u6700\u5927\u98CE\u9669\u662F\u8D85\u51FA\u5DF2\u6709\u7D20\u6750\u8FC7\u5EA6\u58F0\u79F0\u3002",bpDecisionTitle:"\u4E0B\u4E00\u6B65\u662F\u9A8C\u8BC1\u5173\u952E\u8BBA\u70B9\uFF0C\u5E76\u9009\u62E9\u6700\u5F3A\u53D9\u4E8B\u8DEF\u5F84\u3002",bpSupportSource:"\u57FA\u4E8E\u5DF2\u8BFB\u53D6\u6216\u7C98\u8D34\u7D20\u6750\u751F\u6210\uFF1B\u5BF9\u5916\u4F7F\u7528\u524D\u8BF7\u6838\u5BF9\u539F\u6587\u3002",bpSupportMissing:"\u7D20\u6750\u4E0D\u8DB3\uFF1B\u672C\u9875\u5E94\u4F5C\u4E3A\u9A8C\u8BC1\u63D0\u793A\uFF0C\u800C\u4E0D\u662F\u4E8B\u5B9E\u7ED3\u8BBA\u3002",bpMissingFact1:"\u8BF7\u7C98\u8D34\u6765\u6E90\u7B14\u8BB0\u3001README\u3001\u6307\u6807\u6216\u4EA7\u54C1\u63CF\u8FF0\u6765\u652F\u6491\u672C\u9875\u3002",bpMissingFact2:"\u4E0D\u8981\u4F7F\u7528\u865A\u6784\u6307\u6807\uFF1B\u7528\u5DF2\u9A8C\u8BC1\u8BC1\u636E\u66FF\u6362\u5360\u4F4D\u5185\u5BB9\u3002",bpMissingFact3:"\u7528\u672C\u9875\u51B3\u5B9A\u4E0B\u4E00\u6B65\u9700\u8981\u8865\u5145\u7814\u7A76\u4EC0\u4E48\u3002",qualityOutOfBounds:"\u6709\u5143\u7D20\u8D85\u51FA\u5E7B\u706F\u7247\u5B89\u5168\u533A\u57DF\u3002",qualityTextDense:"\u5F53\u524D\u7248\u5F0F\u4E2D\u7684\u53EF\u89C1\u6587\u5B57\u53EF\u80FD\u8FC7\u5BC6\u3002",qualityChartUngrounded:"\u56FE\u8868\u6570\u636E\u7F3A\u5C11\u6765\u6E90\u6570\u5B57\uFF0C\u5DF2\u79FB\u9664\u6216\u6807\u8BB0\u3002",qualityOverlap:"\u6587\u5B57\u6216\u56FE\u8868\u5143\u7D20\u53EF\u80FD\u53D1\u751F\u91CD\u53E0\u3002",qualityMissingClaim:"\u672C\u9875\u9700\u8981\u4E00\u4E2A\u6E05\u6670\u8BBA\u70B9\u3002",qualityReportTitle:"\u8D28\u91CF\u62A5\u544A",qualityNeedsReview:"\u9700\u8981\u590D\u6838",qualityHasWarnings:"\u8D28\u91CF\u63D0\u9192",exportFormatUnavailable:"\u8BE5\u5BFC\u51FA\u683C\u5F0F\u5C1A\u672A\u652F\u6301\u3002",exportTitle:"\u5BFC\u51FA",exportCancel:"\u53D6\u6D88",exportConfirm:"\u5BFC\u51FA\u6587\u4EF6",exportPreviewPrevAria:"\u4E0A\u4E00\u9875",exportPreviewNextAria:"\u4E0B\u4E00\u9875",exportFormat:"\u683C\u5F0F",exportQuality:"\u8D28\u91CF",exportDpi:"\u56FE\u7247 DPI",exportRange:"\u5E7B\u706F\u7247\u8303\u56F4",exportShare:"\u5206\u4EAB",propertiesStyle:"\u6837\u5F0F",propertiesLayout:"\u5E03\u5C40",propertiesAnimation:"\u52A8\u753B",propertiesThemeColor:"\u4E3B\u9898\u8272",propertiesFont:"\u5B57\u4F53",propertiesColorMode:"\u5E7B\u706F\u7247\u914D\u8272",propertiesStylePreset:"\u98CE\u683C\u9884\u8BBE",colorModeLight:"\u6D45\u8272",colorModeDark:"\u6DF1\u8272",fontSansSerif:"\u975E\u886C\u7EBF",fontSerif:"\u886C\u7EBF",propertiesDensity:"\u5BC6\u5EA6",propertiesSmartAlign:"\u667A\u80FD\u5BF9\u9F50",propertiesPageTransition:"\u9875\u9762\u8FC7\u6E21",propertiesElementAnimation:"\u5143\u7D20\u52A8\u753B",densityLoose:"\u5BBD\u677E"}};function lr(){let e=window.app?.locale||document.documentElement.lang||"";return e==="zh-CN"||String(e).startsWith("zh")?"zh-CN":"en-US"}function O(e,t={}){let r=fs[lr()]||fs["en-US"],n=fs["en-US"][e]||e,i=r[e]||n;return Object.entries(t).forEach(([a,o])=>{i=i.replaceAll(`{{${a}}}`,String(o))}),i}var xh=["clean-business","insight-report"],Fa={"clean-business":{styleKey:"clean-business",names:{"en-US":"Clean Business","zh-CN":"\u7B80\u6D01\u5546\u52A1"},descriptions:{"en-US":"Calm editorial product-doc: warm canvas, charcoal type, one restrained accent, typography-led","zh-CN":"\u5E73\u9759\u7F16\u8F91\u611F\u4EA7\u54C1\u6587\u6863\uFF1A\u6696\u767D\u753B\u5E03\u3001\u70AD\u9ED1\u5B57\u9636\u3001\u5355\u4E00\u514B\u5236\u5F3A\u8C03\u8272\uFF0C\u6392\u7248\u5373\u89C6\u89C9"},colorMode:"light",palette:{background:"#FAFAF7",ink:"#111111",muted:"#787774",primary:"#1E293B",accent:"#0f766e",panel:"#F3F2EF"},fontFamily:"sans",density:"spacious",keywords:/business|clean|professional|商务|简洁|专业|企业/},"insight-report":{styleKey:"insight-report",names:{"en-US":"Insight Report","zh-CN":"\u6D1E\u5BDF\u6C47\u62A5"},descriptions:{"en-US":"Analytical memo on a slide: full sentences, explicit frameworks, evidence-dense tables","zh-CN":"\u5206\u6790\u5907\u5FD8\u5F55\u4E0A\u5899\uFF1A\u5B8C\u6574\u8BBA\u8BC1\u3001\u663E\u6027\u6846\u67B6\u3001\u6EE1\u7248\u8BC1\u636E\uFF0C\u50CF\u5C3D\u8C03\u9644\u5F55\u800C\u975E bullet \u6F14\u8BB2"},colorMode:"light",palette:{background:"#ffffff",ink:"#1f2937",muted:"#64748b",primary:"#1e3a8a",accent:"#dc2626",panel:"#f1f5f9"},fontFamily:"sans",density:"compact",keywords:/insight|consult|academic|research|whitepaper|due.*diligence|洞察|咨询|学术|调研|详尽|深度分析|尽调/}},un="clean-business";function hs(e){return e&&Fa[e]?e:un}function ps(e){return Fa[hs(e)]}var ai={background:"#111111",ink:"#F5F5F4",muted:"#A8A29E",primary:"#93C5FD",accent:"#2DD4BF",panel:"#1C1C1C"};function Cc(e,t="light"){let r=e?.palette||{};return t!=="dark"?{...r}:e?.paletteDark&&typeof e.paletteDark=="object"?{...e.paletteDark}:{background:ai.background,ink:ai.ink,muted:ai.muted,primary:r.primary||ai.primary,accent:r.accent||ai.accent,panel:ai.panel}}function Sh(e){return e==="zh-CN"?"zh-CN":"en-US"}function kc(e){let t=Sh(e);return xh.filter(r=>Fa[r]).map(r=>{let n=Fa[r];return{key:r,displayName:n.names[t]||n.names["en-US"],description:n.descriptions[t]||n.descriptions["en-US"],colorMode:n.colorMode}})}var Bi="pptLiveStudioStateV6",vs="pptLiveDeckHistoryV1",Dc=6,ys=["text","list","shape","metric","chart","media"],gs={executive:{name:"Executive",background:"#fbfcff",ink:"#111827",muted:"#5b6575",primary:"#0f766e",accent:"#f97316",panel:"#ffffff"},market:{name:"Market",background:"#fffdf7",ink:"#1f2937",muted:"#6b5f50",primary:"#2563eb",accent:"#d97706",panel:"#ffffff"},minimal:{name:"Minimal",background:"#f8fafc",ink:"#0f172a",muted:"#64748b",primary:"#334155",accent:"#0f766e",panel:"#ffffff"},studio:{name:"Studio",background:"#fcfbff",ink:"#1f1630",muted:"#6c607a",primary:"#7c3aed",accent:"#db2777",panel:"#ffffff"}};function yr(e="id"){return`${e}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function Xr(e){return JSON.parse(JSON.stringify(e))}function mt(e,t,r){return Math.max(t,Math.min(r,e))}function Be(e){return String(e??"").replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function bs(){return{topic:"",slideTarget:0}}function Ec(e="strategy"){let t={strategy:{profile:"strategy-leadership",thesis:"Decision-led transformation narrative",proofObjects:["market map","operating model","risk bridge","decision table"],arc:["thesis","context","friction","strategic bet","operating model","proof","risks","decision"]},sales:{profile:"gtm-growth",thesis:"Buyer pain to differentiated value narrative",proofObjects:["before/after workflow","value bridge","customer proof","implementation plan"],arc:["outcome","market shift","pain","solution","proof","commercial case","rollout","call to action"]},report:{profile:"finance-ir",thesis:"Executive performance narrative with decisions attached",proofObjects:["metric bridge","trend chart","variance table","risk register"],arc:["summary","scorecard","movement","root cause","metric proof","risk","plan","decision"]},teaching:{profile:"education",thesis:"Concept to application learning journey",proofObjects:["concept map","worked example","comparison","practice prompt"],arc:["goal","map","concept","example","mistakes","practice","summary","next step"]},fundraising:{profile:"fundraising",thesis:"Venture-scale opportunity supported by traction evidence",proofObjects:["market wedge","product diagram","traction chart","milestone plan"],arc:["thesis","problem","solution","market","product","traction","model","ask"]}};return t[e]||t.strategy}function zn(e="standard"){let t=String(e||"standard");return t==="loose"?"spacious":["compact","standard","spacious"].includes(t)?t:"standard"}var ms=["spacious","standard","compact"];function Ea(e="standard"){let t=zn(e),r=ms.indexOf(t);return r>=0?r:1}function Rc(e=1){let t=Math.min(Math.max(Math.round(Number(e)),0),ms.length-1);return ms[t]||"standard"}function Lc(e="standard"){let t=zn(e),r={spacious:{bulletLimit:4,cardColumns:3,cardGap:2},standard:{bulletLimit:5,cardColumns:4,cardGap:1.8},compact:{bulletLimit:6,cardColumns:4,cardGap:1.2}};return r[t]||r.standard}function Pc(e=0){let t=Number(e);return!Number.isFinite(t)||t<=0?0:mt(t,3,24)}function ws(){return{theme:"executive",density:"standard",fontFamily:"sans",colorMode:"light",stylePreset:"clean-business"}}function Bc(){return[O("defaultDeckTitle"),"Why now","Current friction","Strategic answer","Core workflow","Proof and impact","Rollout plan","Decision and next steps"]}function On(){return{schemaVersion:Dc,sessionId:yr("deck"),title:O("blankDeckTitle"),brief:bs(),promptDraft:"",lastSubmittedPrompt:"",agentSession:{id:"",workspaceSubdir:"",runId:"",skillKey:""},style:ws(),outline:[],sources:{items:[],facts:[],warnings:[],summary:"",fetchedAt:0},slides:[],activeSlideId:"",selectedElementId:"",mode:"edit",presentIndex:0,status:"ready",generation:{active:!1,current:"idle",steps:Nc().map(t=>({...t,status:"pending"})),events:[]},chatMessages:[{role:"assistant",text:O("assistantHello")}],updatedAt:Date.now()}}function Un(e){let t={...On(),...e||{}};t.schemaVersion=Dc;let r=t.brief||{};t.brief={...bs(),topic:String(r.topic||t.promptDraft||"").trim(),slideTarget:Pc(r.slideTarget)},t.promptDraft=typeof t.promptDraft=="string"?t.promptDraft:"",t.lastSubmittedPrompt=typeof t.lastSubmittedPrompt=="string"?t.lastSubmittedPrompt:"",t.agentSession={id:String(t.agentSession?.id||""),workspaceSubdir:String(t.agentSession?.workspaceSubdir||""),runId:String(t.agentSession?.runId||""),skillKey:String(t.agentSession?.skillKey||"")},t.style={...ws(),...t.style||{}},delete t.style.brandPrimary,delete t.style.brandAccent,Object.keys(gs).includes(t.style.theme)||(t.style.theme="executive"),["compact","standard","spacious","loose"].includes(t.style.density)||(t.style.density="standard"),t.style.density=zn(t.style.density),["sans","serif"].includes(t.style.fontFamily)||(t.style.fontFamily=t.style.fontFamily==="serif"?"serif":"sans"),["light","dark"].includes(t.style.colorMode)||(t.style.colorMode="light"),t.style.stylePreset=hs(typeof t.style.stylePreset=="string"?t.style.stylePreset:""),t.generation=Ra(t.generation),t.sources=Ch(t.sources),t.brief.slideTarget=Pc(t.brief.slideTarget);let n=t.generation.active&&Array.isArray(t.slides)&&t.slides.length===0;t.outline=n?[]:Array.isArray(t.outline)?t.outline.map(a=>String(a||O("newSlideTitle"))):[],t.slides=n?[]:Array.isArray(t.slides)&&t.slides.length>0?t.slides.map((a,o)=>Hr(a,o,t)):t.outline.length>0?t.outline.map((a,o)=>xs(a,o,t.outline.length,t)):[],t.slides.some(a=>a.id===t.activeSlideId)||(t.activeSlideId=t.slides[0]?.id||"");let i=_t(t);return i?.elements.some(a=>a.id===t.selectedElementId)||(t.selectedElementId=i?.elements[0]?.id||""),t.title=t.title||t.slides[0]?.title||O("defaultDeckTitle"),t.updatedAt=Date.now(),t}function Ch(e={}){return{items:Array.isArray(e.items)?e.items:[],facts:Array.isArray(e.facts)?e.facts:[],warnings:Array.isArray(e.warnings)?e.warnings:[],summary:typeof e.summary=="string"?e.summary:"",fetchedAt:Number(e.fetchedAt||0)}}function Nc(){return[{id:"brief",label:O("generationStepBrief"),detail:O("generationStepBriefDetail")},{id:"spine",label:O("generationStepSpine"),detail:O("generationStepSpineDetail")},{id:"proof",label:O("generationStepProof"),detail:O("generationStepProofDetail")},{id:"design",label:O("generationStepDesign"),detail:O("generationStepDesignDetail")},{id:"compile",label:O("generationStepCompile"),detail:O("generationStepCompileDetail")}]}var kh=80;function Ph(e={}){let t=typeof e=="string"?{title:e}:e||{},r=String(t.title||t.label||t.message||O("processEventUnknown")).trim()||O("processEventUnknown"),n=String(t.kind||"info").toLowerCase().replace(/[^a-z0-9-]/g,"")||"info",i=Number(t.timestamp||t.time||0)||Date.now();return{id:String(t.id||yr("generation-event")),seq:Number(t.seq)||0,title:r,detail:String(t.detail||t.description||"").trim(),kind:n,timestamp:i}}function Ra(e={}){let t=new Map((Array.isArray(e.steps)?e.steps:[]).map(i=>[i.id,i])),r=Array.isArray(e.events)?e.events.map(Ph).slice(-kh):[],n=r.reduce((i,a)=>Math.max(i,Number(a.seq)||0),0);return{active:!!e.active,current:e.current||"idle",draftedCount:Number(e.draftedCount)||0,slideTarget:Number(e.slideTarget)||0,eventSeq:Math.max(Number(e.eventSeq)||0,n),steps:Nc().map(i=>({...i,status:t.get(i.id)?.status||"pending"})),events:r}}function _t(e){return e.slides.find(t=>t.id===e.activeSlideId)||e.slides[0]}function er(e){return Math.max(0,e.slides.findIndex(t=>t.id===e.activeSlideId))}function Wn(e){return _t(e)?.elements.find(r=>r.id===e.selectedElementId)||null}function xs(e,t,r,n={brief:bs(),style:ws(),slides:[]}){let i=Ic(n,t),a={id:yr("slide"),title:e||`${O("newSlideTitle")} ${t+1}`,subtitle:"",kicker:zc(t,n),claim:Cs(e,t,n),proofObject:Na(t,n),supportNote:Oc(e,t,n),sourceNote:Uc(n),notes:O("defaultSpeakerNote",{title:e}),layout:Mc(t,r),theme:i,elements:[]};return a.elements=Wc(a,t,r,n),Hr(a,t,n)}function Hr(e,t,r){let n=e?.title||`${O("newSlideTitle")} ${t+1}`,i={id:e?.id||yr("slide"),title:n,subtitle:e?.subtitle||"",kicker:String(e?.kicker||zc(t,r)),claim:String(e?.claim||Cs(n,t,r)),proofObject:String(e?.proofObject||Na(t,r)),supportNote:String(e?.supportNote||Oc(n,t,r)),sourceNote:String(e?.sourceNote||Uc(r)),notes:e?.notes||"",layout:e?.layout||Mc(t,r?.slides?.length||1),theme:{...Ic(r,t),...e?.theme||e?.style||{}},html:typeof e?.html=="string"?e.html:"",quality:Fh(e?.quality),elements:[]},a=Array.isArray(e?.elements)&&e.elements.length>0?e.elements:Wc(i,t,r?.slides?.length||1,r);if(i.elements=a.map(o=>Ss(o)),i.html){let o=Ba(i.html);o&&(i.theme.background=o)}return i}function Fh(e={}){let t=Array.isArray(e?.issues)?e.issues:[];return{score:mt(Number(e?.score??100),0,100),issues:t.slice(0,12).map(r=>({id:String(r?.id||yr("quality")),severity:["high","medium","low"].includes(r?.severity)?r.severity:"low",type:String(r?.type||"quality"),message:String(r?.message||"")})).filter(r=>r.message)}}function Ss(e={}){let t=ys.includes(e.type)?e.type:"text",r=La(t);return{...r,...e,id:e.id||yr("el"),type:t,x:mt(Number(e.x??r.x),0,98),y:mt(Number(e.y??r.y),0,98),w:mt(Number(e.w??r.w),3,100),h:mt(Number(e.h??r.h),3,100),text:typeof e.text=="string"?e.text:r.text,label:typeof e.label=="string"?e.label:r.label,items:Array.isArray(e.items)?e.items.map(String):r.items,data:Array.isArray(e.data)?e.data.map(Th):r.data,style:Dh({...r.style,...e.style||{}})}}function Th(e,t){return typeof e=="number"?{label:`Q${t+1}`,value:e}:{label:String(e?.label||`Item ${t+1}`),value:Number(e?.value||0)}}function Dh(e={}){return{fontSize:mt(Number(e.fontSize||24),8,88),fontWeight:mt(Number(e.fontWeight||600),100,900),color:e.color||"ink",background:e.background||"transparent",opacity:mt(Number(e.opacity??1),0,1),borderRadius:mt(Number(e.borderRadius||0),0,99),align:e.align||"left"}}function La(e){let t={text:{text:"Key message",label:"",items:[],data:[],x:8,y:12,w:60,h:16,style:{fontSize:38,fontWeight:780,color:"ink",background:"transparent",borderRadius:0,opacity:1,align:"left"}},list:{text:"",label:"",items:["First point","Second point","Third point"],data:[],x:9,y:36,w:48,h:40,style:{fontSize:20,fontWeight:500,color:"ink",background:"transparent",borderRadius:8,opacity:1,align:"left"}},shape:{text:"",label:"",items:[],data:[],x:66,y:14,w:24,h:62,style:{fontSize:18,fontWeight:600,color:"accent",background:"primary",borderRadius:22,opacity:.12,align:"center"}},metric:{text:"3x",label:"Faster first draft",items:[],data:[],x:63,y:42,w:26,h:26,style:{fontSize:44,fontWeight:820,color:"primary",background:"panel",borderRadius:14,opacity:1,align:"left"}},chart:{text:"Signal trend",label:"",items:[],data:[{label:"Now",value:42},{label:"Next",value:68},{label:"Target",value:86}],x:52,y:36,w:36,h:32,style:{fontSize:18,fontWeight:700,color:"ink",background:"panel",borderRadius:14,opacity:1,align:"left"}},media:{text:O("mediaPlaceholder"),label:"",items:[],data:[],x:58,y:18,w:32,h:42,style:{fontSize:16,fontWeight:650,color:"muted",background:"soft",borderRadius:16,opacity:1,align:"center"}}};return{...Xr(t[e]||t.text),type:t[e]?e:"text"}}function Ic(e,t=0){let r=e?.deckPalette;if(r&&typeof r=="object"){let o=r.primary||"#111111",l=r.accent||"#c84b31";return Fc({name:"deck",background:r.background||"#111111",ink:r.ink||"#f8fafc",muted:r.muted||"#cbd5e1",primary:t%2?l:o,accent:t%2?o:l,panel:r.panel||"#1f2937"})}let n=gs[e?.style?.theme||"executive"]||gs.executive,i=n.primary,a=n.accent;return Fc({...n,primary:t%2?a:i,accent:t%2?i:a})}function Ba(e){let t=String(e||""),r=[/body\s*\{[^}]*background(?:-color)?\s*:\s*([^;}\n]+)/i,/]*style="[^"]*background(?:-color)?\s*:\s*([^;"']+)/i,/html\s*\{[^}]*background(?:-color)?\s*:\s*([^;}\n]+)/i,/:root\s*\{[^}]*background(?:-color)?\s*:\s*([^;}\n]+)/i,/background(?:-color)?\s*:\s*(#[0-9a-f]{3,8}|rgb[a]?\([^)]+\)|hsl[a]?\([^)]+\)|black|white)/i];for(let n of r){let i=t.match(n);if(!i)continue;let a=Eh(i[1]);if(a)return a}return null}function Eh(e){let t=String(e||"").trim().replace(/\s+!important$/i,"");if(!t||/^transparent$/i.test(t))return null;if(/^#[0-9a-f]{3,8}$/i.test(t))return fn(t,t);if(/^rgb/i.test(t)||/^hsl/i.test(t))return t;let r={black:"#000000",white:"#ffffff",transparent:null};return Object.prototype.hasOwnProperty.call(r,t.toLowerCase())?r[t.toLowerCase()]:t}function Fc(e){let t=fn(e.background,"#ffffff"),r=fn(e.panel,"#ffffff");return{...e,background:t,panel:r,ink:Ta(t,e.ink,"#111827","#f8fafc",7),muted:Ta(t,e.muted,"#4b5563","#cbd5e1",4.5),primary:Ta(r,e.primary,"#0f766e","#5eead4",4.5),accent:Ta(r,e.accent,"#c2410c","#fdba74",4.5)}}function Ta(e,t,r,n,i){let a=fn(e,"#ffffff"),o=fn(t,r);if(As(a,o)>=i)return o;let l=fn(r,"#111827"),c=fn(n,"#f8fafc");return As(a,l)>=As(a,c)?l:c}function As(e,t){let r=Tc(e),n=Tc(t),i=Math.max(r,n),a=Math.min(r,n);return(i+.05)/(a+.05)}function Tc(e){let{r:t,g:r,b:n}=Rh(e);return[t,r,n].map(i=>{let a=i/255;return a<=.03928?a/12.92:((a+.055)/1.055)**2.4}).reduce((i,a,o)=>i+a*[.2126,.7152,.0722][o],0)}function fn(e,t){let r=String(e||"").trim(),n=r.match(/^#([0-9a-f]{3})$/i);return n?`#${n[1].split("").map(i=>i+i).join("")}`.toLowerCase():/^#[0-9a-f]{6}$/i.test(r)?r.toLowerCase():t}function Rh(e){let t=fn(e,"#000000").slice(1),r=parseInt(t,16);return{r:r>>16&255,g:r>>8&255,b:r&255}}function Mc(e,t){return e===0?"cover":e===t-1?"closing":["split","metric","process","comparison"][e%4]}function zc(e,t){let r=Ec();return(r.arc[e%r.arc.length]||"proof").replace(/[-_]/g," ").toUpperCase()}function Na(e,t){let r=Ec(),n=r.proofObjects[e%r.proofObjects.length]||"visual proof";return{"market map":O("proofMarketMap"),"operating model":O("proofOperatingModel"),"risk bridge":O("proofRiskBridge"),"decision table":O("proofDecisionTable"),"before/after workflow":O("proofBeforeAfter"),"value bridge":O("proofValueBridge"),"customer proof":O("proofCustomerProof"),"implementation plan":O("proofImplementationPlan"),"metric bridge":O("proofMetricBridge"),"trend chart":O("proofTrendChart"),"variance table":O("proofVarianceTable"),"risk register":O("proofRiskRegister"),"concept map":O("proofConceptMap"),"worked example":O("proofWorkedExample"),comparison:O("proofComparison"),"practice prompt":O("proofPracticePrompt"),"market wedge":O("proofMarketWedge"),"product diagram":O("proofProductDiagram"),"traction chart":O("proofTractionChart"),"milestone plan":O("proofMilestonePlan"),"visual proof":O("proofVisualProof")}[n]||n}function Cs(e,t,r){let n=r?.brief?.topic||r?.title||e;if(t===0)return O("claimCover",{topic:n});if(e&&/[.!?。!?]$/.test(e.trim()))return e;let i=[O("claimPressure",{title:e}),O("claimDecision",{title:e}),O("claimProof",{title:e}),O("claimAction",{title:e})];return i[t%i.length]}function Oc(e,t,r){let n=Na(t,r);return O("supportWithAssumption",{proof:n})}function Uc(e){return O("sourceDraftAssumption")}function Wc(e,t,r,n){let i=e.title,a=Lc(n?.style?.density),o=Bh(i,t,n).slice(0,a.bulletLimit).map(c=>String(c).slice(0,90)),l=Lh(e,t,r);return l==="cover"?[Tt("shape",{x:6,y:9,w:88,h:76,style:{background:"soft",opacity:1,borderRadius:28}}),Tt("shape",{x:9,y:15,w:1.2,h:55,style:{background:"primary",opacity:1,borderRadius:99}}),Tt("text",{text:e.kicker,x:13,y:15,w:22,h:5,style:{fontSize:10,fontWeight:760,color:"primary"}}),Tt("text",{text:i,x:13,y:23,w:58,h:25,style:{fontSize:i.length>48?34:44,fontWeight:840}}),Tt("text",{text:e.claim,x:14,y:55,w:45,h:11,style:{fontSize:18,fontWeight:520,color:"muted"}}),Tt("metric",{text:String(r),label:O("slidesUnit"),x:75,y:54,w:14,h:17,style:{fontSize:34}})]:l==="closing"?[Tt("text",{text:i,x:9,y:15,w:65,h:15,style:{fontSize:i.length>48?30:38,fontWeight:820}}),Tt("text",{text:e.claim,x:10,y:33,w:46,h:9,style:{fontSize:17,fontWeight:540,color:"muted"}}),...Da([O("closeConfirm"),O("closeOwner"),O("closeIteration")],10,50,52,22,3),Tt("text",{text:o[0]||e.supportNote,x:67,y:48,w:22,h:20,style:{fontSize:18,fontWeight:720,color:"primary",background:"soft",borderRadius:20}})]:l==="process"?[Tt("text",{text:i,x:8,y:10,w:68,h:12,style:{fontSize:32,fontWeight:820}}),Tt("text",{text:e.claim,x:9,y:25,w:54,h:7,style:{fontSize:15,fontWeight:520,color:"muted"}}),Tt("shape",{x:10,y:50,w:78,h:1.2,style:{background:"primary",opacity:.25,borderRadius:99}}),...Da(o.map((c,s)=>`0${s+1} ${c}`),10,37,78,28,Math.min(a.cardColumns,Math.max(2,o.length)),a.cardGap)]:l==="comparison"?[Tt("text",{text:i,x:7,y:10,w:72,h:12,style:{fontSize:32,fontWeight:820}}),Tt("text",{text:e.claim,x:8,y:25,w:48,h:7,style:{fontSize:15,fontWeight:520,color:"muted"}}),...Da(o,8,37,82,30,2,a.cardGap)]:l==="data"?[Tt("text",{text:i,x:8,y:10,w:66,h:12,style:{fontSize:32,fontWeight:820}}),Tt("text",{text:e.claim,x:9,y:25,w:47,h:7,style:{fontSize:15,fontWeight:520,color:"muted"}}),Tt("metric",{text:String(t).padStart(2,"0"),label:e.proofObject,x:10,y:40,w:34,h:28,style:{fontSize:44}}),Tt("text",{text:o[0]||e.supportNote,x:69,y:41,w:20,h:24,style:{fontSize:17,fontWeight:700,color:"primary",background:"soft",borderRadius:18}})]:l==="cards"?[Tt("text",{text:i,x:8,y:10,w:68,h:12,style:{fontSize:32,fontWeight:820}}),Tt("text",{text:e.claim,x:9,y:25,w:51,h:8,style:{fontSize:15,fontWeight:520,color:"muted"}}),...Da(o,9,38,78,28,a.cardColumns,a.cardGap)]:[Tt("text",{text:i,x:10,y:15,w:62,h:15,style:{fontSize:i.length>48?30:38,fontWeight:820}}),Tt("text",{text:e.claim,x:11,y:34,w:42,h:10,style:{fontSize:17,fontWeight:520,color:"muted"}}),Tt("text",{text:o[0]||e.supportNote,x:58,y:38,w:28,h:24,style:{fontSize:22,fontWeight:760,color:"primary",background:"soft",borderRadius:22}}),Tt("shape",{x:10,y:72,w:18,h:.6,style:{background:"primary",opacity:1,borderRadius:99}})]}function Lh(e,t,r){let n=[e.layout,e.kicker,e.proofObject,e.claim,e.title].join(" ").toLowerCase();return t===0||e.layout==="cover"?"cover":t===r-1||e.layout==="closing"?"closing":/process|workflow|timeline|roadmap|journey|steps|architecture|flow|流程|步骤|路线|架构/.test(n)?"process":/compare|comparison|versus|matrix|before|after|risk|对比|比较|矩阵|风险/.test(n)?"comparison":/data|metric|trend|scorecard|chart|number|数据|指标|趋势/.test(n)?"data":t%3===1?"cards":"spotlight"}function Da(e,t,r,n,i,a,o=2.5){let l=e.filter(Boolean),c=Math.max(1,Math.min(a||1,l.length||1)),s=Number.isFinite(o)?o:2.5,d=Math.max(1,Math.ceil((l.length||1)/c)),u=(n-s*(c-1))/c,p=(i-s*(d-1))/d;return l.map((f,h)=>Tt("text",{text:f,x:t+h%c*(u+s),y:r+Math.floor(h/c)*(p+s),w:u,h:p,style:{fontSize:17,fontWeight:h===0?760:620,color:h===0?"primary":"ink",background:h===0?"soft":"panel",borderRadius:18}}))}function Tt(e,t){let r=La(e);return{...r,...t,style:{...r.style,...t.style||{}}}}function Bh(e,t,r){let n=r?.brief?.topic||e,i=Na(t,r),a=[`${O("pointClaimPrefix")} ${Cs(e,t,r)}`,`${O("pointProofPrefix")} ${i}`,`${O("pointAudiencePrefix")} ${n}`,O("pointEvidenceRule"),O("pointDesignRule"),O("pointCloseRule")],o=Lc(r?.style?.density).bulletLimit,l=[];for(let c=0;c{t!==e&&Ia(t)})}function ks(e){let t=e.querySelector(".ppt-flat-select__menu"),r=e.querySelector(".ppt-flat-select__trigger");if(!t||!r)return;let n=r.getBoundingClientRect(),i=Math.min(220,t.scrollHeight||220),a=window.innerHeight-n.bottom,o=aa;t.style.left=`${Math.max(8,n.left)}px`,t.style.width=`${n.width}px`,o?(t.style.top="auto",t.style.bottom=`${window.innerHeight-n.top+4}px`):(t.style.top=`${n.bottom+4}px`,t.style.bottom="auto")}function Gc(e){let t=e.querySelector(".ppt-flat-select__menu"),r=e.querySelector(".ppt-flat-select__trigger");if(!t||!r)return;Ma(null),t.hidden=!1,ks(e),r.setAttribute("aria-expanded","true"),e.classList.add("is-open"),oi.add(e),t.querySelector(".ppt-flat-select__option.is-selected")?.scrollIntoView({block:"nearest"})}function Nh(e,t){let r=e.querySelector(".ppt-flat-select__menu");if(!r||r.hidden)return;let n=[...r.querySelectorAll(".ppt-flat-select__option")];if(!n.length)return;let i=n.indexOf(document.activeElement),a=i>=0?i:n.findIndex(l=>l.classList.contains("is-selected")),o=Math.min(n.length-1,Math.max(0,(a<0?-t:a)+t));n[o]?.focus(),n[o]?.scrollIntoView({block:"nearest"})}function Ps(e){let t=e.closest(".ppt-flat-select");if(!t)return;let r=t.querySelector(".ppt-flat-select__label"),n=t.querySelector(".ppt-flat-select__menu"),i=e.options[e.selectedIndex];if(r&&(r.textContent=i?.textContent?.trim()||""),!n)return;let a=new Map([...n.querySelectorAll(".ppt-flat-select__option")].map(o=>[o.dataset.value,o]));[...e.options].forEach(o=>{let l=a.get(o.value);l||(l=document.createElement("button"),l.type="button",l.className="ppt-flat-select__option",l.setAttribute("role","option"),l.dataset.value=o.value,l.addEventListener("click",()=>{e.value=o.value,Ps(e),Ia(t),e.dispatchEvent(new Event("change",{bubbles:!0}))}),n.append(l)),l.textContent=o.textContent,o.title&&(l.title=o.title);let c=o.value===e.value;l.classList.toggle("is-selected",c),l.setAttribute("aria-selected",c?"true":"false")}),[...n.querySelectorAll(".ppt-flat-select__option")].forEach(o=>{[...e.options].some(l=>l.value===o.dataset.value)||o.remove()}),t.classList.contains("is-open")&&ks(t)}function Ih(e){if(!(e instanceof Node))return!1;for(let t of oi){let r=t.querySelector(".ppt-flat-select__menu");if(r&&(r===e||r.contains(e)))return!0}return!1}function Mh(e){Ih(e.target)||Ma(null)}function zh(e){let t=e.target;if(t instanceof Node){for(let r of oi)if(r.contains(t))return}Ma(null)}function qc(e){if(!e||e.dataset.flatSelect==="true")return;e.dataset.flatSelect="true",e.classList.remove("ppt-flat-select"),e.classList.add("ppt-flat-select__native"),e.tabIndex=-1,e.setAttribute("aria-hidden","true");let t=document.createElement("div");t.className="ppt-flat-select";let r=document.createElement("button");r.type="button",r.className="ppt-flat-select__trigger",r.setAttribute("aria-haspopup","listbox"),r.setAttribute("aria-expanded","false");let n=document.createElement("span");n.className="ppt-flat-select__label",r.append(n);let i=document.createElement("div");i.className="ppt-flat-select__menu",i.hidden=!0,i.setAttribute("role","listbox"),i.addEventListener("wheel",o=>o.stopPropagation(),{passive:!0}),i.addEventListener("mousedown",o=>o.stopPropagation()),r.addEventListener("click",o=>{if(o.stopPropagation(),t.classList.contains("is-open")){Ia(t);return}Gc(t)}),t.addEventListener("keydown",o=>{o.key==="ArrowDown"||o.key==="ArrowUp"?(o.preventDefault(),t.classList.contains("is-open")||Gc(t),Nh(t,o.key==="ArrowDown"?1:-1)):o.key==="Escape"&&t.classList.contains("is-open")&&(o.stopPropagation(),Ia(t),r.focus())}),e.parentNode.insertBefore(t,e),t.append(r,i,e),Ps(e)}function Ni(e){Ps(e)}window.__pptLiveFlatSelectBound||(window.__pptLiveFlatSelectBound=!0,document.addEventListener("click",zh),document.addEventListener("keydown",e=>{e.key==="Escape"&&Ma(null)}),window.addEventListener("resize",()=>{oi.forEach(e=>ks(e))}),document.addEventListener("scroll",Mh,!0));function Zc(){document.documentElement.lang=lr(),document.querySelectorAll("[data-i18n]").forEach(e=>{e.textContent=O(e.dataset.i18n)}),document.querySelectorAll("[data-i18n-placeholder]").forEach(e=>{e.placeholder=O(e.dataset.i18nPlaceholder)}),document.querySelectorAll("[data-i18n-aria]").forEach(e=>{e.setAttribute("aria-label",O(e.dataset.i18nAria))})}function Yc(e,t){ep(e),Lr(e),Br(e),rp(e,t),qn(e,t),hn(e,t),qa(e,t),Gn(),document.querySelector(".ppt-live")?.setAttribute("data-density",e.style.density),document.querySelectorAll(".segment").forEach(i=>{i.classList.toggle("is-active",i.dataset.mode===e.mode)});let r=er(e),n=Nt("slidePosition");n&&(n.textContent=`${r+1} / ${e.slides?.length||1}`)}var jc="",Ii=0,Jc=120,Oh=20;function Uh(e){return{x:(parseFloat(e.paddingLeft)||0)+(parseFloat(e.paddingRight)||0),y:(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}}function $c(e,t={}){if(!e)return{width:0,height:0};let r=getComputedStyle(e),n=Uh(r),i=Math.max(0,(e.clientWidth||0)-n.x),a=Math.max(0,(e.clientHeight||0)-n.y),o=e.getBoundingClientRect();o.width>0&&(i=Math.max(i,o.width-n.x)),o.height>0&&(a=Math.max(a,o.height-n.y));let l=t.minHeight??Jc,c=t.fallback;if(c&&a0&&(i=Math.max(i,s.width-n.x)),s.height>0&&(a=Math.max(a,s.height-n.y))}return{width:Math.max(0,i),height:Math.max(0,a)}}function Wh(e){if(!e)return 0;let t=e.getBoundingClientRect();return Math.max(e.clientWidth||0,e.offsetWidth||0,t.width||0)}function Gn(){Ii&&cancelAnimationFrame(Ii);let e=(t=0)=>{Ii=0,si(),Ns(),Ga(),ad();let r=Nt("slideCanvas")?.closest(".canvas-area");if(!r||t>=Oh)return;let{height:n}=$c(r,{fallback:r.closest(".stage-shell")});ne(t+1)))};Ii=requestAnimationFrame(()=>e(0))}function si(){let e=Nt("slideCanvas"),t=e?.closest(".canvas-area"),r=e?.closest(".canvas-stage");if(!e||!t||!r)return;let{width:n,height:i}=$c(t,{fallback:t.closest(".stage-shell")}),a=Math.max(160,n),o=Math.max(90,i),l=a,c=l*9/16;c>o&&(c=o,l=c*16/9);let s=Math.floor(l),d=Math.floor(c),u=`${a}x${o}`;if(u===jc&&r.style.width===`${s}px`&&r.style.height===`${d}px`){let h=e.querySelector(`.${br}`);h&&wr(h);return}jc=u,r.style.width=`${s}px`,r.style.height=`${d}px`,e.style.width="100%",e.style.height="100%";let p=Nt("presentSlide");p&&(p.style.width=`${s}px`,p.style.height=`${d}px`);let f=e.querySelector(`.${br}`);f&&wr(f)}function Gh(e){let t=Nt("floatingToolbar"),r=Nt("slideCanvas");if(!t||!r||!e){t&&t.classList.remove("is-visible");return}let n=r.getBoundingClientRect(),i=e.x/100*n.width,a=e.y/100*n.height,o=e.w/100*n.width;t.style.left=`${n.left+i+o/2-t.offsetWidth/2}px`,t.style.top=`${n.top+a-t.offsetHeight-8}px`,t.classList.add("is-visible")}function Fs(e,t){let r=String(e||"").trim(),n=parseFloat(r);return Number.isFinite(n)?r.endsWith("pt")?n*(96/72):(r.endsWith("px"),n):t}function Es(e,t,r){return String(e||"").replace(/(^|[^-.\w]):root(?![\w-])/gi,`$1${t}`).replace(/(^|[^-.\w])html(?![\w-])/gi,`$1${t}`).replace(/(^|[^-.\w])body(?![\w-])/gi,`$1${r}`)}var br="html-slide-preview-host",ed="html-slide-preview-scaler",Rs={width:1280,height:720};function qh(e){let t=String(e||""),r=t.match(/(?:^|[{;\s])width\s*:\s*([\d.]+)\s*pt/i),n=t.match(/(?:^|[{;\s])height\s*:\s*([\d.]+)\s*pt/i);if(r?.[1]&&n?.[1])return{width:Math.round(parseFloat(r[1])*(96/72)),height:Math.round(parseFloat(n[1])*(96/72))};let i=t.match(/(?:^|[{;\s])width\s*:\s*([\d.]+)\s*px/i),a=t.match(/(?:^|[{;\s])height\s*:\s*([\d.]+)\s*px/i);return i?.[1]&&a?.[1]?{width:Math.round(parseFloat(i[1])),height:Math.round(parseFloat(a[1]))}:{...Rs}}function jh(e){let t=Number(e?.dataset?.designW),r=Number(e?.dataset?.designH);return Number.isFinite(t)&&t>=320&&Number.isFinite(r)&&r>=180?{width:t,height:r}:null}function Vh(e){let t=e?.body,r=e?.documentElement,n=e?.defaultView;if(!t||!r||!n)return{...Rs};let i=n.getComputedStyle(t),a=Fs(i.width,0),o=Fs(i.height,0)||Fs(i.minHeight,0);if(a>=320&&o>=180)return{width:a,height:o};let l=Math.max(t.scrollWidth||0,t.offsetWidth||0,r.clientWidth||0,1280),c=Math.max(t.scrollHeight||0,t.offsetHeight||0,r.clientHeight||0,720);return l=Math.min(Math.max(l,320),3840),c=Math.min(Math.max(c,180),3840),{width:l,height:c}}function Xh(e,t){let r=jh(t);return r||(e?.body?Vh(e):{...Rs})}function Ls(e){if(!e)return{width:0,height:0};let t=e.getBoundingClientRect();return{width:Math.max(e.clientWidth||0,e.offsetWidth||0,t.width||0),height:Math.max(e.clientHeight||0,e.offsetHeight||0,t.height||0)}}function td(e,t){let r=qh(t);return e.dataset.designW=String(r.width),e.dataset.designH=String(r.height),r}var Vc="data-ppt-live-editing-style",li="data-ppt-live-editable";function Hh(e,t){!e||e._pptLiveOriginalInline||!t?.documentElement||!t.body||(e._pptLiveOriginalInline={root:t.documentElement.getAttribute("style"),body:t.body.getAttribute("style")})}function _h(e,t,r){if(!e?.documentElement||!e.body)return;let n=e.documentElement,i=e.body;n.style.margin="0",n.style.padding="0",n.style.width=`${t}px`,n.style.height=`${r}px`,n.style.overflow="hidden",i.style.margin="0",i.style.boxSizing="border-box",i.style.width=`${t}px`,i.style.height=`${r}px`,i.style.minHeight="",i.style.maxWidth="",i.style.overflow="hidden",i.style.transform="none"}function wr(e){let t=e?.classList?.contains(br)?e:e?.closest?.(`.${br}`);if(!t)return!1;let r=t.querySelector(`.${ed}`),n=r?.querySelector("iframe, [data-slide-stage]");if(!r||!n)return!1;let{width:i,height:a}=Ls(t);if(!i||!a)return!1;let o=n.tagName==="IFRAME",l=null;if(o)try{l=n.contentDocument}catch{l=null}let{width:c,height:s}=Xh(l,n),d=Math.min(i/c,a/s),u=c*d,p=s*d;return l&&(Hh(n,l),_h(l,c,s)),r.style.width=`${u}px`,r.style.height=`${p}px`,r.style.overflow="hidden",r.style.position="relative",r.style.flexShrink="0",n.style.display="block",n.style.width=`${c}px`,n.style.height=`${s}px`,n.style.border="0",n.style.margin="0",n.style.padding="0",n.style.maxWidth="none",n.style.maxHeight="none",n.style.transformOrigin="top left",n.style.transform=`scale(${d})`,!0}var Xc="ppt-slide-shadow-root",Ds="ppt-slide-shadow-body";function Kh(e){return e.querySelectorAll('script, iframe, object, embed, meta[http-equiv="refresh" i]').forEach(t=>t.remove()),e.querySelectorAll("*").forEach(t=>{for(let r of[...t.attributes]){let n=r.name.toLowerCase();(n.startsWith("on")||(n==="href"||n==="src"||n==="xlink:href")&&/^\s*javascript:/i.test(r.value))&&t.removeAttribute(r.name)}}),e}function Qh(e,t){let r=document.createElement("div");r.className=t,r.dataset.slideStage="true",td(r,e);let n=Number(r.dataset.designW),i=Number(r.dataset.designH),a=Kh(new DOMParser().parseFromString(Ur(e),"text/html")),o=r.attachShadow({mode:"open"}),l=document.createElement("div");l.className=Xc,l.style.cssText=["all:initial","display:block","position:relative",`width:${n}px`,`height:${i}px`,"margin:0","padding:0","overflow:hidden",'font-family:system-ui, -apple-system, "PingFang SC", "Source Han Sans SC", sans-serif',"font-size:16px","line-height:normal","color:#000","background:#fff"].join(";"),a.querySelectorAll("style").forEach(s=>{let d=document.createElement("style");d.textContent=Es(s.textContent||"",`.${Xc}`,`.${Ds}`),o.appendChild(d)});let c=document.createElement("div");if(c.className=Ds,a.body){for(let s of a.body.attributes)s.name==="class"?c.classList.add(...s.value.split(/\s+/).filter(Boolean)):s.name==="style"?c.style.cssText+=`;${s.value}`:s.name.toLowerCase().startsWith("on")||c.setAttribute(s.name,s.value);c.innerHTML=a.body.innerHTML}return c.style.boxSizing="border-box",/\bwidth\s*:/i.test(c.style.cssText)||(c.style.width=`${n}px`),/\bheight\s*:/i.test(c.style.cssText)||(c.style.height=`${i}px`),c.style.overflow="hidden",c.style.margin="0",l.appendChild(c),o.appendChild(l),r._pptLiveSourceHtml=String(e||""),r}function Bs({hostClass:e="",frameClass:t,html:r,onReady:n,interactive:i=!1}){let a=document.createElement("div");a.className=[br,e].filter(Boolean).join(" ");let o=document.createElement("div");if(o.className=ed,i){let s=Qh(r,t);return o.appendChild(s),a.appendChild(o),requestAnimationFrame(()=>{wr(a),n?.(s,a)}),{host:a,scaler:o,frame:s}}let l=document.createElement("iframe");l.className=t,l.setAttribute("sandbox","allow-same-origin"),l.setAttribute("loading","lazy"),td(l,r),l.srcdoc=Ur(r);let c=()=>{wr(a),n?.(l,a)};return l.addEventListener("load",c,{once:!0}),o.appendChild(l),a.appendChild(o),{host:a,scaler:o,frame:l}}function rd(e){let{host:t}=Bs({hostClass:"export-preview__html-stage",frameClass:"export-preview__html-frame",html:e,onReady:()=>{t.closest(".export-preview__viewport")&&wr(t)}});return t}function nd(e){if(!e)return;let t=e.querySelector(".export-preview__viewport")||e,r=t.querySelector(".export-preview__scale");if(!r)return;let n=r.querySelector(`.${br}`);if(n){r.style.width="100%",r.style.height="100%",wr(n);return}let i=r.querySelector(".export-preview__element-stage");if(!i)return;let{width:a,height:o}=Ls(t);if(!a||!o)return;let l=960,c=540,s=Math.min(a/l,o/c);i.style.width=`${l}px`,i.style.height=`${c}px`,i.style.transform=`scale(${s})`,i.style.transformOrigin="top left",r.style.width=`${Math.floor(l*s)}px`,r.style.height=`${Math.floor(c*s)}px`}function Zh(e){if(!e||new Set(["turn","round","round-done","tokens","text","thinking"]).has(e.kind||""))return"";let r=String(e.detail||"").trim();return!r||/^[0-9a-f-]{8,}/i.test(r)?"":r}function Yh(e){if(!e)return;(typeof requestAnimationFrame=="function"?requestAnimationFrame:r=>setTimeout(r,0))(()=>{e.scrollTop=e.scrollHeight})}function Lr(e){let t=Nt("generationSteps"),r=e.generation?.steps||[],n=Array.isArray(e.generation?.events)?e.generation.events:[],i=!!(e.generation?.active||r.some(o=>o.status==="running")),a=r.some(o=>o.status==="error");if(document.querySelector(".ppt-live")?.classList.toggle("is-generating",i),document.querySelector(".ppt-live")?.classList.toggle("has-generation-error",a),!!t){if(t.innerHTML="",n.length)n.forEach((o,l)=>{let c=Zh(o),s=document.createElement("li");s.className=`generation-event is-${o.kind||"info"}`,s.innerHTML=` +var Nn=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ns={"en-US":{eyebrow:"AI Deck Studio",title:"PPT Live",newDeck:"New",newTopic:"New topic",blankDeckTitle:"Untitled deck",blankDeckReady:"Blank deck ready.",clusterDraft:"Draft",clusterReview:"Review",clusterExport:"Export",generateOutline:"Outline",generateDeck:"Generate deck",preview:"Preview",exportHtml:"HTML",exportPptx:"PPTX",workflowPrompt:"Prompt",workflowGenerate:"Generate",workflowEdit:"Edit",workflowExport:"Export",slidesPanelTitle:"Slides",slidesPanelSubcopy:"Click a page to edit text directly on canvas.",agentCommandTitle:"Create or edit by prompt",agentCommandSubcopy:"Generate a deck, revise one page, edit the whole deck, insert, or delete.",briefTitle:"Brief",agentRequestTitle:"What should this deck say?",oneBoxTitle:"Describe the deck. Then keep editing by prompt.",oneBoxSubtitle:"One command box handles drafting, page edits, deck edits, insertion, and deletion.",oneBoxPlaceholder:"Example: Build a 10-page AI product strategy deck for executives. Later: make this page more visual, rewrite the whole deck for investors, insert a risk page, or delete this page.",sendPrompt:"Send",promptRequired:"Type what you want PPT Live to do.",topicLabel:"Goal",topicPlaceholder:"Describe the deck you want. Mention page count or URLs only when you need them.",audienceLabel:"Audience",audiencePlaceholder:"Executives, customers, students...",slidesLabel:"Slides",deckTypeLabel:"Deck type",deckTypeStrategy:"Strategy",deckTypeSales:"Sales pitch",deckTypeReport:"Business report",deckTypeTeaching:"Teaching",deckTypeFundraising:"Fundraising",toneLabel:"Tone",toneExecutive:"Executive",toneConcise:"Concise",tonePersuasive:"Persuasive",toneEducational:"Educational",materialLabel:"Source material",materialPlaceholder:"Paste notes, article excerpts, data points, meeting notes, or rough slide requirements.",advancedBrief:"Optional context",processTitle:"Generation process",processSubcopy:"Track the current deck build at a glance.",historyTitle:"History",historySubcopy:"Restore a deck session and continue editing.",historyEmpty:"Generated decks and edits will appear here.",historyMeta:"{{count}} slides \xB7 {{time}}",historyRestored:"Deck session restored.",stopGeneration:"Stop",generationStopped:"Generation stopped. Kept the current view.",generationTimedOut:"Generation took too long, so PPT Live stopped this run.",generationDraftReady:"Preparing the final slides\u2026",generationAgentWorking:"Building your presentation\u2026",backendGenerationFailed:"Generation did not finish. Please retry, or stop and start a new topic.",backendGenerationFailedWithReason:"Generation did not finish: {{reason}}",generationRoundBudgetFailed:"Generation ran out of steps before the deck was ready.",generationRoundBudgetHint:"Try a shorter prompt, fewer pages, or remove extra reference links, then send again.",generationRetrying:"Generation hit an error; retrying automatically ({{attempt}}/{{max}})\u2026",generationRetryAttempt:"Retry attempt {{attempt}}/{{max}}.",generationRecoveryContinuing:"{{stage}} is still incomplete; asking the same Agent Session to continue ({{attempt}}/{{max}})\u2026",generationRecoveryExhausted:"{{stage}} did not finish after {{retries}} retries and {{continuations}} continuation turns.",generationRecoveryFailureDetail:"Last verified reason: {{reason}}",generationStagePlanning:"Planning",generationStageSlide:"Slide {{slide}}",generationStageAudit:"Final audit",agentOnlyRetryHint:"Check your connection and try again in a moment.",generationPlanPhase:"Stage 1/3 \xB7 Research and slide planning",generationPlanningSlides:"Writing per-slide briefs\u2026",generationPlanProgress:"Planning in progress: {{count}} slide briefs written\u2026",generationPlanReady:"Plan ready: {{count}} slides outlined.",generationPlanRetry:"Planning hit an error; retrying the planning stage only ({{attempt}}/{{max}})\u2026",generationAuditRetry:"Final audit is incomplete; retrying the audit stage ({{attempt}}/{{max}})\u2026",generationSlidesPhase:"Stage 2/3 \xB7 Rendering {{count}} slides serially, one Agent turn per page",generationAuditPhase:"Stage 3/3 \xB7 Auditing the full deck against the design skill and style contract",generationRenderingSlide:"Rendering slide {{slide}}/{{total}}\u2026",generationSlideReady:"Slide {{slide}}/{{total}} ready.",generationSlideRetry:"Slide {{slide}} hit an error; retrying it ({{attempt}}/{{max}})\u2026",generationSlideRepair:"Slide {{slide}} failed validation; agent repair ({{attempt}}/{{max}})\u2026",generationResumeFrom:"Resuming from slide {{slide}} \u2014 finished slides are kept.",generationPartialDeck:"Slides {{missing}} did not finish. The finished slides are kept \u2014 send a follow-up prompt to fill the missing pages.",agentWorkingTitle:"Building your deck",agentWorkingKicker:"In progress",agentWorkingClaim:"Your slides will appear in the canvas when generation finishes.",agentWorkingProof:"Progress",agentWorkingDetail:"This is a live preview area while your deck is being created.",agentWorkingSourceNote:"Content is generated from your prompt.",agentWorkingMetric:"Live",agentWorkingMetricLabel:"Waiting for slides",processEventStarted:"Generation started.",processEventWaiting:"Getting ready\u2026",processEventRound:"Organizing structure and copy.",processEventTool:"Reading sources and applying design rules.",processEventText:"Drafting slide layouts.",processEventDone:"Deck received.",generationParsingDeck:"Loading slides into the editor\u2026",processWaitingForEventsTitle:"Ready to generate",processWaitingForEvents:"Send a prompt to start. Progress will show up here.",processEventUnknown:"Update",eventTurnStarted:"Generation started",eventTurnFailed:"Generation failed",eventTurnCancelled:"Generation cancelled",eventRoundCompleted:"Step completed",eventThinkingChunk:"Thinking stream",eventTokenUsage:"Token usage updated",eventUnknownTool:"tool",eventToolDetected:"Detected tool",eventToolParams:"Reading tool input",eventToolQueued:"Queued tool",eventToolWaiting:"Waiting for tool",eventToolStarted:"Started tool",eventToolProgress:"Tool progress",eventToolStreaming:"Tool streaming",eventToolStreamChunk:"Tool output chunk",eventToolConfirmation:"Tool needs confirmation",eventToolConfirmed:"Tool confirmed",eventToolRejected:"Tool rejected",eventToolCompleted:"Completed tool",eventToolFailed:"Tool failed",eventToolCancelled:"Tool cancelled",eventToolQueuePosition:"queue",eventToolSkillName:"PPT design skill",eventToolWebSearchName:"Web search",eventToolWebFetchName:"Web page fetch",eventToolSkillReady:"Design skill loaded",generationProgressPulse:"Still generating\u2026",generationPageProgress:"Generating page {{current}}",generationSlideProgress:"{{count}} slides drafted",generationStepBrief:"Assumptions",generationStepBriefDetail:"Read the prompt and plan the deck.",generationStepSpine:"Outline",generationStepSpineDetail:"Create assertion-led slide titles from the request.",generationStepProof:"Slide copy",generationStepProofDetail:"Ground each page in source facts or clear assumptions.",generationStepDesign:"Visual design",generationStepDesignDetail:"Apply theme, layout, and visual hierarchy.",generationStepCompile:"Load slides",generationStepCompileDetail:"Load the generated deck into the editor.",generationReadingBrief:"Reading your prompt...",generationWritingClaims:"Building the outline...",generationChoosingProof:"Writing slide copy...",generationDesigningLayouts:"Designing slide layouts...",generationCompiled:"Your deck is ready.",generationSpineReady:"Claim spine ready.",generationLocalSpine:"Generation is unavailable. Please try again later.",generationLocalCompiler:"Generation is unavailable. Please try again later.",agentPlanning:"Planning the deck task...",agentPlanningFallback:"Planning is unavailable. Please try again.",outlineTitle:"Outline",outlineSubcopy:"Review the story spine before the deck is composed.",addOutlineItem:"Add outline item",syncOutline:"Sync slides from outline",modeEdit:"Edit",modeSort:"Sort",modePresent:"Present",inspectorTitle:"Inspector",addText:"Text",addList:"List",addShape:"Shape",addMetric:"Metric",addChart:"Chart",addMedia:"Media",addSlide:"Add slide",deleteSlide:"Delete slide",deleteElement:"Delete element",aiTitle:"AI design",aiSubcopy:"Prompt the agent to revise one page, the whole deck, or add a page.",instructionPlaceholder:"Example: make this page more visual, add a competition page, rewrite the whole deck for investors, or delete repetition.",reviseSlide:"Revise this page",reviseDeck:"Revise all",insertSlide:"Insert page",aiRewrite:"Rewrite",aiCondense:"Condense",aiProfessional:"Professional",aiMoreVisual:"More visual",aiNotes:"Speaker notes",aiRedesign:"Redesign slide",aiRestyleDeck:"Restyle deck",styleTitle:"Style",themeLabel:"Theme",themeExecutive:"Executive",themeMarket:"Market",themeMinimal:"Minimal",themeStudio:"Studio",densityLabel:"Density",densityCompact:"Compact",densityStandard:"Standard",densitySpacious:"Spacious",brandPrimaryLabel:"Primary",brandAccentLabel:"Accent",imagePolicyLabel:"Image policy",imagePolicyPlaceholders:"Editable placeholders",imagePolicyNone:"No images",ready:"Ready.",statusPillReady:"Ready",statusPillBusy:"AI",exportReady:"HTML and PPTX export ready after generation.",working:"Working with AI...",outlineReady:"Outline ready. Edit it, then generate the designed deck.",deckReady:"Designed deck generated.",aiUnavailable:"Generation is unavailable right now. Please try again later.",sourceGroundingRequired:"Source could not be verified. Generated a verification-first deck instead of inventing facts.",saved:"Saved.",slideUpdated:"Slide updated.",deckUpdated:"Deck updated.",slideInserted:"Page inserted.",deckRestyled:"Deck restyled.",cannotDelete:"Keep at least one slide.",noSelection:"Select a slide object to edit its content and layout.",elementTypeLabel:"Type",elementTextLabel:"Text",elementItemsLabel:"Items",elementDataLabel:"Chart data",geometryLabel:"Geometry",styleLabel:"Style",speakerNotesLabel:"Speaker notes",kickerLabel:"Kicker",claimLabel:"Claim",proofObjectLabel:"Proof object",supportNoteLabel:"Support note",sourceNoteLabel:"Source note",newSlideTitle:"New slide",defaultDeckTitle:"AI Product Strategy",slidesMeta:"{{count}} slides",exportHtmlDone:"HTML deck downloaded.",exportHtmlWorking:"Exporting HTML...",exportHtmlFailed:"HTML export failed:",exportSavedTo:"Exported to {{path}}",exportPptxWorking:"Rendering editable PPTX...",exportPptxDone:"Editable PPTX downloaded.",exportPptxFailed:"PPTX export failed:",exportPdfWorking:"Rendering PDF...",exportPdfDone:"PDF downloaded.",exportPdfFailed:"PDF export failed:",exportPngWorking:"Rendering PNG slides...",exportPngDone:"PNG slide archive downloaded.",exportPngFailed:"PNG export failed:",exportDeckEmpty:"Generate slides before exporting.",slidesEmptyHint:"Slides appear here after generation.",welcomeTitle:"Describe your deck to get started",welcomeSubcopy:"One prompt creates the outline, designed slides, and an editable deck you can refine page by page.",welcomeTip1:"10-page strategy deck",welcomeTip2:"Investor pitch rewrite",welcomeTip3:"Make this page more visual",deleteSlideDefaultPrompt:"Delete the current slide and keep the deck coherent.",prev:"Previous",next:"Next",assistantHello:"Describe the deck you need. I will build an outline first, then turn it into editable slides.",aiChatApplied:"I applied the instruction to the current slide.",localMetricLabel:"signal to remember",mediaPlaceholder:"Image placeholder",slidesUnit:"slides",closeConfirm:"Confirm the direction",closeOwner:"Choose the owner",closeIteration:"Start the next iteration",pointClaimPrefix:"Claim:",pointProofPrefix:"Proof object:",pointAudiencePrefix:"Audience relevance:",pointEvidenceRule:"Evidence rule: mark assumptions clearly",pointDesignRule:"Design rule: one visual plus one support rail",pointCloseRule:"Close: name the next action",claimCover:"{{topic}} needs a clear decision narrative, not another collection of slides.",claimPressure:"{{title}} is the pressure point the audience must resolve.",claimDecision:"{{title}} changes the decision because it connects evidence to action.",claimProof:"{{title}} becomes credible when the proof object carries the argument.",claimAction:"{{title}} should end with one named decision, owner, or next move.",supportWithSource:"Use the supplied source material to substantiate this claim; make the {{proof}} the dominant evidence.",supportWithAssumption:"Add one concrete example or metric so the {{proof}} can support the claim without filler.",sourceUserMaterial:"Source: user-provided material",sourceDraftAssumption:"Source: draft assumption; verify before external use",defaultSpeakerNote:'Open with the conclusion for "{{title}}", then support it with one concrete example.',proofMarketMap:"market map",proofOperatingModel:"operating model",proofRiskBridge:"risk bridge",proofDecisionTable:"decision table",proofBeforeAfter:"before/after workflow",proofValueBridge:"value bridge",proofCustomerProof:"customer proof",proofImplementationPlan:"implementation plan",proofMetricBridge:"metric bridge",proofTrendChart:"trend chart",proofSourceSummary:"source summary",proofVerificationPlan:"verification plan",proofCapabilityMatrix:"capability matrix",proofEvidenceList:"evidence list",proofVarianceTable:"variance table",proofRiskRegister:"risk register",proofConceptMap:"concept map",proofWorkedExample:"worked example",proofComparison:"comparison",proofPracticePrompt:"practice prompt",proofMarketWedge:"market wedge",proofProductDiagram:"product diagram",proofTractionChart:"traction chart",proofMilestonePlan:"milestone plan",proofVisualProof:"visual proof",sourceFetchedNote:"Sources: {{count}} fetched URL(s)",bpContextTitle:"{{topic}} must be grounded in source facts before claims are made.",bpSourceNeededTitle:"{{topic}} needs source material before factual claims can be made.",bpProblemTitle:"The current question is what the audience can safely believe.",bpSolutionTitle:"{{topic}} should be explained through capabilities, workflow, and evidence.",bpWorkflowTitle:"The workflow shows how the product creates value step by step.",bpProofTitle:"Source-backed evidence should carry the credibility of the deck.",bpVerificationTitle:"Verification gaps must be visible instead of hidden behind fake charts.",bpRiskTitle:"The main risk is overclaiming beyond the available source material.",bpDecisionTitle:"The next step is to verify the claims and choose the strongest story path.",bpSupportSource:"Built from fetched or pasted source material; verify exact wording before external use.",bpSupportMissing:"Source material is insufficient; keep this slide as a verification prompt.",bpMissingFact1:"Paste source notes, a README, metrics, or product description to ground this slide.",bpMissingFact2:"Do not use invented metrics; replace placeholders with verified evidence.",bpMissingFact3:"Use this page to decide what needs to be researched next.",qualityOutOfBounds:"An element extends outside the slide safe area.",qualityTextDense:"Visible text may be too dense for this layout.",qualityChartUngrounded:"Chart data was removed or flagged because it is not grounded in source numbers.",qualityOverlap:"Text or chart elements may overlap.",qualityMissingClaim:"This slide needs one clear claim.",qualityReportTitle:"Quality report",qualityNeedsReview:"Review required",qualityHasWarnings:"Quality warning",exportFormatUnavailable:"This export format is not available yet.",exportTitle:"Export",exportCancel:"Cancel",exportConfirm:"Export file",exportPreviewPrevAria:"Previous slide",exportPreviewNextAria:"Next slide",exportFormat:"Format",exportQuality:"Quality",exportDpi:"Image DPI",exportRange:"Slide range",exportShare:"Share",propertiesStyle:"Style",propertiesLayout:"Layout",propertiesAnimation:"Animation",propertiesThemeColor:"Theme color",propertiesFont:"Font",propertiesColorMode:"Slide colors",propertiesStylePreset:"Style preset",colorModeLight:"Light",colorModeDark:"Dark",fontSansSerif:"Sans-serif",fontSerif:"Serif",propertiesDensity:"Density",propertiesSmartAlign:"Smart align",propertiesPageTransition:"Page transition",propertiesElementAnimation:"Element animation",densityLoose:"Loose"},"zh-CN":{eyebrow:"AI \u6F14\u793A\u5DE5\u574A",title:"PPT Live",newDeck:"\u65B0\u5EFA",newTopic:"\u65B0\u4E3B\u9898",blankDeckTitle:"\u672A\u547D\u540D PPT",blankDeckReady:"\u7A7A\u767D PPT \u5DF2\u5C31\u7EEA\u3002",clusterDraft:"\u521B\u4F5C",clusterReview:"\u5BA1\u9605",clusterExport:"\u4EA4\u4ED8",generateOutline:"\u751F\u6210\u5927\u7EB2",generateDeck:"\u751F\u6210\u6574\u5957",preview:"\u6F14\u793A\u9884\u89C8",exportHtml:"\u5BFC\u51FA HTML",exportPptx:"\u5BFC\u51FA PPTX",workflowPrompt:"\u8F93\u5165",workflowGenerate:"\u751F\u6210",workflowEdit:"\u7F16\u8F91",workflowExport:"\u5BFC\u51FA",slidesPanelTitle:"\u9875\u9762",slidesPanelSubcopy:"\u70B9\u51FB\u9875\u9762\u540E\uFF0C\u53EF\u76F4\u63A5\u5728\u753B\u5E03\u4E0A\u6539\u6587\u5B57\u3002",agentCommandTitle:"\u7528 Prompt \u751F\u6210\u6216\u4FEE\u6539",agentCommandSubcopy:"\u751F\u6210\u6574\u5957 PPT\u3001\u4FEE\u6539\u5355\u9875\u3001\u5168\u5C40\u6539\u5199\u3001\u63D2\u5165\u6216\u5220\u9664\u9875\u9762\u3002",briefTitle:"\u521B\u4F5C\u7B80\u62A5",agentRequestTitle:"\u4F60\u60F3\u505A\u4E00\u4EFD\u4EC0\u4E48 PPT\uFF1F",oneBoxTitle:"\u63CF\u8FF0 PPT\uFF0C\u7136\u540E\u7EE7\u7EED\u7528 Prompt \u4FEE\u6539",oneBoxSubtitle:"\u9996\u7A3F\u3001\u6539\u5355\u9875\u3001\u6539\u6574\u5957\u3001\u63D2\u5165\u548C\u5220\u9664\uFF0C\u90FD\u7531\u8FD9\u4E00\u4E2A\u8F93\u5165\u6846\u5904\u7406\u3002",oneBoxPlaceholder:"\u4F8B\u5982\uFF1A\u4E3A\u9AD8\u7BA1\u751F\u6210 10 \u9875 AI \u4EA7\u54C1\u6218\u7565 PPT\u3002\u4E4B\u540E\u53EF\u4EE5\u5199\uFF1A\u628A\u672C\u9875\u6539\u5F97\u66F4\u89C6\u89C9\u5316\u3001\u6574\u5957\u6539\u6210\u6295\u8D44\u4EBA\u7248\u672C\u3001\u63D2\u5165\u4E00\u9875\u98CE\u9669\u5206\u6790\u3001\u5220\u9664\u672C\u9875\u3002",sendPrompt:"\u53D1\u9001",promptRequired:"\u8BF7\u8F93\u5165\u4F60\u5E0C\u671B PPT Live \u505A\u4EC0\u4E48\u3002",topicLabel:"\u76EE\u6807",topicPlaceholder:"\u76F4\u63A5\u63CF\u8FF0\u4F60\u60F3\u8981\u7684\u6F14\u793A\u7A3F\uFF1B\u4EC5\u5728\u9700\u8981\u65F6\u8BF4\u660E\u9875\u6570\u6216\u53C2\u8003 URL\u3002",audienceLabel:"\u53D7\u4F17",audiencePlaceholder:"\u9AD8\u7BA1\u3001\u5BA2\u6237\u3001\u5B66\u751F\u3001\u56E2\u961F\u6210\u5458...",slidesLabel:"\u9875\u6570",deckTypeLabel:"\u7C7B\u578B",deckTypeStrategy:"\u6218\u7565\u65B9\u6848",deckTypeSales:"\u9500\u552E\u63D0\u6848",deckTypeReport:"\u4E1A\u52A1\u6C47\u62A5",deckTypeTeaching:"\u6559\u5B66\u8BFE\u4EF6",deckTypeFundraising:"\u878D\u8D44\u8DEF\u6F14",toneLabel:"\u8BED\u6C14",toneExecutive:"\u9AD8\u7BA1\u98CE",toneConcise:"\u7CBE\u7B80",tonePersuasive:"\u6709\u8BF4\u670D\u529B",toneEducational:"\u6559\u5B66\u578B",materialLabel:"\u7D20\u6750",materialPlaceholder:"\u7C98\u8D34\u7B14\u8BB0\u3001\u6587\u7AE0\u7247\u6BB5\u3001\u6570\u636E\u70B9\u3001\u4F1A\u8BAE\u8BB0\u5F55\u6216\u7C97\u7565\u9875\u9762\u8981\u6C42\u3002",advancedBrief:"\u53EF\u9009\u4E0A\u4E0B\u6587",processTitle:"\u751F\u6210\u8FC7\u7A0B",processSubcopy:"\u67E5\u770B\u5F53\u524D\u6F14\u793A\u7A3F\u7684\u751F\u6210\u8FDB\u5EA6\u3002",historyTitle:"\u5386\u53F2\u8BB0\u5F55",historySubcopy:"\u6062\u590D\u4E4B\u524D\u7684 PPT \u4F1A\u8BDD\uFF0C\u5E76\u7EE7\u7EED\u4FEE\u6539\u3002",historyEmpty:"\u751F\u6210\u548C\u4FEE\u6539\u8FC7\u7684 PPT \u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002",historyMeta:"{{count}} \u9875 \xB7 {{time}}",historyRestored:"\u5DF2\u6062\u590D PPT \u4F1A\u8BDD\u3002",stopGeneration:"\u505C\u6B62",generationStopped:"\u5DF2\u505C\u6B62\u751F\u6210\uFF0C\u4FDD\u7559\u5F53\u524D\u89C6\u56FE\u3002",generationTimedOut:"\u751F\u6210\u8017\u65F6\u8FC7\u957F\uFF0C\u672C\u6B21\u8FD0\u884C\u5DF2\u505C\u6B62\u3002",generationDraftReady:"\u6B63\u5728\u6574\u7406\u6700\u7EC8\u9875\u9762\u2026",generationAgentWorking:"\u6B63\u5728\u751F\u6210\u4F60\u7684\u6F14\u793A\u7A3F\u2026",backendGenerationFailed:"\u751F\u6210\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u6216\u505C\u6B62\u540E\u91CD\u65B0\u5F00\u59CB\u3002",backendGenerationFailedWithReason:"\u751F\u6210\u672A\u5B8C\u6210\uFF1A{{reason}}",generationRoundBudgetFailed:"\u751F\u6210\u6B65\u9AA4\u8FC7\u591A\uFF0C\u6F14\u793A\u7A3F\u5C1A\u672A\u5B8C\u6210\u3002",generationRoundBudgetHint:"\u53EF\u5C1D\u8BD5\u7F29\u77ED\u63CF\u8FF0\u3001\u51CF\u5C11\u9875\u6570\u6216\u53BB\u6389\u591A\u4F59\u53C2\u8003\u94FE\u63A5\uFF0C\u7136\u540E\u91CD\u65B0\u53D1\u9001\u3002",generationRetrying:"\u751F\u6210\u51FA\u73B0\u9519\u8BEF\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8BD5\uFF08{{attempt}}/{{max}}\uFF09\u2026",generationRetryAttempt:"\u7B2C {{attempt}}/{{max}} \u6B21\u5C1D\u8BD5\u3002",generationRecoveryContinuing:"{{stage}}\u4ECD\u672A\u5B8C\u6210\uFF0C\u6B63\u5728\u8BA9\u540C\u4E00\u4E2A Agent Session \u7EE7\u7EED\u6267\u884C\uFF08{{attempt}}/{{max}}\uFF09\u2026",generationRecoveryExhausted:"{{stage}}\u5728 {{retries}} \u6B21\u91CD\u8BD5\u548C {{continuations}} \u6B21\u7EE7\u7EED\u6267\u884C\u540E\u4ECD\u672A\u5B8C\u6210\u3002",generationRecoveryFailureDetail:"\u6700\u540E\u4E00\u6B21\u53EF\u9A8C\u8BC1\u7684\u5931\u8D25\u539F\u56E0\uFF1A{{reason}}",generationStagePlanning:"\u89C4\u5212\u9636\u6BB5",generationStageSlide:"\u7B2C {{slide}} \u9875",generationStageAudit:"\u6700\u7EC8\u5BA1\u8BA1",agentOnlyRetryHint:"\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\uFF0C\u7A0D\u540E\u518D\u8BD5\u3002",generationPlanPhase:"\u9636\u6BB5 1/3 \xB7 \u7814\u7A76\u4E0E\u5168\u7BC7\u89C4\u5212",generationPlanningSlides:"\u6B63\u5728\u7F16\u5199\u6BCF\u9875\u5185\u5BB9\u7B80\u62A5\u2026",generationPlanProgress:"\u89C4\u5212\u8FDB\u884C\u4E2D\uFF1A\u5DF2\u5199\u5B8C {{count}} \u9875\u7B80\u62A5\u2026",generationPlanReady:"\u89C4\u5212\u5B8C\u6210\uFF1A\u5171 {{count}} \u9875\u3002",generationPlanRetry:"\u89C4\u5212\u9636\u6BB5\u51FA\u9519\uFF0C\u4EC5\u91CD\u8BD5\u89C4\u5212\u9636\u6BB5\uFF08{{attempt}}/{{max}}\uFF09\u2026",generationAuditRetry:"\u6700\u7EC8\u5BA1\u8BA1\u5C1A\u672A\u5B8C\u6210\uFF0C\u6B63\u5728\u91CD\u8BD5\u5BA1\u8BA1\u9636\u6BB5\uFF08{{attempt}}/{{max}}\uFF09\u2026",generationSlidesPhase:"\u9636\u6BB5 2/3 \xB7 \u4E32\u884C\u6E32\u67D3 {{count}} \u9875\uFF0C\u6BCF\u9875\u4E00\u6B21 Agent \u8C03\u7528",generationAuditPhase:"\u9636\u6BB5 3/3 \xB7 \u6309\u8BBE\u8BA1 Skill \u4E0E\u6837\u5F0F\u5951\u7EA6\u5BA1\u8BA1\u6574\u5957\u5E7B\u706F\u7247",generationRenderingSlide:"\u6B63\u5728\u6E32\u67D3\u7B2C {{slide}}/{{total}} \u9875\u2026",generationSlideReady:"\u7B2C {{slide}}/{{total}} \u9875\u5DF2\u5B8C\u6210\u3002",generationSlideRetry:"\u7B2C {{slide}} \u9875\u51FA\u9519\uFF0C\u6B63\u5728\u91CD\u8BD5\uFF08{{attempt}}/{{max}}\uFF09\u2026",generationSlideRepair:"\u7B2C {{slide}} \u9875\u6821\u9A8C\u672A\u901A\u8FC7\uFF0CAgent \u4FEE\u590D\u4E2D\uFF08{{attempt}}/{{max}}\uFF09\u2026",generationResumeFrom:"\u4ECE\u7B2C {{slide}} \u9875\u7EE7\u7EED\u751F\u6210\uFF0C\u5DF2\u5B8C\u6210\u7684\u9875\u9762\u4FDD\u7559\u3002",generationPartialDeck:"\u7B2C {{missing}} \u9875\u672A\u5B8C\u6210\u3002\u5DF2\u5B8C\u6210\u7684\u9875\u9762\u5DF2\u4FDD\u7559\uFF0C\u53EF\u7EE7\u7EED\u53D1\u9001\u6307\u4EE4\u8865\u5168\u7F3A\u5931\u9875\u3002",agentWorkingTitle:"\u6B63\u5728\u751F\u6210\u6F14\u793A\u7A3F",agentWorkingKicker:"\u751F\u6210\u4E2D",agentWorkingClaim:"\u5B8C\u6210\u540E\uFF0C\u6700\u7EC8\u9875\u9762\u4F1A\u51FA\u73B0\u5728\u4E2D\u95F4\u753B\u5E03\u3002",agentWorkingProof:"\u8FDB\u5EA6",agentWorkingDetail:"\u8FD9\u662F\u751F\u6210\u8FC7\u7A0B\u4E2D\u7684\u9884\u89C8\u533A\u57DF\u3002",agentWorkingSourceNote:"\u5185\u5BB9\u5C06\u6839\u636E\u4F60\u7684 Prompt \u81EA\u52A8\u751F\u6210\u3002",agentWorkingMetric:"Live",agentWorkingMetricLabel:"\u7B49\u5F85\u9875\u9762\u751F\u6210",processEventStarted:"\u5DF2\u5F00\u59CB\u751F\u6210\u3002",processEventWaiting:"\u51C6\u5907\u5F00\u59CB\u2026",processEventRound:"\u6B63\u5728\u7EC4\u7EC7\u5185\u5BB9\u4E0E\u7ED3\u6784\u3002",processEventTool:"\u6B63\u5728\u8BFB\u53D6\u7D20\u6750\u5E76\u5E94\u7528\u8BBE\u8BA1\u89C4\u5219\u3002",processEventText:"\u6B63\u5728\u64B0\u5199\u9875\u9762\u5E03\u5C40\u3002",processEventDone:"\u6F14\u793A\u7A3F\u5DF2\u751F\u6210\u3002",generationParsingDeck:"\u6B63\u5728\u52A0\u8F7D\u9875\u9762\u5230\u7F16\u8F91\u5668\u2026",processWaitingForEventsTitle:"\u7B49\u5F85\u5F00\u59CB",processWaitingForEvents:"\u53D1\u9001 Prompt \u540E\uFF0C\u8FD9\u91CC\u4F1A\u663E\u793A\u751F\u6210\u8FDB\u5EA6\u3002",processEventUnknown:"\u8FDB\u5EA6\u66F4\u65B0",eventTurnStarted:"\u5F00\u59CB\u751F\u6210",eventTurnFailed:"\u751F\u6210\u5931\u8D25",eventTurnCancelled:"\u751F\u6210\u5DF2\u53D6\u6D88",eventRoundCompleted:"\u672C\u9636\u6BB5\u5DF2\u5B8C\u6210",eventThinkingChunk:"\u601D\u8003\u6D41",eventTokenUsage:"Token \u7528\u91CF\u66F4\u65B0",eventUnknownTool:"\u5DE5\u5177",eventToolDetected:"\u68C0\u6D4B\u5230\u5DE5\u5177",eventToolParams:"\u6B63\u5728\u8BFB\u53D6\u5DE5\u5177\u53C2\u6570",eventToolQueued:"\u5DE5\u5177\u5DF2\u6392\u961F",eventToolWaiting:"\u7B49\u5F85\u5DE5\u5177\u6267\u884C",eventToolStarted:"\u5F00\u59CB\u8C03\u7528\u5DE5\u5177",eventToolProgress:"\u5DE5\u5177\u8FDB\u5EA6",eventToolStreaming:"\u5DE5\u5177\u6D41\u5F0F\u8F93\u51FA",eventToolStreamChunk:"\u5DE5\u5177\u8F93\u51FA\u7247\u6BB5",eventToolConfirmation:"\u5DE5\u5177\u9700\u8981\u786E\u8BA4",eventToolConfirmed:"\u5DE5\u5177\u5DF2\u786E\u8BA4",eventToolRejected:"\u5DE5\u5177\u5DF2\u62D2\u7EDD",eventToolCompleted:"\u5DE5\u5177\u6267\u884C\u5B8C\u6210",eventToolFailed:"\u5DE5\u5177\u6267\u884C\u5931\u8D25",eventToolCancelled:"\u5DE5\u5177\u5DF2\u53D6\u6D88",eventToolQueuePosition:"\u961F\u5217\u4F4D\u7F6E",eventToolSkillName:"PPT \u8BBE\u8BA1\u89C4\u8303",eventToolWebSearchName:"\u7F51\u9875\u641C\u7D22",eventToolWebFetchName:"\u7F51\u9875\u8BFB\u53D6",eventToolSkillReady:"\u8BBE\u8BA1\u89C4\u8303\u5DF2\u5C31\u7EEA",generationProgressPulse:"\u4ECD\u5728\u751F\u6210\u4E2D\u2026",generationPageProgress:"\u6B63\u5728\u751F\u6210\u7B2C {{current}} \u9875",generationSlideProgress:"\u5DF2\u8D77\u8349 {{count}} \u9875",generationStepBrief:"\u53D1\u5E03\u5047\u8BBE",generationStepBriefDetail:"\u9605\u8BFB Prompt \u5E76\u89C4\u5212\u6F14\u793A\u7A3F\u3002",generationStepSpine:"\u751F\u6210\u5927\u7EB2",generationStepSpineDetail:"\u628A\u9700\u6C42\u8F6C\u6210\u65AD\u8A00\u5F0F\u9875\u9762\u6807\u9898\u3002",generationStepProof:"\u9875\u9762\u6587\u6848",generationStepProofDetail:"\u7528\u7D20\u6750\u4E8B\u5B9E\u6216\u660E\u786E\u5047\u8BBE\u652F\u6491\u6BCF\u9875\u3002",generationStepDesign:"\u8BBE\u8BA1\u6392\u7248",generationStepDesignDetail:"\u5E94\u7528\u4E3B\u9898\u3001\u7248\u5F0F\u4E0E\u89C6\u89C9\u5C42\u6B21\u3002",generationStepCompile:"\u52A0\u8F7D\u9875\u9762",generationStepCompileDetail:"\u5C06\u751F\u6210\u7ED3\u679C\u52A0\u8F7D\u4E3A\u53EF\u7F16\u8F91\u9875\u9762\u3002",generationReadingBrief:"\u6B63\u5728\u7406\u89E3\u4F60\u7684 Prompt\u2026",generationWritingClaims:"\u6B63\u5728\u751F\u6210\u5927\u7EB2\u2026",generationChoosingProof:"\u6B63\u5728\u64B0\u5199\u9875\u9762\u6587\u6848\u2026",generationDesigningLayouts:"\u6B63\u5728\u8BBE\u8BA1\u9875\u9762\u7248\u5F0F\u2026",generationCompiled:"\u6F14\u793A\u7A3F\u5DF2\u5C31\u7EEA\u3002",generationSpineReady:"\u8BBA\u70B9\u4E3B\u7EBF\u5DF2\u751F\u6210\u3002",generationLocalSpine:"\u751F\u6210\u670D\u52A1\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",generationLocalCompiler:"\u751F\u6210\u670D\u52A1\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",agentPlanning:"\u6B63\u5728\u89C4\u5212\u6F14\u793A\u7A3F\u2026",agentPlanningFallback:"\u89C4\u5212\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",outlineTitle:"\u5927\u7EB2",outlineSubcopy:"\u5148\u786E\u8BA4\u6BCF\u4E00\u9875\u7684\u6545\u4E8B\u4E3B\u7EBF\uFF0C\u518D\u751F\u6210\u5B8C\u6574\u9875\u9762\u3002",addOutlineItem:"\u6DFB\u52A0\u5927\u7EB2\u9879",syncOutline:"\u7528\u5927\u7EB2\u540C\u6B65\u9875\u9762",modeEdit:"\u7F16\u8F91",modeSort:"\u6392\u5E8F",modePresent:"\u6F14\u793A",inspectorTitle:"\u68C0\u67E5\u5668",addText:"\u6587\u5B57",addList:"\u5217\u8868",addShape:"\u5F62\u72B6",addMetric:"\u6307\u6807",addChart:"\u56FE\u8868",addMedia:"\u5A92\u4F53",addSlide:"\u6DFB\u52A0\u9875\u9762",deleteSlide:"\u5220\u9664\u9875\u9762",deleteElement:"\u5220\u9664\u5143\u7D20",aiTitle:"AI \u8BBE\u8BA1",aiSubcopy:"\u7528 Prompt \u4FEE\u6539\u5F53\u524D\u9875\u3001\u6574\u5957 PPT\uFF0C\u6216\u63D2\u5165\u65B0\u9875\u3002",instructionPlaceholder:"\u4F8B\u5982\uFF1A\u8BA9\u672C\u9875\u66F4\u89C6\u89C9\u5316\uFF1B\u589E\u52A0\u4E00\u9875\u7ADE\u54C1\u5BF9\u6BD4\uFF1B\u6574\u5957\u6539\u6210\u878D\u8D44\u8DEF\u6F14\u98CE\u683C\uFF1B\u5220\u9664\u91CD\u590D\u5185\u5BB9\u3002",reviseSlide:"\u4FEE\u6539\u672C\u9875",reviseDeck:"\u4FEE\u6539\u6574\u5957",insertSlide:"\u63D2\u5165\u65B0\u9875",aiRewrite:"\u6539\u5199",aiCondense:"\u538B\u7F29",aiProfessional:"\u4E13\u4E1A\u5316",aiMoreVisual:"\u66F4\u89C6\u89C9\u5316",aiNotes:"\u6F14\u8BB2\u5907\u6CE8",aiRedesign:"\u91CD\u6392\u672C\u9875",aiRestyleDeck:"\u91CD\u5851\u6574\u5957\u98CE\u683C",styleTitle:"\u98CE\u683C",themeLabel:"\u4E3B\u9898",themeExecutive:"\u9AD8\u7BA1",themeMarket:"\u5E02\u573A",themeMinimal:"\u6781\u7B80",themeStudio:"\u521B\u610F",densityLabel:"\u5BC6\u5EA6",densityCompact:"\u7D27\u51D1",densityStandard:"\u6807\u51C6",densitySpacious:"\u8212\u5C55",brandPrimaryLabel:"\u4E3B\u8272",brandAccentLabel:"\u5F3A\u8C03\u8272",imagePolicyLabel:"\u56FE\u7247\u7B56\u7565",imagePolicyPlaceholders:"\u53EF\u7F16\u8F91\u5360\u4F4D",imagePolicyNone:"\u4E0D\u4F7F\u7528\u56FE\u7247",ready:"\u51C6\u5907\u5C31\u7EEA\u3002",statusPillReady:"\u5C31\u7EEA",statusPillBusy:"AI",exportReady:"\u751F\u6210\u540E\u53EF\u5BFC\u51FA HTML \u548C\u53EF\u7F16\u8F91 PPTX\u3002",working:"AI \u6B63\u5728\u5904\u7406...",outlineReady:"\u5927\u7EB2\u5DF2\u751F\u6210\u3002\u53EF\u5148\u8C03\u6574\u5927\u7EB2\uFF0C\u518D\u751F\u6210\u8BBE\u8BA1\u7A3F\u3002",deckReady:"\u8BBE\u8BA1\u7A3F\u5DF2\u751F\u6210\u3002",aiUnavailable:"\u751F\u6210\u670D\u52A1\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002",sourceGroundingRequired:"\u6765\u6E90\u65E0\u6CD5\u9A8C\u8BC1\u3002\u5DF2\u751F\u6210\u201C\u5148\u9A8C\u8BC1\u201D\u7684\u6F14\u793A\u7A3F\uFF0C\u800C\u4E0D\u662F\u7F16\u9020\u4E8B\u5B9E\u3002",saved:"\u5DF2\u4FDD\u5B58\u3002",slideUpdated:"\u9875\u9762\u5DF2\u66F4\u65B0\u3002",deckUpdated:"\u6574\u5957\u5DF2\u66F4\u65B0\u3002",slideInserted:"\u65B0\u9875\u9762\u5DF2\u63D2\u5165\u3002",deckRestyled:"\u6574\u5957\u98CE\u683C\u5DF2\u66F4\u65B0\u3002",cannotDelete:"\u81F3\u5C11\u4FDD\u7559\u4E00\u9875\u3002",noSelection:"\u9009\u62E9\u4E00\u4E2A\u9875\u9762\u5143\u7D20\u540E\u53EF\u7F16\u8F91\u5185\u5BB9\u548C\u5E03\u5C40\u3002",elementTypeLabel:"\u7C7B\u578B",elementTextLabel:"\u6587\u5B57",elementItemsLabel:"\u6761\u76EE",elementDataLabel:"\u56FE\u8868\u6570\u636E",geometryLabel:"\u4F4D\u7F6E\u5C3A\u5BF8",styleLabel:"\u6837\u5F0F",speakerNotesLabel:"\u6F14\u8BB2\u5907\u6CE8",kickerLabel:"\u7709\u6807",claimLabel:"\u8BBA\u70B9",proofObjectLabel:"\u8BC1\u636E\u5BF9\u8C61",supportNoteLabel:"\u652F\u6491\u8BF4\u660E",sourceNoteLabel:"\u6765\u6E90\u8BF4\u660E",newSlideTitle:"\u65B0\u9875\u9762",defaultDeckTitle:"AI \u4EA7\u54C1\u6218\u7565",slidesMeta:"{{count}} \u9875",exportHtmlDone:"HTML \u6F14\u793A\u7A3F\u5DF2\u4E0B\u8F7D\u3002",exportHtmlWorking:"\u6B63\u5728\u5BFC\u51FA HTML...",exportHtmlFailed:"HTML \u5BFC\u51FA\u5931\u8D25\uFF1A",exportSavedTo:"\u5DF2\u5BFC\u51FA\u5230 {{path}}",exportPptxWorking:"\u6B63\u5728\u6E32\u67D3\u53EF\u7F16\u8F91 PPTX...",exportPptxDone:"\u53EF\u7F16\u8F91 PPTX \u5DF2\u4E0B\u8F7D\u3002",exportPptxFailed:"PPTX \u5BFC\u51FA\u5931\u8D25\uFF1A",exportPdfWorking:"\u6B63\u5728\u6E32\u67D3 PDF...",exportPdfDone:"PDF \u5DF2\u4E0B\u8F7D\u3002",exportPdfFailed:"PDF \u5BFC\u51FA\u5931\u8D25\uFF1A",exportPngWorking:"\u6B63\u5728\u6E32\u67D3 PNG \u9875\u9762...",exportPngDone:"PNG \u9875\u9762\u538B\u7F29\u5305\u5DF2\u4E0B\u8F7D\u3002",exportPngFailed:"PNG \u5BFC\u51FA\u5931\u8D25\uFF1A",exportDeckEmpty:"\u8BF7\u5148\u751F\u6210\u5E7B\u706F\u7247\u540E\u518D\u5BFC\u51FA\u3002",slidesEmptyHint:"\u751F\u6210\u540E\u9875\u9762\u7F29\u7565\u56FE\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002",welcomeTitle:"\u63CF\u8FF0\u4F60\u7684 PPT\uFF0C\u4E00\u952E\u5F00\u59CB",welcomeSubcopy:"\u4E00\u6761 Prompt \u5373\u53EF\u751F\u6210\u5927\u7EB2\u3001\u8BBE\u8BA1\u9875\u9762\u548C\u53EF\u7F16\u8F91\u6F14\u793A\u7A3F\uFF0C\u4E4B\u540E\u53EF\u9010\u9875\u7EE7\u7EED\u4FEE\u6539\u3002",welcomeTip1:"10 \u9875\u6218\u7565\u65B9\u6848",welcomeTip2:"\u6539\u6210\u6295\u8D44\u4EBA\u7248\u672C",welcomeTip3:"\u672C\u9875\u66F4\u89C6\u89C9\u5316",deleteSlideDefaultPrompt:"\u5220\u9664\u5F53\u524D\u9875\u9762\uFF0C\u5E76\u4FDD\u6301\u6574\u5957 PPT \u7ED3\u6784\u8FDE\u8D2F\u3002",prev:"\u4E0A\u4E00\u9875",next:"\u4E0B\u4E00\u9875",assistantHello:"\u544A\u8BC9\u6211\u4F60\u8981\u505A\u4EC0\u4E48 PPT\u3002\u6211\u4F1A\u5148\u751F\u6210\u5927\u7EB2\uFF0C\u518D\u53D8\u6210\u53EF\u7F16\u8F91\u9875\u9762\u3002",aiChatApplied:"\u5DF2\u628A\u6307\u4EE4\u5E94\u7528\u5230\u5F53\u524D\u9875\u9762\u3002",localMetricLabel:"\u9700\u8981\u8BB0\u4F4F\u7684\u4FE1\u53F7",mediaPlaceholder:"\u56FE\u7247\u5360\u4F4D",slidesUnit:"\u9875",closeConfirm:"\u786E\u8BA4\u65B9\u5411",closeOwner:"\u660E\u786E\u8D1F\u8D23\u4EBA",closeIteration:"\u542F\u52A8\u4E0B\u4E00\u8F6E\u8FED\u4EE3",pointClaimPrefix:"\u8BBA\u70B9\uFF1A",pointProofPrefix:"\u8BC1\u636E\u5BF9\u8C61\uFF1A",pointAudiencePrefix:"\u53D7\u4F17\u5173\u8054\uFF1A",pointEvidenceRule:"\u8BC1\u636E\u89C4\u5219\uFF1A\u660E\u786E\u6807\u6CE8\u5047\u8BBE",pointDesignRule:"\u8BBE\u8BA1\u89C4\u5219\uFF1A\u4E00\u4E2A\u4E3B\u89C6\u89C9\u52A0\u4E00\u4E2A\u652F\u6491\u680F",pointCloseRule:"\u6536\u675F\uFF1A\u8BF4\u6E05\u4E0B\u4E00\u6B65\u884C\u52A8",claimCover:"{{topic}} \u9700\u8981\u4E00\u6761\u6E05\u6670\u7684\u51B3\u7B56\u4E3B\u7EBF\uFF0C\u800C\u4E0D\u662F\u4FE1\u606F\u5806\u780C\u3002",claimPressure:"{{title}} \u662F\u53D7\u4F17\u5FC5\u987B\u89E3\u51B3\u7684\u5173\u952E\u538B\u529B\u70B9\u3002",claimDecision:"{{title}} \u4E4B\u6240\u4EE5\u91CD\u8981\uFF0C\u662F\u56E0\u4E3A\u5B83\u628A\u8BC1\u636E\u8FDE\u63A5\u5230\u884C\u52A8\u3002",claimProof:"{{title}} \u5FC5\u987B\u7531\u9875\u9762\u91CC\u7684\u4E3B\u8BC1\u636E\u5BF9\u8C61\u6765\u627F\u62C5\u8BBA\u8BC1\u3002",claimAction:"{{title}} \u6700\u540E\u8981\u843D\u5230\u4E00\u4E2A\u660E\u786E\u51B3\u7B56\u3001\u8D1F\u8D23\u4EBA\u6216\u4E0B\u4E00\u6B65\u3002",supportWithSource:"\u7528\u5DF2\u63D0\u4F9B\u7D20\u6750\u652F\u6491\u8FD9\u4E2A\u8BBA\u70B9\uFF0C\u5E76\u8BA9\u201C{{proof}}\u201D\u6210\u4E3A\u4E3B\u8BC1\u636E\u3002",supportWithAssumption:"\u8865\u5145\u4E00\u4E2A\u5177\u4F53\u4F8B\u5B50\u6216\u6307\u6807\uFF0C\u8BA9\u201C{{proof}}\u201D\u652F\u6491\u8BBA\u70B9\uFF0C\u800C\u4E0D\u662F\u586B\u5145\u6587\u5B57\u3002",sourceUserMaterial:"\u6765\u6E90\uFF1A\u7528\u6237\u63D0\u4F9B\u7D20\u6750",sourceDraftAssumption:"\u6765\u6E90\uFF1A\u8349\u7A3F\u5047\u8BBE\uFF1B\u5BF9\u5916\u4F7F\u7528\u524D\u9700\u786E\u8BA4",defaultSpeakerNote:"\u5148\u8BB2\u201C{{title}}\u201D\u7684\u7ED3\u8BBA\uFF0C\u518D\u7528\u4E00\u4E2A\u5177\u4F53\u4F8B\u5B50\u6216\u6570\u636E\u652F\u6491\u3002",proofMarketMap:"\u5E02\u573A\u5730\u56FE",proofOperatingModel:"\u8FD0\u8425\u6A21\u578B",proofRiskBridge:"\u98CE\u9669\u6865",proofDecisionTable:"\u51B3\u7B56\u8868",proofBeforeAfter:"\u524D\u540E\u5BF9\u6BD4\u6D41\u7A0B",proofValueBridge:"\u4EF7\u503C\u6865",proofCustomerProof:"\u5BA2\u6237\u8BC1\u636E",proofImplementationPlan:"\u5B9E\u65BD\u8BA1\u5212",proofMetricBridge:"\u6307\u6807\u6865",proofTrendChart:"\u8D8B\u52BF\u56FE",proofSourceSummary:"\u6765\u6E90\u6458\u8981",proofVerificationPlan:"\u9A8C\u8BC1\u8BA1\u5212",proofCapabilityMatrix:"\u80FD\u529B\u77E9\u9635",proofEvidenceList:"\u8BC1\u636E\u5217\u8868",proofVarianceTable:"\u5DEE\u5F02\u8868",proofRiskRegister:"\u98CE\u9669\u6E05\u5355",proofConceptMap:"\u6982\u5FF5\u56FE",proofWorkedExample:"\u6848\u4F8B\u6F14\u7B97",proofComparison:"\u5BF9\u6BD4",proofPracticePrompt:"\u7EC3\u4E60\u63D0\u793A",proofMarketWedge:"\u5E02\u573A\u5207\u5165\u70B9",proofProductDiagram:"\u4EA7\u54C1\u56FE",proofTractionChart:"\u7275\u5F15\u529B\u56FE\u8868",proofMilestonePlan:"\u91CC\u7A0B\u7891\u8BA1\u5212",proofVisualProof:"\u89C6\u89C9\u8BC1\u636E",sourceFetchedNote:"\u6765\u6E90\uFF1A\u5DF2\u8BFB\u53D6 {{count}} \u4E2A URL",bpContextTitle:"{{topic}} \u9700\u8981\u5148\u5EFA\u7ACB\u5728\u6765\u6E90\u4E8B\u5B9E\u4E4B\u4E0A\uFF0C\u518D\u63D0\u51FA\u5224\u65AD\u3002",bpSourceNeededTitle:"{{topic}} \u9700\u8981\u8865\u5145\u6765\u6E90\u7D20\u6750\u540E\u624D\u80FD\u63D0\u51FA\u4E8B\u5B9E\u6027\u7ED3\u8BBA\u3002",bpProblemTitle:"\u5F53\u524D\u5173\u952E\u95EE\u9898\u662F\uFF1A\u53D7\u4F17\u53EF\u4EE5\u5B89\u5168\u76F8\u4FE1\u4EC0\u4E48\u3002",bpSolutionTitle:"{{topic}} \u5E94\u901A\u8FC7\u80FD\u529B\u3001\u6D41\u7A0B\u548C\u8BC1\u636E\u6765\u89E3\u91CA\u3002",bpWorkflowTitle:"\u5DE5\u4F5C\u6D41\u9700\u8981\u5C55\u793A\u4EA7\u54C1\u5982\u4F55\u4E00\u6B65\u6B65\u521B\u9020\u4EF7\u503C\u3002",bpProofTitle:"\u53EF\u4FE1\u5EA6\u5E94\u8BE5\u7531\u6765\u6E90\u8BC1\u636E\u627F\u62C5\uFF0C\u800C\u4E0D\u662F\u7531\u5047\u56FE\u8868\u627F\u62C5\u3002",bpVerificationTitle:"\u9A8C\u8BC1\u7F3A\u53E3\u5FC5\u987B\u663E\u6027\u5C55\u793A\uFF0C\u4E0D\u80FD\u85CF\u5728\u865A\u6784\u56FE\u8868\u540E\u9762\u3002",bpRiskTitle:"\u6700\u5927\u98CE\u9669\u662F\u8D85\u51FA\u5DF2\u6709\u7D20\u6750\u8FC7\u5EA6\u58F0\u79F0\u3002",bpDecisionTitle:"\u4E0B\u4E00\u6B65\u662F\u9A8C\u8BC1\u5173\u952E\u8BBA\u70B9\uFF0C\u5E76\u9009\u62E9\u6700\u5F3A\u53D9\u4E8B\u8DEF\u5F84\u3002",bpSupportSource:"\u57FA\u4E8E\u5DF2\u8BFB\u53D6\u6216\u7C98\u8D34\u7D20\u6750\u751F\u6210\uFF1B\u5BF9\u5916\u4F7F\u7528\u524D\u8BF7\u6838\u5BF9\u539F\u6587\u3002",bpSupportMissing:"\u7D20\u6750\u4E0D\u8DB3\uFF1B\u672C\u9875\u5E94\u4F5C\u4E3A\u9A8C\u8BC1\u63D0\u793A\uFF0C\u800C\u4E0D\u662F\u4E8B\u5B9E\u7ED3\u8BBA\u3002",bpMissingFact1:"\u8BF7\u7C98\u8D34\u6765\u6E90\u7B14\u8BB0\u3001README\u3001\u6307\u6807\u6216\u4EA7\u54C1\u63CF\u8FF0\u6765\u652F\u6491\u672C\u9875\u3002",bpMissingFact2:"\u4E0D\u8981\u4F7F\u7528\u865A\u6784\u6307\u6807\uFF1B\u7528\u5DF2\u9A8C\u8BC1\u8BC1\u636E\u66FF\u6362\u5360\u4F4D\u5185\u5BB9\u3002",bpMissingFact3:"\u7528\u672C\u9875\u51B3\u5B9A\u4E0B\u4E00\u6B65\u9700\u8981\u8865\u5145\u7814\u7A76\u4EC0\u4E48\u3002",qualityOutOfBounds:"\u6709\u5143\u7D20\u8D85\u51FA\u5E7B\u706F\u7247\u5B89\u5168\u533A\u57DF\u3002",qualityTextDense:"\u5F53\u524D\u7248\u5F0F\u4E2D\u7684\u53EF\u89C1\u6587\u5B57\u53EF\u80FD\u8FC7\u5BC6\u3002",qualityChartUngrounded:"\u56FE\u8868\u6570\u636E\u7F3A\u5C11\u6765\u6E90\u6570\u5B57\uFF0C\u5DF2\u79FB\u9664\u6216\u6807\u8BB0\u3002",qualityOverlap:"\u6587\u5B57\u6216\u56FE\u8868\u5143\u7D20\u53EF\u80FD\u53D1\u751F\u91CD\u53E0\u3002",qualityMissingClaim:"\u672C\u9875\u9700\u8981\u4E00\u4E2A\u6E05\u6670\u8BBA\u70B9\u3002",qualityReportTitle:"\u8D28\u91CF\u62A5\u544A",qualityNeedsReview:"\u9700\u8981\u590D\u6838",qualityHasWarnings:"\u8D28\u91CF\u63D0\u9192",exportFormatUnavailable:"\u8BE5\u5BFC\u51FA\u683C\u5F0F\u5C1A\u672A\u652F\u6301\u3002",exportTitle:"\u5BFC\u51FA",exportCancel:"\u53D6\u6D88",exportConfirm:"\u5BFC\u51FA\u6587\u4EF6",exportPreviewPrevAria:"\u4E0A\u4E00\u9875",exportPreviewNextAria:"\u4E0B\u4E00\u9875",exportFormat:"\u683C\u5F0F",exportQuality:"\u8D28\u91CF",exportDpi:"\u56FE\u7247 DPI",exportRange:"\u5E7B\u706F\u7247\u8303\u56F4",exportShare:"\u5206\u4EAB",propertiesStyle:"\u6837\u5F0F",propertiesLayout:"\u5E03\u5C40",propertiesAnimation:"\u52A8\u753B",propertiesThemeColor:"\u4E3B\u9898\u8272",propertiesFont:"\u5B57\u4F53",propertiesColorMode:"\u5E7B\u706F\u7247\u914D\u8272",propertiesStylePreset:"\u98CE\u683C\u9884\u8BBE",colorModeLight:"\u6D45\u8272",colorModeDark:"\u6DF1\u8272",fontSansSerif:"\u975E\u886C\u7EBF",fontSerif:"\u886C\u7EBF",propertiesDensity:"\u5BC6\u5EA6",propertiesSmartAlign:"\u667A\u80FD\u5BF9\u9F50",propertiesPageTransition:"\u9875\u9762\u8FC7\u6E21",propertiesElementAnimation:"\u5143\u7D20\u52A8\u753B",densityLoose:"\u5BBD\u677E"}};function Dr(){let e=window.app?.locale||document.documentElement.lang||"";return e==="zh-CN"||String(e).startsWith("zh")?"zh-CN":"en-US"}function U(e,t={}){let r=ns[Dr()]||ns["en-US"],n=ns["en-US"][e]||e,a=r[e]||n;return Object.entries(t).forEach(([i,o])=>{a=a.replaceAll(`{{${i}}}`,String(o))}),a}var lh=["clean-business","insight-report"],Si={"clean-business":{styleKey:"clean-business",names:{"en-US":"Clean Business","zh-CN":"\u7B80\u6D01\u5546\u52A1"},descriptions:{"en-US":"Calm editorial product-doc: warm canvas, charcoal type, one restrained accent, typography-led","zh-CN":"\u5E73\u9759\u7F16\u8F91\u611F\u4EA7\u54C1\u6587\u6863\uFF1A\u6696\u767D\u753B\u5E03\u3001\u70AD\u9ED1\u5B57\u9636\u3001\u5355\u4E00\u514B\u5236\u5F3A\u8C03\u8272\uFF0C\u6392\u7248\u5373\u89C6\u89C9"},colorMode:"light",palette:{background:"#FAFAF7",ink:"#111111",muted:"#787774",primary:"#1E293B",accent:"#0f766e",panel:"#F3F2EF"},fontFamily:"sans",density:"spacious",keywords:/business|clean|professional|商务|简洁|专业|企业/},"insight-report":{styleKey:"insight-report",names:{"en-US":"Insight Report","zh-CN":"\u6D1E\u5BDF\u6C47\u62A5"},descriptions:{"en-US":"Analytical memo on a slide: full sentences, explicit frameworks, evidence-dense tables","zh-CN":"\u5206\u6790\u5907\u5FD8\u5F55\u4E0A\u5899\uFF1A\u5B8C\u6574\u8BBA\u8BC1\u3001\u663E\u6027\u6846\u67B6\u3001\u6EE1\u7248\u8BC1\u636E\uFF0C\u50CF\u5C3D\u8C03\u9644\u5F55\u800C\u975E bullet \u6F14\u8BB2"},colorMode:"light",palette:{background:"#ffffff",ink:"#1f2937",muted:"#64748b",primary:"#1e3a8a",accent:"#dc2626",panel:"#f1f5f9"},fontFamily:"sans",density:"compact",keywords:/insight|consult|academic|research|whitepaper|due.*diligence|洞察|咨询|学术|调研|详尽|深度分析|尽调/}},ln="clean-business";function as(e){return e&&Si[e]?e:ln}function is(e){return Si[as(e)]}var $n={background:"#111111",ink:"#F5F5F4",muted:"#A8A29E",primary:"#93C5FD",accent:"#2DD4BF",panel:"#1C1C1C"};function uc(e,t="light"){let r=e?.palette||{};return t!=="dark"?{...r}:e?.paletteDark&&typeof e.paletteDark=="object"?{...e.paletteDark}:{background:$n.background,ink:$n.ink,muted:$n.muted,primary:r.primary||$n.primary,accent:r.accent||$n.accent,panel:$n.panel}}function ch(e){return e==="zh-CN"?"zh-CN":"en-US"}function fc(e){let t=ch(e);return lh.filter(r=>Si[r]).map(r=>{let n=Si[r];return{key:r,displayName:n.names[t]||n.names["en-US"],description:n.descriptions[t]||n.descriptions["en-US"],colorMode:n.colorMode}})}var Ea="pptLiveStudioStateV6",cs="pptLiveDeckHistoryV1",gc=6,ds=["text","list","shape","metric","chart","media"],ss={executive:{name:"Executive",background:"#fbfcff",ink:"#111827",muted:"#5b6575",primary:"#0f766e",accent:"#f97316",panel:"#ffffff"},market:{name:"Market",background:"#fffdf7",ink:"#1f2937",muted:"#6b5f50",primary:"#2563eb",accent:"#d97706",panel:"#ffffff"},minimal:{name:"Minimal",background:"#f8fafc",ink:"#0f172a",muted:"#64748b",primary:"#334155",accent:"#0f766e",panel:"#ffffff"},studio:{name:"Studio",background:"#fcfbff",ink:"#1f1630",muted:"#6c607a",primary:"#7c3aed",accent:"#db2777",panel:"#ffffff"}};function gr(e="id"){return`${e}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function Vr(e){return JSON.parse(JSON.stringify(e))}function mt(e,t,r){return Math.max(t,Math.min(r,e))}function Le(e){return String(e??"").replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function us(){return{topic:"",slideTarget:0}}function mc(e="strategy"){let t={strategy:{profile:"strategy-leadership",thesis:"Decision-led transformation narrative",proofObjects:["market map","operating model","risk bridge","decision table"],arc:["thesis","context","friction","strategic bet","operating model","proof","risks","decision"]},sales:{profile:"gtm-growth",thesis:"Buyer pain to differentiated value narrative",proofObjects:["before/after workflow","value bridge","customer proof","implementation plan"],arc:["outcome","market shift","pain","solution","proof","commercial case","rollout","call to action"]},report:{profile:"finance-ir",thesis:"Executive performance narrative with decisions attached",proofObjects:["metric bridge","trend chart","variance table","risk register"],arc:["summary","scorecard","movement","root cause","metric proof","risk","plan","decision"]},teaching:{profile:"education",thesis:"Concept to application learning journey",proofObjects:["concept map","worked example","comparison","practice prompt"],arc:["goal","map","concept","example","mistakes","practice","summary","next step"]},fundraising:{profile:"fundraising",thesis:"Venture-scale opportunity supported by traction evidence",proofObjects:["market wedge","product diagram","traction chart","milestone plan"],arc:["thesis","problem","solution","market","product","traction","model","ask"]}};return t[e]||t.strategy}function In(e="standard"){let t=String(e||"standard");return t==="loose"?"spacious":["compact","standard","spacious"].includes(t)?t:"standard"}var ls=["spacious","standard","compact"];function Pi(e="standard"){let t=In(e),r=ls.indexOf(t);return r>=0?r:1}function vc(e=1){let t=Math.min(Math.max(Math.round(Number(e)),0),ls.length-1);return ls[t]||"standard"}function yc(e="standard"){let t=In(e),r={spacious:{bulletLimit:4,cardColumns:3,cardGap:2},standard:{bulletLimit:5,cardColumns:4,cardGap:1.8},compact:{bulletLimit:6,cardColumns:4,cardGap:1.2}};return r[t]||r.standard}function hc(e=0){let t=Number(e);return!Number.isFinite(t)||t<=0?0:mt(t,3,24)}function fs(){return{theme:"executive",density:"standard",fontFamily:"sans",colorMode:"light",stylePreset:"clean-business"}}function bc(){return[U("defaultDeckTitle"),"Why now","Current friction","Strategic answer","Core workflow","Proof and impact","Rollout plan","Decision and next steps"]}function Mn(){return{schemaVersion:gc,sessionId:gr("deck"),title:U("blankDeckTitle"),brief:us(),promptDraft:"",lastSubmittedPrompt:"",agentSession:{id:"",workspaceSubdir:"",runId:"",skillKey:""},style:fs(),outline:[],sources:{items:[],facts:[],warnings:[],summary:"",fetchedAt:0},slides:[],activeSlideId:"",selectedElementId:"",mode:"edit",presentIndex:0,status:"ready",generation:{active:!1,current:"idle",steps:wc().map(t=>({...t,status:"pending"})),events:[]},chatMessages:[{role:"assistant",text:U("assistantHello")}],updatedAt:Date.now()}}function zn(e){let t={...Mn(),...e||{}};t.schemaVersion=gc;let r=t.brief||{};t.brief={...us(),topic:String(r.topic||t.promptDraft||"").trim(),slideTarget:hc(r.slideTarget)},t.promptDraft=typeof t.promptDraft=="string"?t.promptDraft:"",t.lastSubmittedPrompt=typeof t.lastSubmittedPrompt=="string"?t.lastSubmittedPrompt:"",t.agentSession={id:String(t.agentSession?.id||""),workspaceSubdir:String(t.agentSession?.workspaceSubdir||""),runId:String(t.agentSession?.runId||""),skillKey:String(t.agentSession?.skillKey||"")},t.style={...fs(),...t.style||{}},delete t.style.brandPrimary,delete t.style.brandAccent,Object.keys(ss).includes(t.style.theme)||(t.style.theme="executive"),["compact","standard","spacious","loose"].includes(t.style.density)||(t.style.density="standard"),t.style.density=In(t.style.density),["sans","serif"].includes(t.style.fontFamily)||(t.style.fontFamily=t.style.fontFamily==="serif"?"serif":"sans"),["light","dark"].includes(t.style.colorMode)||(t.style.colorMode="light"),t.style.stylePreset=as(typeof t.style.stylePreset=="string"?t.style.stylePreset:""),t.generation=Fi(t.generation),t.sources=dh(t.sources),t.brief.slideTarget=hc(t.brief.slideTarget);let n=t.generation.active&&Array.isArray(t.slides)&&t.slides.length===0;t.outline=n?[]:Array.isArray(t.outline)?t.outline.map(i=>String(i||U("newSlideTitle"))):[],t.slides=n?[]:Array.isArray(t.slides)&&t.slides.length>0?t.slides.map((i,o)=>Xr(i,o,t)):t.outline.length>0?t.outline.map((i,o)=>hs(i,o,t.outline.length,t)):[],t.slides.some(i=>i.id===t.activeSlideId)||(t.activeSlideId=t.slides[0]?.id||"");let a=_t(t);return a?.elements.some(i=>i.id===t.selectedElementId)||(t.selectedElementId=a?.elements[0]?.id||""),t.title=t.title||t.slides[0]?.title||U("defaultDeckTitle"),t.updatedAt=Date.now(),t}function dh(e={}){return{items:Array.isArray(e.items)?e.items:[],facts:Array.isArray(e.facts)?e.facts:[],warnings:Array.isArray(e.warnings)?e.warnings:[],summary:typeof e.summary=="string"?e.summary:"",fetchedAt:Number(e.fetchedAt||0)}}function wc(){return[{id:"brief",label:U("generationStepBrief"),detail:U("generationStepBriefDetail")},{id:"spine",label:U("generationStepSpine"),detail:U("generationStepSpineDetail")},{id:"proof",label:U("generationStepProof"),detail:U("generationStepProofDetail")},{id:"design",label:U("generationStepDesign"),detail:U("generationStepDesignDetail")},{id:"compile",label:U("generationStepCompile"),detail:U("generationStepCompileDetail")}]}var uh=80;function fh(e={}){let t=typeof e=="string"?{title:e}:e||{},r=String(t.title||t.label||t.message||U("processEventUnknown")).trim()||U("processEventUnknown"),n=String(t.kind||"info").toLowerCase().replace(/[^a-z0-9-]/g,"")||"info",a=Number(t.timestamp||t.time||0)||Date.now();return{id:String(t.id||gr("generation-event")),seq:Number(t.seq)||0,title:r,detail:String(t.detail||t.description||"").trim(),kind:n,timestamp:a}}function Fi(e={}){let t=new Map((Array.isArray(e.steps)?e.steps:[]).map(a=>[a.id,a])),r=Array.isArray(e.events)?e.events.map(fh).slice(-uh):[],n=r.reduce((a,i)=>Math.max(a,Number(i.seq)||0),0);return{active:!!e.active,current:e.current||"idle",draftedCount:Number(e.draftedCount)||0,slideTarget:Number(e.slideTarget)||0,eventSeq:Math.max(Number(e.eventSeq)||0,n),steps:wc().map(a=>({...a,status:t.get(a.id)?.status||"pending"})),events:r}}function _t(e){return e.slides.find(t=>t.id===e.activeSlideId)||e.slides[0]}function $t(e){return Math.max(0,e.slides.findIndex(t=>t.id===e.activeSlideId))}function On(e){return _t(e)?.elements.find(r=>r.id===e.selectedElementId)||null}function hs(e,t,r,n={brief:us(),style:fs(),slides:[]}){let a=xc(n,t),i={id:gr("slide"),title:e||`${U("newSlideTitle")} ${t+1}`,subtitle:"",kicker:Cc(t,n),claim:As(e,t,n),proofObject:Ei(t,n),supportNote:kc(e,t,n),sourceNote:Pc(n),notes:U("defaultSpeakerNote",{title:e}),layout:Sc(t,r),theme:a,elements:[]};return i.elements=Fc(i,t,r,n),Xr(i,t,n)}function Xr(e,t,r){let n=e?.title||`${U("newSlideTitle")} ${t+1}`,a={id:e?.id||gr("slide"),title:n,subtitle:e?.subtitle||"",kicker:String(e?.kicker||Cc(t,r)),claim:String(e?.claim||As(n,t,r)),proofObject:String(e?.proofObject||Ei(t,r)),supportNote:String(e?.supportNote||kc(n,t,r)),sourceNote:String(e?.sourceNote||Pc(r)),notes:e?.notes||"",layout:e?.layout||Sc(t,r?.slides?.length||1),theme:{...xc(r,t),...e?.theme||e?.style||{}},html:typeof e?.html=="string"?e.html:"",quality:hh(e?.quality),elements:[]},i=Array.isArray(e?.elements)&&e.elements.length>0?e.elements:Fc(a,t,r?.slides?.length||1,r);if(a.elements=i.map(o=>ps(o)),a.html){let o=Di(a.html);o&&(a.theme.background=o)}return a}function hh(e={}){let t=Array.isArray(e?.issues)?e.issues:[];return{score:mt(Number(e?.score??100),0,100),issues:t.slice(0,12).map(r=>({id:String(r?.id||gr("quality")),severity:["high","medium","low"].includes(r?.severity)?r.severity:"low",type:String(r?.type||"quality"),message:String(r?.message||"")})).filter(r=>r.message)}}function ps(e={}){let t=ds.includes(e.type)?e.type:"text",r=Ti(t);return{...r,...e,id:e.id||gr("el"),type:t,x:mt(Number(e.x??r.x),0,98),y:mt(Number(e.y??r.y),0,98),w:mt(Number(e.w??r.w),3,100),h:mt(Number(e.h??r.h),3,100),text:typeof e.text=="string"?e.text:r.text,label:typeof e.label=="string"?e.label:r.label,items:Array.isArray(e.items)?e.items.map(String):r.items,data:Array.isArray(e.data)?e.data.map(ph):r.data,style:Ah({...r.style,...e.style||{}})}}function ph(e,t){return typeof e=="number"?{label:`Q${t+1}`,value:e}:{label:String(e?.label||`Item ${t+1}`),value:Number(e?.value||0)}}function Ah(e={}){return{fontSize:mt(Number(e.fontSize||24),8,88),fontWeight:mt(Number(e.fontWeight||600),100,900),color:e.color||"ink",background:e.background||"transparent",opacity:mt(Number(e.opacity??1),0,1),borderRadius:mt(Number(e.borderRadius||0),0,99),align:e.align||"left"}}function Ti(e){let t={text:{text:"Key message",label:"",items:[],data:[],x:8,y:12,w:60,h:16,style:{fontSize:38,fontWeight:780,color:"ink",background:"transparent",borderRadius:0,opacity:1,align:"left"}},list:{text:"",label:"",items:["First point","Second point","Third point"],data:[],x:9,y:36,w:48,h:40,style:{fontSize:20,fontWeight:500,color:"ink",background:"transparent",borderRadius:8,opacity:1,align:"left"}},shape:{text:"",label:"",items:[],data:[],x:66,y:14,w:24,h:62,style:{fontSize:18,fontWeight:600,color:"accent",background:"primary",borderRadius:22,opacity:.12,align:"center"}},metric:{text:"3x",label:"Faster first draft",items:[],data:[],x:63,y:42,w:26,h:26,style:{fontSize:44,fontWeight:820,color:"primary",background:"panel",borderRadius:14,opacity:1,align:"left"}},chart:{text:"Signal trend",label:"",items:[],data:[{label:"Now",value:42},{label:"Next",value:68},{label:"Target",value:86}],x:52,y:36,w:36,h:32,style:{fontSize:18,fontWeight:700,color:"ink",background:"panel",borderRadius:14,opacity:1,align:"left"}},media:{text:U("mediaPlaceholder"),label:"",items:[],data:[],x:58,y:18,w:32,h:42,style:{fontSize:16,fontWeight:650,color:"muted",background:"soft",borderRadius:16,opacity:1,align:"center"}}};return{...Vr(t[e]||t.text),type:t[e]?e:"text"}}function xc(e,t=0){let r=e?.deckPalette;if(r&&typeof r=="object"){let o=r.primary||"#111111",l=r.accent||"#c84b31";return pc({name:"deck",background:r.background||"#111111",ink:r.ink||"#f8fafc",muted:r.muted||"#cbd5e1",primary:t%2?l:o,accent:t%2?o:l,panel:r.panel||"#1f2937"})}let n=ss[e?.style?.theme||"executive"]||ss.executive,a=n.primary,i=n.accent;return pc({...n,primary:t%2?i:a,accent:t%2?a:i})}function Di(e){let t=String(e||""),r=[/body\s*\{[^}]*background(?:-color)?\s*:\s*([^;}\n]+)/i,/]*style="[^"]*background(?:-color)?\s*:\s*([^;"']+)/i,/html\s*\{[^}]*background(?:-color)?\s*:\s*([^;}\n]+)/i,/:root\s*\{[^}]*background(?:-color)?\s*:\s*([^;}\n]+)/i,/background(?:-color)?\s*:\s*(#[0-9a-f]{3,8}|rgb[a]?\([^)]+\)|hsl[a]?\([^)]+\)|black|white)/i];for(let n of r){let a=t.match(n);if(!a)continue;let i=gh(a[1]);if(i)return i}return null}function gh(e){let t=String(e||"").trim().replace(/\s+!important$/i,"");if(!t||/^transparent$/i.test(t))return null;if(/^#[0-9a-f]{3,8}$/i.test(t))return cn(t,t);if(/^rgb/i.test(t)||/^hsl/i.test(t))return t;let r={black:"#000000",white:"#ffffff",transparent:null};return Object.prototype.hasOwnProperty.call(r,t.toLowerCase())?r[t.toLowerCase()]:t}function pc(e){let t=cn(e.background,"#ffffff"),r=cn(e.panel,"#ffffff");return{...e,background:t,panel:r,ink:Ci(t,e.ink,"#111827","#f8fafc",7),muted:Ci(t,e.muted,"#4b5563","#cbd5e1",4.5),primary:Ci(r,e.primary,"#0f766e","#5eead4",4.5),accent:Ci(r,e.accent,"#c2410c","#fdba74",4.5)}}function Ci(e,t,r,n,a){let i=cn(e,"#ffffff"),o=cn(t,r);if(os(i,o)>=a)return o;let l=cn(r,"#111827"),c=cn(n,"#f8fafc");return os(i,l)>=os(i,c)?l:c}function os(e,t){let r=Ac(e),n=Ac(t),a=Math.max(r,n),i=Math.min(r,n);return(a+.05)/(i+.05)}function Ac(e){let{r:t,g:r,b:n}=mh(e);return[t,r,n].map(a=>{let i=a/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4}).reduce((a,i,o)=>a+i*[.2126,.7152,.0722][o],0)}function cn(e,t){let r=String(e||"").trim(),n=r.match(/^#([0-9a-f]{3})$/i);return n?`#${n[1].split("").map(a=>a+a).join("")}`.toLowerCase():/^#[0-9a-f]{6}$/i.test(r)?r.toLowerCase():t}function mh(e){let t=cn(e,"#000000").slice(1),r=parseInt(t,16);return{r:r>>16&255,g:r>>8&255,b:r&255}}function Sc(e,t){return e===0?"cover":e===t-1?"closing":["split","metric","process","comparison"][e%4]}function Cc(e,t){let r=mc();return(r.arc[e%r.arc.length]||"proof").replace(/[-_]/g," ").toUpperCase()}function Ei(e,t){let r=mc(),n=r.proofObjects[e%r.proofObjects.length]||"visual proof";return{"market map":U("proofMarketMap"),"operating model":U("proofOperatingModel"),"risk bridge":U("proofRiskBridge"),"decision table":U("proofDecisionTable"),"before/after workflow":U("proofBeforeAfter"),"value bridge":U("proofValueBridge"),"customer proof":U("proofCustomerProof"),"implementation plan":U("proofImplementationPlan"),"metric bridge":U("proofMetricBridge"),"trend chart":U("proofTrendChart"),"variance table":U("proofVarianceTable"),"risk register":U("proofRiskRegister"),"concept map":U("proofConceptMap"),"worked example":U("proofWorkedExample"),comparison:U("proofComparison"),"practice prompt":U("proofPracticePrompt"),"market wedge":U("proofMarketWedge"),"product diagram":U("proofProductDiagram"),"traction chart":U("proofTractionChart"),"milestone plan":U("proofMilestonePlan"),"visual proof":U("proofVisualProof")}[n]||n}function As(e,t,r){let n=r?.brief?.topic||r?.title||e;if(t===0)return U("claimCover",{topic:n});if(e&&/[.!?。!?]$/.test(e.trim()))return e;let a=[U("claimPressure",{title:e}),U("claimDecision",{title:e}),U("claimProof",{title:e}),U("claimAction",{title:e})];return a[t%a.length]}function kc(e,t,r){let n=Ei(t,r);return U("supportWithAssumption",{proof:n})}function Pc(e){return U("sourceDraftAssumption")}function Fc(e,t,r,n){let a=e.title,i=yc(n?.style?.density),o=yh(a,t,n).slice(0,i.bulletLimit).map(c=>String(c).slice(0,90)),l=vh(e,t,r);return l==="cover"?[Tt("shape",{x:6,y:9,w:88,h:76,style:{background:"soft",opacity:1,borderRadius:28}}),Tt("shape",{x:9,y:15,w:1.2,h:55,style:{background:"primary",opacity:1,borderRadius:99}}),Tt("text",{text:e.kicker,x:13,y:15,w:22,h:5,style:{fontSize:10,fontWeight:760,color:"primary"}}),Tt("text",{text:a,x:13,y:23,w:58,h:25,style:{fontSize:a.length>48?34:44,fontWeight:840}}),Tt("text",{text:e.claim,x:14,y:55,w:45,h:11,style:{fontSize:18,fontWeight:520,color:"muted"}}),Tt("metric",{text:String(r),label:U("slidesUnit"),x:75,y:54,w:14,h:17,style:{fontSize:34}})]:l==="closing"?[Tt("text",{text:a,x:9,y:15,w:65,h:15,style:{fontSize:a.length>48?30:38,fontWeight:820}}),Tt("text",{text:e.claim,x:10,y:33,w:46,h:9,style:{fontSize:17,fontWeight:540,color:"muted"}}),...ki([U("closeConfirm"),U("closeOwner"),U("closeIteration")],10,50,52,22,3),Tt("text",{text:o[0]||e.supportNote,x:67,y:48,w:22,h:20,style:{fontSize:18,fontWeight:720,color:"primary",background:"soft",borderRadius:20}})]:l==="process"?[Tt("text",{text:a,x:8,y:10,w:68,h:12,style:{fontSize:32,fontWeight:820}}),Tt("text",{text:e.claim,x:9,y:25,w:54,h:7,style:{fontSize:15,fontWeight:520,color:"muted"}}),Tt("shape",{x:10,y:50,w:78,h:1.2,style:{background:"primary",opacity:.25,borderRadius:99}}),...ki(o.map((c,s)=>`0${s+1} ${c}`),10,37,78,28,Math.min(i.cardColumns,Math.max(2,o.length)),i.cardGap)]:l==="comparison"?[Tt("text",{text:a,x:7,y:10,w:72,h:12,style:{fontSize:32,fontWeight:820}}),Tt("text",{text:e.claim,x:8,y:25,w:48,h:7,style:{fontSize:15,fontWeight:520,color:"muted"}}),...ki(o,8,37,82,30,2,i.cardGap)]:l==="data"?[Tt("text",{text:a,x:8,y:10,w:66,h:12,style:{fontSize:32,fontWeight:820}}),Tt("text",{text:e.claim,x:9,y:25,w:47,h:7,style:{fontSize:15,fontWeight:520,color:"muted"}}),Tt("metric",{text:String(t).padStart(2,"0"),label:e.proofObject,x:10,y:40,w:34,h:28,style:{fontSize:44}}),Tt("text",{text:o[0]||e.supportNote,x:69,y:41,w:20,h:24,style:{fontSize:17,fontWeight:700,color:"primary",background:"soft",borderRadius:18}})]:l==="cards"?[Tt("text",{text:a,x:8,y:10,w:68,h:12,style:{fontSize:32,fontWeight:820}}),Tt("text",{text:e.claim,x:9,y:25,w:51,h:8,style:{fontSize:15,fontWeight:520,color:"muted"}}),...ki(o,9,38,78,28,i.cardColumns,i.cardGap)]:[Tt("text",{text:a,x:10,y:15,w:62,h:15,style:{fontSize:a.length>48?30:38,fontWeight:820}}),Tt("text",{text:e.claim,x:11,y:34,w:42,h:10,style:{fontSize:17,fontWeight:520,color:"muted"}}),Tt("text",{text:o[0]||e.supportNote,x:58,y:38,w:28,h:24,style:{fontSize:22,fontWeight:760,color:"primary",background:"soft",borderRadius:22}}),Tt("shape",{x:10,y:72,w:18,h:.6,style:{background:"primary",opacity:1,borderRadius:99}})]}function vh(e,t,r){let n=[e.layout,e.kicker,e.proofObject,e.claim,e.title].join(" ").toLowerCase();return t===0||e.layout==="cover"?"cover":t===r-1||e.layout==="closing"?"closing":/process|workflow|timeline|roadmap|journey|steps|architecture|flow|流程|步骤|路线|架构/.test(n)?"process":/compare|comparison|versus|matrix|before|after|risk|对比|比较|矩阵|风险/.test(n)?"comparison":/data|metric|trend|scorecard|chart|number|数据|指标|趋势/.test(n)?"data":t%3===1?"cards":"spotlight"}function ki(e,t,r,n,a,i,o=2.5){let l=e.filter(Boolean),c=Math.max(1,Math.min(i||1,l.length||1)),s=Number.isFinite(o)?o:2.5,d=Math.max(1,Math.ceil((l.length||1)/c)),u=(n-s*(c-1))/c,h=(a-s*(d-1))/d;return l.map((f,p)=>Tt("text",{text:f,x:t+p%c*(u+s),y:r+Math.floor(p/c)*(h+s),w:u,h,style:{fontSize:17,fontWeight:p===0?760:620,color:p===0?"primary":"ink",background:p===0?"soft":"panel",borderRadius:18}}))}function Tt(e,t){let r=Ti(e);return{...r,...t,style:{...r.style,...t.style||{}}}}function yh(e,t,r){let n=r?.brief?.topic||e,a=Ei(t,r),i=[`${U("pointClaimPrefix")} ${As(e,t,r)}`,`${U("pointProofPrefix")} ${a}`,`${U("pointAudiencePrefix")} ${n}`,U("pointEvidenceRule"),U("pointDesignRule"),U("pointCloseRule")],o=yc(r?.style?.density).bulletLimit,l=[];for(let c=0;c{t!==e&&Ri(t)})}function gs(e){let t=e.querySelector(".ppt-flat-select__menu"),r=e.querySelector(".ppt-flat-select__trigger");if(!t||!r)return;let n=r.getBoundingClientRect(),a=Math.min(220,t.scrollHeight||220),i=window.innerHeight-n.bottom,o=ii;t.style.left=`${Math.max(8,n.left)}px`,t.style.width=`${n.width}px`,o?(t.style.top="auto",t.style.bottom=`${window.innerHeight-n.top+4}px`):(t.style.top=`${n.bottom+4}px`,t.style.bottom="auto")}function Tc(e){let t=e.querySelector(".ppt-flat-select__menu"),r=e.querySelector(".ppt-flat-select__trigger");if(!t||!r)return;Bi(null),t.hidden=!1,gs(e),r.setAttribute("aria-expanded","true"),e.classList.add("is-open"),ea.add(e),t.querySelector(".ppt-flat-select__option.is-selected")?.scrollIntoView({block:"nearest"})}function bh(e,t){let r=e.querySelector(".ppt-flat-select__menu");if(!r||r.hidden)return;let n=[...r.querySelectorAll(".ppt-flat-select__option")];if(!n.length)return;let a=n.indexOf(document.activeElement),i=a>=0?a:n.findIndex(l=>l.classList.contains("is-selected")),o=Math.min(n.length-1,Math.max(0,(i<0?-t:i)+t));n[o]?.focus(),n[o]?.scrollIntoView({block:"nearest"})}function ms(e){let t=e.closest(".ppt-flat-select");if(!t)return;let r=t.querySelector(".ppt-flat-select__label"),n=t.querySelector(".ppt-flat-select__menu"),a=e.options[e.selectedIndex];if(r&&(r.textContent=a?.textContent?.trim()||""),!n)return;let i=new Map([...n.querySelectorAll(".ppt-flat-select__option")].map(o=>[o.dataset.value,o]));[...e.options].forEach(o=>{let l=i.get(o.value);l||(l=document.createElement("button"),l.type="button",l.className="ppt-flat-select__option",l.setAttribute("role","option"),l.dataset.value=o.value,l.addEventListener("click",()=>{e.value=o.value,ms(e),Ri(t),e.dispatchEvent(new Event("change",{bubbles:!0}))}),n.append(l)),l.textContent=o.textContent,o.title&&(l.title=o.title);let c=o.value===e.value;l.classList.toggle("is-selected",c),l.setAttribute("aria-selected",c?"true":"false")}),[...n.querySelectorAll(".ppt-flat-select__option")].forEach(o=>{[...e.options].some(l=>l.value===o.dataset.value)||o.remove()}),t.classList.contains("is-open")&&gs(t)}function wh(e){if(!(e instanceof Node))return!1;for(let t of ea){let r=t.querySelector(".ppt-flat-select__menu");if(r&&(r===e||r.contains(e)))return!0}return!1}function xh(e){wh(e.target)||Bi(null)}function Sh(e){let t=e.target;if(t instanceof Node){for(let r of ea)if(r.contains(t))return}Bi(null)}function Dc(e){if(!e||e.dataset.flatSelect==="true")return;e.dataset.flatSelect="true",e.classList.remove("ppt-flat-select"),e.classList.add("ppt-flat-select__native"),e.tabIndex=-1,e.setAttribute("aria-hidden","true");let t=document.createElement("div");t.className="ppt-flat-select";let r=document.createElement("button");r.type="button",r.className="ppt-flat-select__trigger",r.setAttribute("aria-haspopup","listbox"),r.setAttribute("aria-expanded","false");let n=document.createElement("span");n.className="ppt-flat-select__label",r.append(n);let a=document.createElement("div");a.className="ppt-flat-select__menu",a.hidden=!0,a.setAttribute("role","listbox"),a.addEventListener("wheel",o=>o.stopPropagation(),{passive:!0}),a.addEventListener("mousedown",o=>o.stopPropagation()),r.addEventListener("click",o=>{if(o.stopPropagation(),t.classList.contains("is-open")){Ri(t);return}Tc(t)}),t.addEventListener("keydown",o=>{o.key==="ArrowDown"||o.key==="ArrowUp"?(o.preventDefault(),t.classList.contains("is-open")||Tc(t),bh(t,o.key==="ArrowDown"?1:-1)):o.key==="Escape"&&t.classList.contains("is-open")&&(o.stopPropagation(),Ri(t),r.focus())}),e.parentNode.insertBefore(t,e),t.append(r,a,e),ms(e)}function Ra(e){ms(e)}window.__pptLiveFlatSelectBound||(window.__pptLiveFlatSelectBound=!0,document.addEventListener("click",Sh),document.addEventListener("keydown",e=>{e.key==="Escape"&&Bi(null)}),window.addEventListener("resize",()=>{ea.forEach(e=>gs(e))}),document.addEventListener("scroll",xh,!0));function zc(){document.documentElement.lang=Dr(),document.querySelectorAll("[data-i18n]").forEach(e=>{e.textContent=U(e.dataset.i18n)}),document.querySelectorAll("[data-i18n-placeholder]").forEach(e=>{e.placeholder=U(e.dataset.i18nPlaceholder)}),document.querySelectorAll("[data-i18n-aria]").forEach(e=>{e.setAttribute("aria-label",U(e.dataset.i18nAria))})}function Oc(e,t){Wh(e),Er(e),Rr(e),qh(e,t),Wn(e,t),dn(e,t),Oi(e,t),Un(),document.querySelector(".ppt-live")?.setAttribute("data-density",e.style.density),document.querySelectorAll(".segment").forEach(a=>{a.classList.toggle("is-active",a.dataset.mode===e.mode)});let r=$t(e),n=Bt("slidePosition");n&&(n.textContent=`${r+1} / ${e.slides?.length||1}`)}var Ec="",Ba=0,Uc=120,Ch=20;function kh(e){return{x:(parseFloat(e.paddingLeft)||0)+(parseFloat(e.paddingRight)||0),y:(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}}function Wc(e,t={}){if(!e)return{width:0,height:0};let r=getComputedStyle(e),n=kh(r),a=Math.max(0,(e.clientWidth||0)-n.x),i=Math.max(0,(e.clientHeight||0)-n.y),o=e.getBoundingClientRect();o.width>0&&(a=Math.max(a,o.width-n.x)),o.height>0&&(i=Math.max(i,o.height-n.y));let l=t.minHeight??Uc,c=t.fallback;if(c&&i0&&(a=Math.max(a,s.width-n.x)),s.height>0&&(i=Math.max(i,s.height-n.y))}return{width:Math.max(0,a),height:Math.max(0,i)}}function Ph(e){if(!e)return 0;let t=e.getBoundingClientRect();return Math.max(e.clientWidth||0,e.offsetWidth||0,t.width||0)}function Un(){Ba&&cancelAnimationFrame(Ba);let e=(t=0)=>{Ba=0,ta(),ks(),zi(),Hc();let r=Bt("slideCanvas")?.closest(".canvas-area");if(!r||t>=Ch)return;let{height:n}=Wc(r,{fallback:r.closest(".stage-shell")});ne(t+1)))};Ba=requestAnimationFrame(()=>e(0))}function ta(){let e=Bt("slideCanvas"),t=e?.closest(".canvas-area"),r=e?.closest(".canvas-stage");if(!e||!t||!r)return;let{width:n,height:a}=Wc(t,{fallback:t.closest(".stage-shell")}),i=Math.max(160,n),o=Math.max(90,a),l=i,c=l*9/16;c>o&&(c=o,l=c*16/9);let s=Math.floor(l),d=Math.floor(c),u=`${i}x${o}`;if(u===Ec&&r.style.width===`${s}px`&&r.style.height===`${d}px`){let p=e.querySelector(`.${mr}`);p&&vr(p);return}Ec=u,r.style.width=`${s}px`,r.style.height=`${d}px`,e.style.width="100%",e.style.height="100%";let h=Bt("presentSlide");h&&(h.style.width=`${s}px`,h.style.height=`${d}px`);let f=e.querySelector(`.${mr}`);f&&vr(f)}function Fh(e){let t=Bt("floatingToolbar"),r=Bt("slideCanvas");if(!t||!r||!e){t&&t.classList.remove("is-visible");return}let n=r.getBoundingClientRect(),a=e.x/100*n.width,i=e.y/100*n.height,o=e.w/100*n.width;t.style.left=`${n.left+a+o/2-t.offsetWidth/2}px`,t.style.top=`${n.top+i-t.offsetHeight-8}px`,t.classList.add("is-visible")}function vs(e,t){let r=String(e||"").trim(),n=parseFloat(r);return Number.isFinite(n)?r.endsWith("pt")?n*(96/72):(r.endsWith("px"),n):t}function ws(e,t,r){return String(e||"").replace(/(^|[^-.\w]):root(?![\w-])/gi,`$1${t}`).replace(/(^|[^-.\w])html(?![\w-])/gi,`$1${t}`).replace(/(^|[^-.\w])body(?![\w-])/gi,`$1${r}`)}var mr="html-slide-preview-host",Gc="html-slide-preview-scaler",xs={width:1280,height:720};function Th(e){let t=String(e||""),r=t.match(/(?:^|[{;\s])width\s*:\s*([\d.]+)\s*pt/i),n=t.match(/(?:^|[{;\s])height\s*:\s*([\d.]+)\s*pt/i);if(r?.[1]&&n?.[1])return{width:Math.round(parseFloat(r[1])*(96/72)),height:Math.round(parseFloat(n[1])*(96/72))};let a=t.match(/(?:^|[{;\s])width\s*:\s*([\d.]+)\s*px/i),i=t.match(/(?:^|[{;\s])height\s*:\s*([\d.]+)\s*px/i);return a?.[1]&&i?.[1]?{width:Math.round(parseFloat(a[1])),height:Math.round(parseFloat(i[1]))}:{...xs}}function Dh(e){let t=Number(e?.dataset?.designW),r=Number(e?.dataset?.designH);return Number.isFinite(t)&&t>=320&&Number.isFinite(r)&&r>=180?{width:t,height:r}:null}function Eh(e){let t=e?.body,r=e?.documentElement,n=e?.defaultView;if(!t||!r||!n)return{...xs};let a=n.getComputedStyle(t),i=vs(a.width,0),o=vs(a.height,0)||vs(a.minHeight,0);if(i>=320&&o>=180)return{width:i,height:o};let l=Math.max(t.scrollWidth||0,t.offsetWidth||0,r.clientWidth||0,1280),c=Math.max(t.scrollHeight||0,t.offsetHeight||0,r.clientHeight||0,720);return l=Math.min(Math.max(l,320),3840),c=Math.min(Math.max(c,180),3840),{width:l,height:c}}function Rh(e,t){let r=Dh(t);return r||(e?.body?Eh(e):{...xs})}function Ss(e){if(!e)return{width:0,height:0};let t=e.getBoundingClientRect();return{width:Math.max(e.clientWidth||0,e.offsetWidth||0,t.width||0),height:Math.max(e.clientHeight||0,e.offsetHeight||0,t.height||0)}}function qc(e,t){let r=Th(t);return e.dataset.designW=String(r.width),e.dataset.designH=String(r.height),r}var Rc="data-ppt-live-editing-style",ra="data-ppt-live-editable";function Bh(e,t){!e||e._pptLiveOriginalInline||!t?.documentElement||!t.body||(e._pptLiveOriginalInline={root:t.documentElement.getAttribute("style"),body:t.body.getAttribute("style")})}function Lh(e,t,r){if(!e?.documentElement||!e.body)return;let n=e.documentElement,a=e.body;n.style.margin="0",n.style.padding="0",n.style.width=`${t}px`,n.style.height=`${r}px`,n.style.overflow="hidden",a.style.margin="0",a.style.boxSizing="border-box",a.style.width=`${t}px`,a.style.height=`${r}px`,a.style.minHeight="",a.style.maxWidth="",a.style.overflow="hidden",a.style.transform="none"}function vr(e){let t=e?.classList?.contains(mr)?e:e?.closest?.(`.${mr}`);if(!t)return!1;let r=t.querySelector(`.${Gc}`),n=r?.querySelector("iframe, [data-slide-stage]");if(!r||!n)return!1;let{width:a,height:i}=Ss(t);if(!a||!i)return!1;let o=n.tagName==="IFRAME",l=null;if(o)try{l=n.contentDocument}catch{l=null}let{width:c,height:s}=Rh(l,n),d=Math.min(a/c,i/s),u=c*d,h=s*d;return l&&(Bh(n,l),Lh(l,c,s)),r.style.width=`${u}px`,r.style.height=`${h}px`,r.style.overflow="hidden",r.style.position="relative",r.style.flexShrink="0",n.style.display="block",n.style.width=`${c}px`,n.style.height=`${s}px`,n.style.border="0",n.style.margin="0",n.style.padding="0",n.style.maxWidth="none",n.style.maxHeight="none",n.style.transformOrigin="top left",n.style.transform=`scale(${d})`,!0}var Bc="ppt-slide-shadow-root",bs="ppt-slide-shadow-body";function Nh(e){return e.querySelectorAll('script, iframe, object, embed, meta[http-equiv="refresh" i]').forEach(t=>t.remove()),e.querySelectorAll("*").forEach(t=>{for(let r of[...t.attributes]){let n=r.name.toLowerCase();(n.startsWith("on")||(n==="href"||n==="src"||n==="xlink:href")&&/^\s*javascript:/i.test(r.value))&&t.removeAttribute(r.name)}}),e}function Ih(e,t){let r=document.createElement("div");r.className=t,r.dataset.slideStage="true",qc(r,e);let n=Number(r.dataset.designW),a=Number(r.dataset.designH),i=Nh(new DOMParser().parseFromString(Or(e),"text/html")),o=r.attachShadow({mode:"open"}),l=document.createElement("div");l.className=Bc,l.style.cssText=["all:initial","display:block","position:relative",`width:${n}px`,`height:${a}px`,"margin:0","padding:0","overflow:hidden",'font-family:system-ui, -apple-system, "PingFang SC", "Source Han Sans SC", sans-serif',"font-size:16px","line-height:normal","color:#000","background:#fff"].join(";"),i.querySelectorAll("style").forEach(s=>{let d=document.createElement("style");d.textContent=ws(s.textContent||"",`.${Bc}`,`.${bs}`),o.appendChild(d)});let c=document.createElement("div");if(c.className=bs,i.body){for(let s of i.body.attributes)s.name==="class"?c.classList.add(...s.value.split(/\s+/).filter(Boolean)):s.name==="style"?c.style.cssText+=`;${s.value}`:s.name.toLowerCase().startsWith("on")||c.setAttribute(s.name,s.value);c.innerHTML=i.body.innerHTML}return c.style.boxSizing="border-box",/\bwidth\s*:/i.test(c.style.cssText)||(c.style.width=`${n}px`),/\bheight\s*:/i.test(c.style.cssText)||(c.style.height=`${a}px`),c.style.overflow="hidden",c.style.margin="0",l.appendChild(c),o.appendChild(l),r._pptLiveSourceHtml=String(e||""),r}function Cs({hostClass:e="",frameClass:t,html:r,onReady:n,interactive:a=!1}){let i=document.createElement("div");i.className=[mr,e].filter(Boolean).join(" ");let o=document.createElement("div");if(o.className=Gc,a){let s=Ih(r,t);return o.appendChild(s),i.appendChild(o),requestAnimationFrame(()=>{vr(i),n?.(s,i)}),{host:i,scaler:o,frame:s}}let l=document.createElement("iframe");l.className=t,l.setAttribute("sandbox","allow-same-origin"),l.setAttribute("loading","lazy"),qc(l,r),l.srcdoc=Or(r);let c=()=>{vr(i),n?.(l,i)};return l.addEventListener("load",c,{once:!0}),o.appendChild(l),i.appendChild(o),{host:i,scaler:o,frame:l}}function jc(e){let{host:t}=Cs({hostClass:"export-preview__html-stage",frameClass:"export-preview__html-frame",html:e,onReady:()=>{t.closest(".export-preview__viewport")&&vr(t)}});return t}function Vc(e){if(!e)return;let t=e.querySelector(".export-preview__viewport")||e,r=t.querySelector(".export-preview__scale");if(!r)return;let n=r.querySelector(`.${mr}`);if(n){r.style.width="100%",r.style.height="100%",vr(n);return}let a=r.querySelector(".export-preview__element-stage");if(!a)return;let{width:i,height:o}=Ss(t);if(!i||!o)return;let l=960,c=540,s=Math.min(i/l,o/c);a.style.width=`${l}px`,a.style.height=`${c}px`,a.style.transform=`scale(${s})`,a.style.transformOrigin="top left",r.style.width=`${Math.floor(l*s)}px`,r.style.height=`${Math.floor(c*s)}px`}function Mh(e){if(!e||new Set(["turn","round","round-done","tokens","text","thinking"]).has(e.kind||""))return"";let r=String(e.detail||"").trim();return!r||/^[0-9a-f-]{8,}/i.test(r)?"":r}function zh(e){if(!e)return;(typeof requestAnimationFrame=="function"?requestAnimationFrame:r=>setTimeout(r,0))(()=>{e.scrollTop=e.scrollHeight})}function Er(e){let t=Bt("generationSteps"),r=e.generation?.steps||[],n=Array.isArray(e.generation?.events)?e.generation.events:[],a=!!(e.generation?.active||r.some(o=>o.status==="running")),i=r.some(o=>o.status==="error");if(document.querySelector(".ppt-live")?.classList.toggle("is-generating",a),document.querySelector(".ppt-live")?.classList.toggle("has-generation-error",i),!!t){if(t.innerHTML="",n.length)n.forEach((o,l)=>{let c=Mh(o),s=document.createElement("li");s.className=`generation-event is-${o.kind||"info"}`,s.innerHTML=` ${Number(o.seq)||l+1} - ${Be(o.title||O("processEventUnknown"))} - ${c?`${Be(c)}`:""} + ${Le(o.title||U("processEventUnknown"))} + ${c?`${Le(c)}`:""} `,t.append(s)});else{let o=document.createElement("li");o.className="generation-event is-empty",o.innerHTML=` -- - ${Be(O("processWaitingForEventsTitle"))} - ${Be(O("processWaitingForEvents"))} + ${Le(U("processWaitingForEventsTitle"))} + ${Le(U("processWaitingForEvents"))} - `,t.append(o)}Yh(t)}}function Br(e){let t=e.generation?.steps||[],r=!!(e.generation?.active||t.some(i=>i.status==="running")),n=Nt("statusSpinner");n&&(n.hidden=!r,n.setAttribute("aria-hidden",r?"false":"true"))}function Jh(e="sans"){let t=e==="serif"?"serif":"sans";document.querySelectorAll("[data-font-family]").forEach(r=>{let n=r.dataset.fontFamily===t;r.classList.toggle("is-active",n),r.setAttribute("aria-pressed",n?"true":"false")})}function $h(e="light"){let t=e==="dark"?"dark":"light";document.querySelectorAll("[data-color-mode]").forEach(r=>{let n=r.dataset.colorMode===t;r.classList.toggle("is-active",n),r.setAttribute("aria-pressed",n?"true":"false")})}function Oi(e="standard"){let t=zn(e),r=Ea(t),n=document.getElementById("densitySlider");if(n){n.style.setProperty("--density-index",String(r)),n.dataset.index=String(r),n.setAttribute("aria-valuenow",String(r));let i=`density${t.charAt(0).toUpperCase()}${t.slice(1)}`;n.setAttribute("aria-valuetext",O(i)),n.querySelectorAll("[data-density-index]").forEach(a=>{let o=Number(a.dataset.densityIndex)===r;a.classList.toggle("is-active",o)})}document.querySelector(".ppt-live")?.setAttribute("data-density",t)}function ep(e){let t=typeof e.promptDraft=="string"?e.promptDraft:"",r=Array.isArray(e.slides)&&e.slides.length>0;pp("topicInput",r?t:t||e.brief.topic),Jh(e.style.fontFamily),$h(e.style.colorMode),Oi(e.style.density);let n=document.getElementById("stylePresetSelect");n&&(n.value=e.style?.stylePreset||un,Ni(n)),Ts("deckTitle",e.title||O("defaultDeckTitle")),Ts("deckMeta",O("slidesMeta",{count:e.slides.length})),Ts("currentSlideIndex",String(er(e)+1))}function id(e,t={}){t.includeTopic!==!1&&(e.brief.topic=Ap("topicInput"),e.promptDraft=e.brief.topic,tp(e))}function tp(e){let t=String(e.brief.topic||""),r=t.match(/(\d{1,2})\s*(?:页|页面|张|slides?|pages?)/i)||t.match(/(?:页数|slides?|pages?)\D{0,8}(\d{1,2})/i);r?e.brief.slideTarget=Math.max(3,Math.min(24,Number(r[1]))):e.brief.slideTarget=0}function rp(e,t){let r=Nt("outlineList");r&&(r.innerHTML="",e.outline.forEach((n,i)=>{let a=document.createElement("li"),o=e.slides[i];a.className=`outline-row${o?.id===e.activeSlideId?" is-active":""}`,a.innerHTML=` - ${i+1} + `,t.append(o)}zh(t)}}function Rr(e){let t=e.generation?.steps||[],r=!!(e.generation?.active||t.some(a=>a.status==="running")),n=Bt("statusSpinner");n&&(n.hidden=!r,n.setAttribute("aria-hidden",r?"false":"true"))}function Oh(e="sans"){let t=e==="serif"?"serif":"sans";document.querySelectorAll("[data-font-family]").forEach(r=>{let n=r.dataset.fontFamily===t;r.classList.toggle("is-active",n),r.setAttribute("aria-pressed",n?"true":"false")})}function Uh(e="light"){let t=e==="dark"?"dark":"light";document.querySelectorAll("[data-color-mode]").forEach(r=>{let n=r.dataset.colorMode===t;r.classList.toggle("is-active",n),r.setAttribute("aria-pressed",n?"true":"false")})}function Ia(e="standard"){let t=In(e),r=Pi(t),n=document.getElementById("densitySlider");if(n){n.style.setProperty("--density-index",String(r)),n.dataset.index=String(r),n.setAttribute("aria-valuenow",String(r));let a=`density${t.charAt(0).toUpperCase()}${t.slice(1)}`;n.setAttribute("aria-valuetext",U(a)),n.querySelectorAll("[data-density-index]").forEach(i=>{let o=Number(i.dataset.densityIndex)===r;i.classList.toggle("is-active",o)})}document.querySelector(".ppt-live")?.setAttribute("data-density",t)}function Wh(e){let t=typeof e.promptDraft=="string"?e.promptDraft:"",r=Array.isArray(e.slides)&&e.slides.length>0;ep("topicInput",r?t:t||e.brief.topic),Oh(e.style.fontFamily),Uh(e.style.colorMode),Ia(e.style.density);let n=document.getElementById("stylePresetSelect");n&&(n.value=e.style?.stylePreset||ln,Ra(n)),ys("deckTitle",e.title||U("defaultDeckTitle")),ys("deckMeta",U("slidesMeta",{count:e.slides.length})),ys("currentSlideIndex",String($t(e)+1))}function Xc(e,t={}){t.includeTopic!==!1&&(e.brief.topic=tp("topicInput"),e.promptDraft=e.brief.topic,Gh(e))}function Gh(e){let t=String(e.brief.topic||""),r=t.match(/(\d{1,2})\s*(?:页|页面|张|slides?|pages?)/i)||t.match(/(?:页数|slides?|pages?)\D{0,8}(\d{1,2})/i);r?e.brief.slideTarget=Math.max(3,Math.min(24,Number(r[1]))):e.brief.slideTarget=0}function qh(e,t){let r=Bt("outlineList");r&&(r.innerHTML="",e.outline.forEach((n,a)=>{let i=document.createElement("li"),o=e.slides[a];i.className=`outline-row${o?.id===e.activeSlideId?" is-active":""}`,i.innerHTML=` + ${a+1} - `,a.querySelector(".outline-card").addEventListener("click",()=>{o?.id&&t.selectSlide(o.id)}),r.append(a)}))}function qn(e,t){let r=Nt("slideThumbs");if(r){if(r.innerHTML="",!e.slides.length){let n=document.createElement("div");n.className="thumbs-empty",n.textContent=O("slidesEmptyHint"),r.append(n);return}e.slides.forEach((n,i)=>{let a=n.html?Ba(n.html):null,o=n.theme||{},l=a||o.background||"var(--studio-slide-chrome)",c=document.createElement("button");c.className=`thumb${n.id===e.activeSlideId?" is-active":""}`,c.type="button",c.style.setProperty("--thumb-bg",l),c.style.setProperty("--thumb-primary",o.primary||"var(--studio-accent)");let s=document.createElement("div");if(s.className="thumb-preview",s.style.background=l,n.html)s.appendChild(np(n.html));else{let p=document.createElement("div");p.className="thumb-preview-slide",p.innerHTML=pn(n),s.appendChild(p)}c.appendChild(s);let d=document.createElement("div");d.className="thumb-copy",d.innerHTML=` - ${Be(n.kicker||"")} - ${Be(n.title)} - `,c.appendChild(d);let u=document.createElement("span");u.className="thumb-number",u.textContent=String(i+1),c.appendChild(u),c.addEventListener("click",()=>t.selectSlide(n.id)),r.append(c)}),requestAnimationFrame(()=>{Ns(),Ga()})}}var Ua=960,Wa=540;function np(e){let{host:t}=Bs({hostClass:"thumb-preview-html",frameClass:"thumb-preview-frame",html:e,onReady:()=>wr(t)});return t}function ip(e,t){let r=e?.closest?.(`.${br}`)||t?.querySelector?.(`.${br}`);if(r){wr(r);return}if(!e||!t)return;let{width:n,height:i}=Ls(t);if(!n||!i)return;let a=Math.min(n/Ua,i/Wa);e.style.width=`${Ua}px`,e.style.height=`${Wa}px`,e.style.transform=`scale(${a})`,e.style.transformOrigin="top left"}function ap(e){let t=e.querySelector(".thumb-preview-frame");if(t){ip(t,e);return}let r=e.querySelector(".thumb-preview-html, .thumb-preview-slide");if(!r)return;let n=Wh(e);if(!n)return;let i=n/Ua,a=Wa*i;r.style.width=`${Ua}px`,r.style.height=`${Wa}px`,r.style.transform=`scale(${i})`,r.style.transformOrigin="top left",e.style.height=`${a}px`}function Ns(){let e=Nt("slideThumbs");e&&(e.querySelectorAll(`.${br}`).forEach(t=>{wr(t)}),e.querySelectorAll(".thumb-preview").forEach(t=>{t.querySelector(`.${br}`)||ap(t)}))}var Mi=null,zi=null;function ad(){if(typeof ResizeObserver>"u")return;zi||(zi=new ResizeObserver(()=>{document.querySelectorAll(`.${br}`).forEach(t=>{wr(t)})})),zi.disconnect(),document.querySelectorAll(`.${br}`).forEach(t=>{zi.observe(t)});let e=Nt("slideCanvas");e&&zi.observe(e)}function Ga(){let e=Nt("slideThumbs");!e||typeof ResizeObserver>"u"||(Mi||(Mi=new ResizeObserver(()=>Ns())),Mi.disconnect(),Mi.observe(e),e.querySelectorAll(".thumb-preview").forEach(t=>{Mi.observe(t)}),ad())}function op(e){if(!String(e.brief?.topic||"").trim()){let n=String(e.title||"").trim();if(n===O("blankDeckTitle")||n===O("defaultDeckTitle")||n===O("newSlideTitle"))return!0}if(!e.slides?.length)return!0;let t=String(e.title||"").trim();return e.slides.length===1&&e.outline.length===1&&e.outline[0]===O("newSlideTitle")&&(t===O("blankDeckTitle")||t===O("newSlideTitle"))}function za(e,t){if(!e)return;if(!t){e.style.background="";return}let r=t.theme||{},i=(t.html?Ba(t.html):null)||r.background||"";e.style.background=i||""}function hn(e,t){let r=Nt("slideCanvas");if(!r)return;let n=_t(e),i=!!(e.generation?.active||e.generation?.steps?.some(o=>o.status==="running"));if(!n){r.classList.remove("is-html-slide"),r.classList.add("is-empty"),r.innerHTML=i?`
${Be(O("generationAgentWorking"))}

${Be(O("agentWorkingDetail"))}

`:`

${Be(O("welcomeTitle"))}

${Be(O("welcomeSubcopy"))}

`,Kc(r),za(r,null),si();return}if(op(e)&&!n.html&&!i){r.classList.remove("is-html-slide"),r.classList.add("is-empty"),r.innerHTML=` + `,i.querySelector(".outline-card").addEventListener("click",()=>{o?.id&&t.selectSlide(o.id)}),r.append(i)}))}function Wn(e,t){let r=Bt("slideThumbs");if(r){if(r.innerHTML="",!e.slides.length){let n=document.createElement("div");n.className="thumbs-empty",n.textContent=U("slidesEmptyHint"),r.append(n);return}e.slides.forEach((n,a)=>{let i=n.html?Di(n.html):null,o=n.theme||{},l=i||o.background||"var(--studio-slide-chrome)",c=document.createElement("button");c.className=`thumb${n.id===e.activeSlideId?" is-active":""}`,c.type="button",c.style.setProperty("--thumb-bg",l),c.style.setProperty("--thumb-primary",o.primary||"var(--studio-accent)");let s=document.createElement("div");if(s.className="thumb-preview",s.style.background=l,n.html)s.appendChild(jh(n.html));else{let h=document.createElement("div");h.className="thumb-preview-slide",h.innerHTML=un(n),s.appendChild(h)}c.appendChild(s);let d=document.createElement("div");d.className="thumb-copy",d.innerHTML=` + ${Le(n.kicker||"")} + ${Le(n.title)} + `,c.appendChild(d);let u=document.createElement("span");u.className="thumb-number",u.textContent=String(a+1),c.appendChild(u),c.addEventListener("click",()=>t.selectSlide(n.id)),r.append(c)}),requestAnimationFrame(()=>{ks(),zi()})}}var Ii=960,Mi=540;function jh(e){let{host:t}=Cs({hostClass:"thumb-preview-html",frameClass:"thumb-preview-frame",html:e,onReady:()=>vr(t)});return t}function Vh(e,t){let r=e?.closest?.(`.${mr}`)||t?.querySelector?.(`.${mr}`);if(r){vr(r);return}if(!e||!t)return;let{width:n,height:a}=Ss(t);if(!n||!a)return;let i=Math.min(n/Ii,a/Mi);e.style.width=`${Ii}px`,e.style.height=`${Mi}px`,e.style.transform=`scale(${i})`,e.style.transformOrigin="top left"}function Xh(e){let t=e.querySelector(".thumb-preview-frame");if(t){Vh(t,e);return}let r=e.querySelector(".thumb-preview-html, .thumb-preview-slide");if(!r)return;let n=Ph(e);if(!n)return;let a=n/Ii,i=Mi*a;r.style.width=`${Ii}px`,r.style.height=`${Mi}px`,r.style.transform=`scale(${a})`,r.style.transformOrigin="top left",e.style.height=`${i}px`}function ks(){let e=Bt("slideThumbs");e&&(e.querySelectorAll(`.${mr}`).forEach(t=>{vr(t)}),e.querySelectorAll(".thumb-preview").forEach(t=>{t.querySelector(`.${mr}`)||Xh(t)}))}var La=null,Na=null;function Hc(){if(typeof ResizeObserver>"u")return;Na||(Na=new ResizeObserver(()=>{document.querySelectorAll(`.${mr}`).forEach(t=>{vr(t)})})),Na.disconnect(),document.querySelectorAll(`.${mr}`).forEach(t=>{Na.observe(t)});let e=Bt("slideCanvas");e&&Na.observe(e)}function zi(){let e=Bt("slideThumbs");!e||typeof ResizeObserver>"u"||(La||(La=new ResizeObserver(()=>ks())),La.disconnect(),La.observe(e),e.querySelectorAll(".thumb-preview").forEach(t=>{La.observe(t)}),Hc())}function Hh(e){if(!String(e.brief?.topic||"").trim()){let n=String(e.title||"").trim();if(n===U("blankDeckTitle")||n===U("defaultDeckTitle")||n===U("newSlideTitle"))return!0}if(!e.slides?.length)return!0;let t=String(e.title||"").trim();return e.slides.length===1&&e.outline.length===1&&e.outline[0]===U("newSlideTitle")&&(t===U("blankDeckTitle")||t===U("newSlideTitle"))}function Li(e,t){if(!e)return;if(!t){e.style.background="";return}let r=t.theme||{},a=(t.html?Di(t.html):null)||r.background||"";e.style.background=a||""}function dn(e,t){let r=Bt("slideCanvas");if(!r)return;let n=_t(e),a=!!(e.generation?.active||e.generation?.steps?.some(o=>o.status==="running"));if(!n){r.classList.remove("is-html-slide"),r.classList.add("is-empty"),r.innerHTML=a?`
${Le(U("generationAgentWorking"))}

${Le(U("agentWorkingDetail"))}

`:`

${Le(U("welcomeTitle"))}

${Le(U("welcomeSubcopy"))}

`,Ic(r),Li(r,null),ta();return}if(Hh(e)&&!n.html&&!a){r.classList.remove("is-html-slide"),r.classList.add("is-empty"),r.innerHTML=`
-

${Be(O("welcomeTitle"))}

-

${Be(O("welcomeSubcopy"))}

+

${Le(U("welcomeTitle"))}

+

${Le(U("welcomeSubcopy"))}

- - - + + +
- `,Kc(r),za(r,null),si();return}if(r.classList.remove("is-empty"),n?.html){r.innerHTML="",r.classList.add("is-html-slide");let{host:o,frame:l}=Bs({frameClass:"html-slide-frame",html:n.html,interactive:!0,onReady:c=>{cp(c,n.id,t),si(),wr(o),requestAnimationFrame(()=>wr(o))}});r.append(o),za(r,n),r.classList.remove("is-entering"),r.offsetWidth,r.classList.add("is-entering"),si();return}r.classList.remove("is-html-slide"),r.innerHTML=n?pn(n,{selectedElementId:e.selectedElementId,editable:!0}):"",r.querySelectorAll(".slide-element").forEach(o=>{let l=o.dataset.elementId;o.addEventListener("click",c=>{c.stopPropagation(),t.selectElement(l)}),o.addEventListener("pointerdown",c=>{c.target?.isContentEditable&&!c.target.classList.contains("resize-handle")||t.beginDrag(c,l)})}),r.querySelectorAll("[data-edit-text]").forEach(o=>{o.addEventListener("blur",()=>{t.updateElementTextDirect(o.dataset.editText,o.textContent||"")}),o.addEventListener("keydown",l=>{(l.metaKey||l.ctrlKey)&&l.key==="Enter"&&o.blur()})}),r.querySelectorAll("[data-edit-list]").forEach(o=>{o.addEventListener("blur",()=>{t.updateElementListItemDirect(o.dataset.editList,Number(o.dataset.itemIndex),o.textContent||"")}),o.addEventListener("keydown",l=>{(l.metaKey||l.ctrlKey)&&l.key==="Enter"&&o.blur()})}),r.classList.remove("is-entering"),r.offsetWidth,r.classList.add("is-entering");let a=Wn(e);if(a)Gh(a);else{let o=Nt("floatingToolbar");o&&o.classList.remove("is-visible")}za(r,n),si()}function qa(e,t){let r=Nt("elementInspector"),n=Wn(e),i=_t(e);if(!(!r||!i)){if(r.hidden){r.innerHTML="";return}if(!n){r.innerHTML=`${Hc(i)}

${O("noSelection")}

`,_c(r,t),r.querySelector("#slideNotesInput")?.addEventListener("input",a=>t.updateSlideNotes(a.target.value));return}r.innerHTML=` - ${Hc(i)} - - - `,Nc(r,t),r.querySelector("#slideNotesInput")?.addEventListener("input",i=>t.updateSlideNotes(i.target.value));return}r.innerHTML=` + ${Lc(a)} + + + -
- - - - + + + +
- - + +
- - `,["elementTextInput","elementItemsInput","elementDataInput","elementXInput","elementYInput","elementWInput","elementHInput","elementFontInput","elementWeightInput","elementColorInput","elementBgInput","slideNotesInput"].forEach(a=>r.querySelector(`#${a}`)?.addEventListener("input",()=>t.updateElementFromInspector())),_c(r,t)}}function Hc(e){return` + + `,["elementTextInput","elementItemsInput","elementDataInput","elementXInput","elementYInput","elementWInput","elementHInput","elementFontInput","elementWeightInput","elementColorInput","elementBgInput","slideNotesInput"].forEach(i=>r.querySelector(`#${i}`)?.addEventListener("input",()=>t.updateElementFromInspector())),Nc(r,t)}}function Lc(e){return`
- - - - - + + + + +
- ${sp(e)} - `}function sp(e){let t=Array.isArray(e.quality?.issues)?e.quality.issues:[];return t.length?` + ${_h(e)} + `}function _h(e){let t=Array.isArray(e.quality?.issues)?e.quality.issues:[];return t.length?`
- ${Be(O("qualityReportTitle"))}: ${Math.round(Number(e.quality?.score??100))}/100 -
    ${t.map(r=>`
  • ${Be(r.message)}
  • `).join("")}
+ ${Le(U("qualityReportTitle"))}: ${Math.round(Number(e.quality?.score??100))}/100 +
    ${t.map(r=>`
  • ${Le(r.message)}
  • `).join("")}
- `:""}function _c(e,t){["slideKickerInput","slideClaimInput","slideProofInput","slideSupportInput","slideSourceInput"].forEach(r=>{e.querySelector(`#${r}`)?.addEventListener("input",()=>t.updateSlideMethodology())})}function pn(e,t={}){if(e?.html)return``;let r=!!t.editable,n=t.selectedElementId||"",i=[`--slide-bg:${e.theme.background}`,`--slide-ink:${e.theme.ink}`,`--slide-muted:${e.theme.muted}`,`--slide-primary:${e.theme.primary}`,`--slide-accent:${e.theme.accent}`,`--slide-panel:${e.theme.panel||"#ffffff"}`].join(";");return`
- ${e.kicker?`
${Be(e.kicker)}
`:""} - ${e.proofObject?`
${Be(e.proofObject)}
`:""} - ${lp(e)} - ${(e.elements||[]).map(a=>up(a,e.theme,r,n)).join("")} - ${e.sourceNote?`
${Be(e.sourceNote)}
`:""} -
`}function lp(e){let t=Array.isArray(e.quality?.issues)?e.quality.issues:[];if(!t.length)return"";let r=t.filter(i=>i.severity==="high").length,n=r?O("qualityNeedsReview"):O("qualityHasWarnings");return`
${Be(n)}
`}function Kc(e){e.querySelectorAll("[data-welcome-prompt]").forEach(t=>{t.addEventListener("click",()=>{let r=Nt("topicInput");r&&(r.value=t.dataset.welcomePrompt||t.textContent||"",r.focus())})})}function cp(e,t,r){if(!r?.updateSlideHtmlDirect)return;let n=e?.shadowRoot,i=n?.querySelector(`.${Ds}`);if(!n||!i)return;if(!n.querySelector(`style[${Vc}]`)){let c=document.createElement("style");c.setAttribute(Vc,"true"),c.textContent=[`[${li}] { cursor: text; -webkit-user-select: text !important; user-select: text !important; }`,`[${li}]:hover { outline: 1.5px dashed rgba(37, 99, 235, 0.55); outline-offset: 1px; }`,`[${li}]:focus { outline: 2px solid rgba(37, 99, 235, 0.85); outline-offset: 1px; }`].join(` -`),n.appendChild(c)}n.addEventListener("click",c=>{c.target?.closest?.("a[href]")&&c.preventDefault()},!0);let a=()=>{let c=dp(e,i);c&&r.updateSlideHtmlDirect(t,c)},o=i.querySelectorAll("h1,h2,h3,h4,h5,h6,p,li,span,strong,em,b,i,u,small,code,a,label,blockquote,td,th,dt,dd,figcaption,div"),l=0;o.forEach(c=>{Array.from(c.childNodes).some(d=>d.nodeType===Node.TEXT_NODE&&String(d.textContent||"").trim())&&(l+=1,c.setAttribute("contenteditable","true"),c.setAttribute("spellcheck","false"),c.setAttribute(li,"true"),c.addEventListener("blur",a),c.addEventListener("keydown",d=>{((d.metaKey||d.ctrlKey)&&d.key==="Enter"||d.key==="Escape")&&(d.preventDefault(),c.blur())}))}),l||console.warn("[ppt-live] no editable nodes bound for slide",{slideId:t,candidates:o.length})}function dp(e,t){let r=String(e?._pptLiveSourceHtml||"");if(!r)return"";let n=new DOMParser().parseFromString(Ur(r),"text/html");if(!n.body)return"";let i=t.cloneNode(!0);i.querySelectorAll(`[${li}]`).forEach(o=>{o.removeAttribute("contenteditable"),o.removeAttribute("spellcheck"),o.removeAttribute(li)}),n.body.innerHTML=i.innerHTML;let a=` -${n.documentElement.outerHTML}`;return e._pptLiveSourceHtml=a,a}function Ur(e){let t=String(e||"").trim();return t?/]/i.test(t)?t:`${t}`:''}function up(e,t,r,n){let i=r&&n===e.id,a=[`left:${e.x}%`,`top:${e.y}%`,`width:${e.w}%`,`height:${e.h}%`,`font-size:${hp(e.style.fontSize)}`,`font-weight:${e.style.fontWeight}`,`color:${Qc(e.style.color,t)}`,`text-align:${e.style.align||"left"}`,`background:${Qc(e.style.background,t)}`,`opacity:${e.style.opacity}`,`border-radius:${e.style.borderRadius}px`].join(";"),o="";if(e.type==="list")o=`
    ${(e.items||[]).map((l,c)=>r?`
  • ${Be(l)}
  • `:`
  • ${Be(l)}
  • `).join("")}
`;else if(e.type==="metric")o=`${Be(e.text)}${Be(e.label)}`;else if(e.type==="chart"){let l=Math.max(1,...(e.data||[]).map(c=>Number(c.value)||0));o=`${Be(e.text)}
${(e.data||[]).map(c=>`${Be(c.label)}`).join("")}
`}else e.type==="media"?o=`${Be(e.text||O("mediaPlaceholder"))}`:o=r?`${Be(e.text||"")}`:Be(e.text||"");return`
${o}${i?'':""}
`}function Qc(e,t){return!e||e==="transparent"?"transparent":e==="ink"?t.ink:e==="muted"?t.muted:e==="primary"?t.primary:e==="accent"?t.accent:e==="panel"?t.panel||"#ffffff":e==="soft"?fp(t.primary,.1):e==="background"?t.background:e}function fp(e,t){let r=String(e||"#0f766e").replace("#",""),n=parseInt(r.length===3?r.split("").map(l=>l+l).join(""):r,16),i=n>>16&255,a=n>>8&255,o=n&255;return`rgba(${i}, ${a}, ${o}, ${t})`}function hp(e){let t=Math.max(8,Number(e)||24);return`clamp(8px, ${Math.round(t/10.2*1e3)/1e3}cqw, ${t}px)`}function Nt(e){return document.getElementById(e)}function pp(e,t){let r=Nt(e);r&&document.activeElement!==r&&(r.value=t??"")}function Ap(e){return Nt(e)?.value||""}function Ts(e,t){let r=Nt(e);r&&(r.textContent=String(t??""))}function Oa(e){return Math.round(Number(e)*10)/10}function od(e=document,t=!1){let r=e,n=r.defaultView||window,i=new Set(["SCRIPT","STYLE","PRE","CODE","SVG","TEXTAREA"]),a="strong,b,em,i,u,span,a,small,mark,sub,sup,code",o="p,h1,h2,h3,h4,h5,h6,li";function l(L){let D=String(L.className||"").toLowerCase(),T=String(L.getAttribute?.("role")||"").toLowerCase();return/h1|title|headline|hero/.test(D)||T==="heading"?"h1":/h2|subtitle|subhead|section-title/.test(D)?"h2":/h3|kicker|eyebrow|label|caption/.test(D)?"h3":"p"}function c(L){return!L||L==="transparent"||L==="rgba(0, 0, 0, 0)"}function s(){let L=r.body;if(!L)return;let D=n.getComputedStyle(L),T=parseFloat(D.width),G=parseFloat(D.height);L.style.width=T>0?`${T}px`:"1280px",L.style.height=G>0?`${G}px`:"720px",L.style.margin="0",L.style.padding=D.padding||"0",L.style.overflow="hidden",L.style.position=D.position==="static"?"relative":D.position,c(D.backgroundColor)||(L.style.backgroundColor=D.backgroundColor),D.color&&(L.style.color=D.color),r.documentElement.style.margin="0",r.documentElement.style.padding="0";let V=n.getComputedStyle(r.documentElement).backgroundColor;!c(V)&&c(D.backgroundColor)&&(L.style.backgroundColor=V)}function d(L){L.querySelectorAll("div").forEach(D=>{i.has(D.tagName)||[...D.childNodes].forEach(T=>{if(T.nodeType!==Node.TEXT_NODE)return;let G=T.textContent.replace(/\s+/g," ").trim();if(!G){T.remove();return}let V=r.createElement(l(D));V.textContent=G,D.replaceChild(V,T)})})}function u(L){L.querySelectorAll("span").forEach(D=>{let T=n.getComputedStyle(D),G=T.backgroundColor&&T.backgroundColor!=="rgba(0, 0, 0, 0)",V=f(T);if(!G&&!V)return;let C=r.createElement("p");D.className&&(C.className=D.className),D.getAttribute("style")&&C.setAttribute("style",D.getAttribute("style")),C.textContent=D.textContent,D.replaceWith(C)})}function p(L){L.querySelectorAll("div").forEach(D=>{let T=[...D.children].length>0&&[...D.children].every(C=>C.tagName==="SPAN"||C.tagName==="BR"),G=D.textContent.replace(/\s+/g," ").trim();if(!T||!G||D.querySelector("ul,ol,p,h1,h2,h3,h4,h5,h6"))return;let V=G.split(/\s*[•·▪-]\s+/).map(C=>C.trim()).filter(Boolean);if(V.length>=2){let C=r.createElement("ul");V.forEach(q=>{let y=r.createElement("li");y.textContent=q,C.appendChild(y)}),D.replaceChildren(C)}})}function f(L){return["Top","Right","Bottom","Left"].some(D=>parseFloat(L[`border${D}Width`]||0)>0)}function h(L){L.querySelectorAll(o).forEach(D=>{let T=n.getComputedStyle(D),G=T.backgroundColor&&T.backgroundColor!=="rgba(0, 0, 0, 0)",V=T.backgroundImage&&T.backgroundImage!=="none",C=f(T),q=T.boxShadow&&T.boxShadow!=="none";if(!G&&!V&&!C&&!q)return;let y=r.createElement("div");(G||V)&&(y.style.background=T.background,y.style.backgroundColor=T.backgroundColor),V&&!String(T.backgroundImage||"").includes("gradient")&&(y.style.backgroundImage="none"),C&&(y.style.border=T.border),T.borderRadius&&(y.style.borderRadius=T.borderRadius),q&&(y.style.boxShadow=T.boxShadow),T.padding&&(y.style.padding=T.padding),D.style.background="transparent",D.style.backgroundColor="transparent",D.style.backgroundImage="none",D.style.border="none",D.style.boxShadow="none",D.style.padding="0",D.parentNode.insertBefore(y,D),y.appendChild(D)})}function A(L){L.querySelectorAll("*").forEach(D=>{let T=n.getComputedStyle(D),G=T.backgroundImage||"";if(!G.includes("gradient"))return;let V=G.match(/#[0-9a-f]{3,8}|rgba?\([^)]+\)/i);D.style.backgroundImage="none",V?D.style.backgroundColor=V[0]:T.backgroundColor&&T.backgroundColor!=="rgba(0, 0, 0, 0)"&&(D.style.backgroundColor=T.backgroundColor)})}function v(L){L.querySelectorAll("div").forEach(D=>{let T=n.getComputedStyle(D),G=T.backgroundImage;!G||G==="none"||(D.style.backgroundImage="none",T.backgroundColor&&T.backgroundColor!=="rgba(0, 0, 0, 0)"&&(D.style.backgroundColor=T.backgroundColor))})}function g(L){L.querySelectorAll(a).forEach(D=>{D.style.setProperty("margin","0","important"),D.style.setProperty("padding","0","important"),D.style.setProperty("border","none","important"),D.style.setProperty("box-shadow","none","important"),D.style.setProperty("background","transparent","important"),D.style.setProperty("background-color","transparent","important"),D.style.setProperty("background-image","none","important"),n.getComputedStyle(D).display==="block"&&D.style.setProperty("display","inline","important")})}function b(L){L.querySelectorAll(a).forEach(D=>{D.removeAttribute("class"),D.removeAttribute("style")})}function x(L){L.querySelectorAll('link[rel="stylesheet"], style').forEach(D=>{D.id!=="ppt-live-export-safe-styles"&&D.remove()})}function S(L){L.querySelectorAll(a).forEach(D=>{let T=n.getComputedStyle(D),G=["marginTop","marginRight","marginBottom","marginLeft"].some(_=>parseFloat(T[_])>0),V=["paddingTop","paddingRight","paddingBottom","paddingLeft"].some(_=>parseFloat(T[_])>0),C=f(T),q=T.backgroundColor&&T.backgroundColor!=="rgba(0, 0, 0, 0)",y=T.backgroundImage&&T.backgroundImage!=="none";if(!G&&!V&&!C&&!q&&!y)return;let M=D.tagName.toLowerCase(),ne=r.createElement(M);ne.textContent=D.textContent,D.replaceWith(ne)})}function F(L){let D=L.body||L.querySelector(".ppt-export-body");(D?[D,...D.querySelectorAll("*")]:[...L.querySelectorAll("body, body *")]).forEach(G=>{if(i.has(G.tagName))return;let V=n.getComputedStyle(G),C=G.style;V.position&&V.position!=="static"&&(C.position=V.position),V.display&&V.display!=="inline"&&(C.display=V.display),["left","top","right","bottom","width","height","maxWidth","maxHeight"].forEach(y=>{let M=V[y];M&&M!=="auto"&&M!=="none"&&M!=="0px"&&(C[y]=M)}),V.zIndex&&V.zIndex!=="auto"&&(C.zIndex=V.zIndex),V.color&&(C.color=V.color),V.fontSize&&(C.fontSize=V.fontSize),V.fontWeight&&(C.fontWeight=V.fontWeight),V.fontFamily&&(C.fontFamily=V.fontFamily),V.lineHeight&&V.lineHeight!=="normal"&&(C.lineHeight=V.lineHeight),V.textAlign&&(C.textAlign=V.textAlign);let q=V.backgroundColor;q&&q!=="rgba(0, 0, 0, 0)"&&(C.backgroundColor=q),V.border&&V.border!=="none"&&f(V)&&(C.border=V.border),V.borderRadius&&V.borderRadius!=="0px"&&(C.borderRadius=V.borderRadius),V.padding&&V.padding!=="0px"&&(C.padding=V.padding),V.gap&&V.gap!=="normal"&&(C.gap=V.gap),V.flexDirection&&V.flexDirection!=="row"&&(C.flexDirection=V.flexDirection),V.alignItems&&V.alignItems!=="normal"&&(C.alignItems=V.alignItems),V.justifyContent&&V.justifyContent!=="normal"&&(C.justifyContent=V.justifyContent)})}function N(L){let D="ppt-live-export-safe-styles";L.getElementById(D)?.remove();let T=r.createElement("style");T.id=D,T.textContent=` - ${a}, [class] ${a.split(",").join(", [class] ")} { + `:""}function Nc(e,t){["slideKickerInput","slideClaimInput","slideProofInput","slideSupportInput","slideSourceInput"].forEach(r=>{e.querySelector(`#${r}`)?.addEventListener("input",()=>t.updateSlideMethodology())})}function un(e,t={}){if(e?.html)return``;let r=!!t.editable,n=t.selectedElementId||"",a=[`--slide-bg:${e.theme.background}`,`--slide-ink:${e.theme.ink}`,`--slide-muted:${e.theme.muted}`,`--slide-primary:${e.theme.primary}`,`--slide-accent:${e.theme.accent}`,`--slide-panel:${e.theme.panel||"#ffffff"}`].join(";");return`
+ ${e.kicker?`
${Le(e.kicker)}
`:""} + ${e.proofObject?`
${Le(e.proofObject)}
`:""} + ${Kh(e)} + ${(e.elements||[]).map(i=>Yh(i,e.theme,r,n)).join("")} + ${e.sourceNote?`
${Le(e.sourceNote)}
`:""} +
`}function Kh(e){let t=Array.isArray(e.quality?.issues)?e.quality.issues:[];if(!t.length)return"";let r=t.filter(a=>a.severity==="high").length,n=r?U("qualityNeedsReview"):U("qualityHasWarnings");return`
${Le(n)}
`}function Ic(e){e.querySelectorAll("[data-welcome-prompt]").forEach(t=>{t.addEventListener("click",()=>{let r=Bt("topicInput");r&&(r.value=t.dataset.welcomePrompt||t.textContent||"",r.focus())})})}function Qh(e,t,r){if(!r?.updateSlideHtmlDirect)return;let n=e?.shadowRoot,a=n?.querySelector(`.${bs}`);if(!n||!a)return;if(!n.querySelector(`style[${Rc}]`)){let c=document.createElement("style");c.setAttribute(Rc,"true"),c.textContent=[`[${ra}] { cursor: text; -webkit-user-select: text !important; user-select: text !important; }`,`[${ra}]:hover { outline: 1.5px dashed rgba(37, 99, 235, 0.55); outline-offset: 1px; }`,`[${ra}]:focus { outline: 2px solid rgba(37, 99, 235, 0.85); outline-offset: 1px; }`].join(` +`),n.appendChild(c)}n.addEventListener("click",c=>{c.target?.closest?.("a[href]")&&c.preventDefault()},!0);let i=()=>{let c=Zh(e,a);c&&r.updateSlideHtmlDirect(t,c)},o=a.querySelectorAll("h1,h2,h3,h4,h5,h6,p,li,span,strong,em,b,i,u,small,code,a,label,blockquote,td,th,dt,dd,figcaption,div"),l=0;o.forEach(c=>{Array.from(c.childNodes).some(d=>d.nodeType===Node.TEXT_NODE&&String(d.textContent||"").trim())&&(l+=1,c.setAttribute("contenteditable","true"),c.setAttribute("spellcheck","false"),c.setAttribute(ra,"true"),c.addEventListener("blur",i),c.addEventListener("keydown",d=>{((d.metaKey||d.ctrlKey)&&d.key==="Enter"||d.key==="Escape")&&(d.preventDefault(),c.blur())}))}),l||console.warn("[ppt-live] no editable nodes bound for slide",{slideId:t,candidates:o.length})}function Zh(e,t){let r=String(e?._pptLiveSourceHtml||"");if(!r)return"";let n=new DOMParser().parseFromString(Or(r),"text/html");if(!n.body)return"";let a=t.cloneNode(!0);a.querySelectorAll(`[${ra}]`).forEach(o=>{o.removeAttribute("contenteditable"),o.removeAttribute("spellcheck"),o.removeAttribute(ra)}),n.body.innerHTML=a.innerHTML;let i=` +${n.documentElement.outerHTML}`;return e._pptLiveSourceHtml=i,i}function Or(e){let t=String(e||"").trim();return t?/]/i.test(t)?t:`${t}`:''}function Yh(e,t,r,n){let a=r&&n===e.id,i=[`left:${e.x}%`,`top:${e.y}%`,`width:${e.w}%`,`height:${e.h}%`,`font-size:${$h(e.style.fontSize)}`,`font-weight:${e.style.fontWeight}`,`color:${Mc(e.style.color,t)}`,`text-align:${e.style.align||"left"}`,`background:${Mc(e.style.background,t)}`,`opacity:${e.style.opacity}`,`border-radius:${e.style.borderRadius}px`].join(";"),o="";if(e.type==="list")o=`
    ${(e.items||[]).map((l,c)=>r?`
  • ${Le(l)}
  • `:`
  • ${Le(l)}
  • `).join("")}
`;else if(e.type==="metric")o=`${Le(e.text)}${Le(e.label)}`;else if(e.type==="chart"){let l=Math.max(1,...(e.data||[]).map(c=>Number(c.value)||0));o=`${Le(e.text)}
${(e.data||[]).map(c=>`${Le(c.label)}`).join("")}
`}else e.type==="media"?o=`${Le(e.text||U("mediaPlaceholder"))}`:o=r?`${Le(e.text||"")}`:Le(e.text||"");return`
${o}${a?'':""}
`}function Mc(e,t){return!e||e==="transparent"?"transparent":e==="ink"?t.ink:e==="muted"?t.muted:e==="primary"?t.primary:e==="accent"?t.accent:e==="panel"?t.panel||"#ffffff":e==="soft"?Jh(t.primary,.1):e==="background"?t.background:e}function Jh(e,t){let r=String(e||"#0f766e").replace("#",""),n=parseInt(r.length===3?r.split("").map(l=>l+l).join(""):r,16),a=n>>16&255,i=n>>8&255,o=n&255;return`rgba(${a}, ${i}, ${o}, ${t})`}function $h(e){let t=Math.max(8,Number(e)||24);return`clamp(8px, ${Math.round(t/10.2*1e3)/1e3}cqw, ${t}px)`}function Bt(e){return document.getElementById(e)}function ep(e,t){let r=Bt(e);r&&document.activeElement!==r&&(r.value=t??"")}function tp(e){return Bt(e)?.value||""}function ys(e,t){let r=Bt(e);r&&(r.textContent=String(t??""))}function Ni(e){return Math.round(Number(e)*10)/10}function _c(e=document,t=!1){let r=e,n=r.defaultView||window,a=new Set(["SCRIPT","STYLE","PRE","CODE","SVG","TEXTAREA"]),i="strong,b,em,i,u,span,a,small,mark,sub,sup,code",o="p,h1,h2,h3,h4,h5,h6,li";function l(B){let D=String(B.className||"").toLowerCase(),T=String(B.getAttribute?.("role")||"").toLowerCase();return/h1|title|headline|hero/.test(D)||T==="heading"?"h1":/h2|subtitle|subhead|section-title/.test(D)?"h2":/h3|kicker|eyebrow|label|caption/.test(D)?"h3":"p"}function c(B){return!B||B==="transparent"||B==="rgba(0, 0, 0, 0)"}function s(){let B=r.body;if(!B)return;let D=n.getComputedStyle(B),T=parseFloat(D.width),G=parseFloat(D.height);B.style.width=T>0?`${T}px`:"1280px",B.style.height=G>0?`${G}px`:"720px",B.style.margin="0",B.style.padding=D.padding||"0",B.style.overflow="hidden",B.style.position=D.position==="static"?"relative":D.position,c(D.backgroundColor)||(B.style.backgroundColor=D.backgroundColor),D.color&&(B.style.color=D.color),r.documentElement.style.margin="0",r.documentElement.style.padding="0";let V=n.getComputedStyle(r.documentElement).backgroundColor;!c(V)&&c(D.backgroundColor)&&(B.style.backgroundColor=V)}function d(B){B.querySelectorAll("div").forEach(D=>{a.has(D.tagName)||[...D.childNodes].forEach(T=>{if(T.nodeType!==Node.TEXT_NODE)return;let G=T.textContent.replace(/\s+/g," ").trim();if(!G){T.remove();return}let V=r.createElement(l(D));V.textContent=G,D.replaceChild(V,T)})})}function u(B){B.querySelectorAll("span").forEach(D=>{let T=n.getComputedStyle(D),G=T.backgroundColor&&T.backgroundColor!=="rgba(0, 0, 0, 0)",V=f(T);if(!G&&!V)return;let C=r.createElement("p");D.className&&(C.className=D.className),D.getAttribute("style")&&C.setAttribute("style",D.getAttribute("style")),C.textContent=D.textContent,D.replaceWith(C)})}function h(B){B.querySelectorAll("div").forEach(D=>{let T=[...D.children].length>0&&[...D.children].every(C=>C.tagName==="SPAN"||C.tagName==="BR"),G=D.textContent.replace(/\s+/g," ").trim();if(!T||!G||D.querySelector("ul,ol,p,h1,h2,h3,h4,h5,h6"))return;let V=G.split(/\s*[•·▪-]\s+/).map(C=>C.trim()).filter(Boolean);if(V.length>=2){let C=r.createElement("ul");V.forEach(q=>{let v=r.createElement("li");v.textContent=q,C.appendChild(v)}),D.replaceChildren(C)}})}function f(B){return["Top","Right","Bottom","Left"].some(D=>parseFloat(B[`border${D}Width`]||0)>0)}function p(B){B.querySelectorAll(o).forEach(D=>{let T=n.getComputedStyle(D),G=T.backgroundColor&&T.backgroundColor!=="rgba(0, 0, 0, 0)",V=T.backgroundImage&&T.backgroundImage!=="none",C=f(T),q=T.boxShadow&&T.boxShadow!=="none";if(!G&&!V&&!C&&!q)return;let v=r.createElement("div");(G||V)&&(v.style.background=T.background,v.style.backgroundColor=T.backgroundColor),V&&!String(T.backgroundImage||"").includes("gradient")&&(v.style.backgroundImage="none"),C&&(v.style.border=T.border),T.borderRadius&&(v.style.borderRadius=T.borderRadius),q&&(v.style.boxShadow=T.boxShadow),T.padding&&(v.style.padding=T.padding),D.style.background="transparent",D.style.backgroundColor="transparent",D.style.backgroundImage="none",D.style.border="none",D.style.boxShadow="none",D.style.padding="0",D.parentNode.insertBefore(v,D),v.appendChild(D)})}function A(B){B.querySelectorAll("*").forEach(D=>{let T=n.getComputedStyle(D),G=T.backgroundImage||"";if(!G.includes("gradient"))return;let V=G.match(/#[0-9a-f]{3,8}|rgba?\([^)]+\)/i);D.style.backgroundImage="none",V?D.style.backgroundColor=V[0]:T.backgroundColor&&T.backgroundColor!=="rgba(0, 0, 0, 0)"&&(D.style.backgroundColor=T.backgroundColor)})}function y(B){B.querySelectorAll("div").forEach(D=>{let T=n.getComputedStyle(D),G=T.backgroundImage;!G||G==="none"||(D.style.backgroundImage="none",T.backgroundColor&&T.backgroundColor!=="rgba(0, 0, 0, 0)"&&(D.style.backgroundColor=T.backgroundColor))})}function g(B){B.querySelectorAll(i).forEach(D=>{D.style.setProperty("margin","0","important"),D.style.setProperty("padding","0","important"),D.style.setProperty("border","none","important"),D.style.setProperty("box-shadow","none","important"),D.style.setProperty("background","transparent","important"),D.style.setProperty("background-color","transparent","important"),D.style.setProperty("background-image","none","important"),n.getComputedStyle(D).display==="block"&&D.style.setProperty("display","inline","important")})}function b(B){B.querySelectorAll(i).forEach(D=>{D.removeAttribute("class"),D.removeAttribute("style")})}function x(B){B.querySelectorAll('link[rel="stylesheet"], style').forEach(D=>{D.id!=="ppt-live-export-safe-styles"&&D.remove()})}function S(B){B.querySelectorAll(i).forEach(D=>{let T=n.getComputedStyle(D),G=["marginTop","marginRight","marginBottom","marginLeft"].some(_=>parseFloat(T[_])>0),V=["paddingTop","paddingRight","paddingBottom","paddingLeft"].some(_=>parseFloat(T[_])>0),C=f(T),q=T.backgroundColor&&T.backgroundColor!=="rgba(0, 0, 0, 0)",v=T.backgroundImage&&T.backgroundImage!=="none";if(!G&&!V&&!C&&!q&&!v)return;let M=D.tagName.toLowerCase(),ne=r.createElement(M);ne.textContent=D.textContent,D.replaceWith(ne)})}function F(B){let D=B.body||B.querySelector(".ppt-export-body");(D?[D,...D.querySelectorAll("*")]:[...B.querySelectorAll("body, body *")]).forEach(G=>{if(a.has(G.tagName))return;let V=n.getComputedStyle(G),C=G.style;V.position&&V.position!=="static"&&(C.position=V.position),V.display&&V.display!=="inline"&&(C.display=V.display),["left","top","right","bottom","width","height","maxWidth","maxHeight"].forEach(v=>{let M=V[v];M&&M!=="auto"&&M!=="none"&&M!=="0px"&&(C[v]=M)}),V.zIndex&&V.zIndex!=="auto"&&(C.zIndex=V.zIndex),V.color&&(C.color=V.color),V.fontSize&&(C.fontSize=V.fontSize),V.fontWeight&&(C.fontWeight=V.fontWeight),V.fontFamily&&(C.fontFamily=V.fontFamily),V.lineHeight&&V.lineHeight!=="normal"&&(C.lineHeight=V.lineHeight),V.textAlign&&(C.textAlign=V.textAlign);let q=V.backgroundColor;q&&q!=="rgba(0, 0, 0, 0)"&&(C.backgroundColor=q),V.border&&V.border!=="none"&&f(V)&&(C.border=V.border),V.borderRadius&&V.borderRadius!=="0px"&&(C.borderRadius=V.borderRadius),V.padding&&V.padding!=="0px"&&(C.padding=V.padding),V.gap&&V.gap!=="normal"&&(C.gap=V.gap),V.flexDirection&&V.flexDirection!=="row"&&(C.flexDirection=V.flexDirection),V.alignItems&&V.alignItems!=="normal"&&(C.alignItems=V.alignItems),V.justifyContent&&V.justifyContent!=="normal"&&(C.justifyContent=V.justifyContent)})}function I(B){let D="ppt-live-export-safe-styles";B.getElementById(D)?.remove();let T=r.createElement("style");T.id=D,T.textContent=` + ${i}, [class] ${i.split(",").join(", [class] ")} { margin: 0 !important; padding: 0 !important; border: none !important; @@ -86,23 +86,23 @@ ${n.documentElement.outerHTML}`;return e._pptLiveSourceHtml=a,a}function Ur(e){l p, h1, h2, h3, h4, h5, h6, li { box-shadow: none !important; } - `,(L.head||L.documentElement).appendChild(T)}s(),d(r),u(r),p(r),A(r),v(r),t?(h(r),g(r),S(r),N(r),S(r),F(r),r.querySelectorAll("[class]").forEach(L=>L.removeAttribute("class")),x(r),b(r),g(r),S(r),N(r)):F(r)}function Is(e=document){let t=e.defaultView||window,r=e.body,n=t.getComputedStyle(r),i={width:parseFloat(n.width),height:parseFloat(n.height),scrollWidth:r.scrollWidth,scrollHeight:r.scrollHeight},a=[],o=Math.max(0,i.scrollWidth-i.width-1),l=Math.max(0,i.scrollHeight-i.height-1),c=o*.75,s=l*.75;if(c>0||s>0){let d=[];c>0&&d.push(`${c.toFixed(1)}pt horizontally`),s>0&&d.push(`${s.toFixed(1)}pt vertically`);let u=s>0?' (Remember: leave 0.5" margin at bottom of slide)':"";a.push(`HTML content overflows body by ${d.join(" and ")}${u}`)}return{...i,errors:a}}function Ms(e=document){let t=e,r=t.defaultView||window,n=.75,i=96,a=["impact"],o=j=>{if(!j)return!1;let $=j.toLowerCase().replace(/['"]/g,"").split(",")[0].trim();return a.includes($)},l=j=>j/i,c=j=>parseFloat(j)*n,s=j=>{if(j==="rgba(0, 0, 0, 0)"||j==="transparent")return"FFFFFF";let $=j.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return $?$.slice(1).map(Y=>parseInt(Y).toString(16).padStart(2,"0")).join(""):"FFFFFF"},d=j=>{let $=j.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(!$||!$[4])return null;let Y=parseFloat($[4]);return Math.round((1-Y)*100)},u=j=>{let $=String(j||"").match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);return $?{r:parseInt($[1],10),g:parseInt($[2],10),b:parseInt($[3],10),a:$[4]!=null?parseFloat($[4]):1}:null},p=j=>{let $=String(j||"0E0E12").replace("#","");return{r:parseInt($.slice(0,2),16),g:parseInt($.slice(2,4),16),b:parseInt($.slice(4,6),16)}},f=(j,$="0E0E12")=>{let Y=u(j);if(!Y)return{fill:s(j),transparency:d(j)};if(Y.a>=.98)return{fill:s(j),transparency:null};let Se=p($),ye=Math.round(Se.r*(1-Y.a)+Y.r*Y.a),oe=Math.round(Se.g*(1-Y.a)+Y.g*Y.a),ve=Math.round(Se.b*(1-Y.a)+Y.b*Y.a);return{fill:[ye,oe,ve].map(Me=>Me.toString(16).padStart(2,"0")).join("").toUpperCase(),transparency:null}},h=(j,$)=>$==="uppercase"?j.toUpperCase():$==="lowercase"?j.toLowerCase():$==="capitalize"?j.replace(/\b\w/g,Y=>Y.toUpperCase()):j,A=(j,$)=>{let Y=0;if($==="vertical-rl"?Y=90:$==="vertical-lr"&&(Y=270),j&&j!=="none"){let Se=j.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/);if(Se)Y+=parseFloat(Se[1]);else{let ye=j.match(/matrix\(([^)]+)\)/);if(ye){let oe=ye[1].split(",").map(parseFloat),ve=Math.atan2(oe[1],oe[0])*(180/Math.PI);Y+=Math.round(ve)}}}return Y=Y%360,Y<0&&(Y+=360),Y===0?null:Y},v=(j,$,Y)=>{if(Y===null)return{x:$.left,y:$.top,w:$.width,h:$.height};if(Y===90||Y===270){let ve=$.left+$.width/2,Me=$.top+$.height/2;return{x:ve-$.height/2,y:Me-$.width/2,w:$.height,h:$.width}}let ye=$.left+$.width/2,oe=$.top+$.height/2;return{x:ye-j.offsetWidth/2,y:oe-j.offsetHeight/2,w:j.offsetWidth,h:j.offsetHeight}},g=j=>{if(!j||j==="none"||j.match(/inset/))return null;let Y=j.match(/rgba?\([^)]+\)/),Se=j.match(/([-\d.]+)(px|pt)/g);if(!Se||Se.length<2)return null;let ye=parseFloat(Se[0]),oe=parseFloat(Se[1]),ve=Se.length>2?parseFloat(Se[2]):0,Me=0;(ye!==0||oe!==0)&&(Me=Math.atan2(oe,ye)*(180/Math.PI),Me<0&&(Me+=360));let be=Math.sqrt(ye*ye+oe*oe)*n,Ie=.5;if(Y){let Ee=Y[0].match(/[\d.]+\)$/);Ee&&(Ie=parseFloat(Ee[0].replace(")","")))}return{type:"outer",angle:Math.round(Me),blur:ve*.75,color:Y?s(Y[0]):"000000",offset:be,opacity:Ie}},b=(j,$={},Y=[],Se=ye=>ye)=>{let ye=!1;return j.childNodes.forEach(oe=>{let ve=Se,Me=oe.nodeType===Node.TEXT_NODE||oe.tagName==="BR";if(Me){let be=oe.tagName==="BR"?` -`:ve(oe.textContent.replace(/\s+/g," ")),Ie=Y[Y.length-1];ye&&Ie?Ie.text+=be:Y.push({text:be,options:{...$}})}else if(oe.nodeType===Node.ELEMENT_NODE&&oe.textContent.trim()){let be={...$},Ie=r.getComputedStyle(oe);if(oe.tagName==="SPAN"||oe.tagName==="B"||oe.tagName==="STRONG"||oe.tagName==="I"||oe.tagName==="EM"||oe.tagName==="U"){if((Ie.fontWeight==="bold"||parseInt(Ie.fontWeight)>=600)&&!o(Ie.fontFamily)&&(be.bold=!0),Ie.fontStyle==="italic"&&(be.italic=!0),Ie.textDecoration&&Ie.textDecoration.includes("underline")&&(be.underline=!0),Ie.color&&Ie.color!=="rgb(0, 0, 0)"){be.color=s(Ie.color);let w=d(Ie.color);w!==null&&(be.transparency=w)}if(Ie.fontSize&&(be.fontSize=c(Ie.fontSize)),Ie.textTransform&&Ie.textTransform!=="none"){let w=Ie.textTransform;ve=de=>h(de,w)}Ie.marginLeft&&parseFloat(Ie.marginLeft)>0&&y.push(`Inline element <${oe.tagName.toLowerCase()}> has margin-left which is not supported in PowerPoint. Remove margin from inline elements.`),Ie.marginRight&&parseFloat(Ie.marginRight)>0&&y.push(`Inline element <${oe.tagName.toLowerCase()}> has margin-right which is not supported in PowerPoint. Remove margin from inline elements.`),Ie.marginTop&&parseFloat(Ie.marginTop)>0&&y.push(`Inline element <${oe.tagName.toLowerCase()}> has margin-top which is not supported in PowerPoint. Remove margin from inline elements.`),Ie.marginBottom&&parseFloat(Ie.marginBottom)>0&&y.push(`Inline element <${oe.tagName.toLowerCase()}> has margin-bottom which is not supported in PowerPoint. Remove margin from inline elements.`),b(oe,be,Y,ve)}}ye=Me}),Y.length>0&&(Y[0].text=Y[0].text.replace(/^\s+/,""),Y[Y.length-1].text=Y[Y.length-1].text.replace(/\s+$/,"")),Y.filter(oe=>oe.text.length>0)},x=j=>!j||j==="transparent"||j==="rgba(0, 0, 0, 0)",S=j=>{let $=[j,t.documentElement,j?.querySelector?.(":scope > section, :scope > div, :scope > main")].filter(Boolean);for(let Y of $){let Se=r.getComputedStyle(Y),ye=Se.backgroundImage||"";if(ye.includes("linear-gradient")||ye.includes("radial-gradient"))return{gradient:!0};if(ye&&ye!=="none"){let ve=ye.match(/url\(["']?([^"')]+)["']?\)/);if(ve)return{type:"image",path:ve[1]}}let oe=Se.backgroundColor;if(!x(oe))return{type:"color",value:s(oe)}}return{type:"color",value:"FFFFFF"}},F=t.body,N=F.getBoundingClientRect(),L=j=>({left:j.left-N.left,top:j.top-N.top,width:j.width,height:j.height}),D=j=>L(j.getBoundingClientRect()),T=(j,$)=>{let Y=u(j.color);return!Y||Y.a>=.2||!$.textContent.trim()?s(j.color):"E8E8E8"},G=(j,$,Y)=>{let{x:Se,y:ye,w:oe,h:ve}=v(j,$,Y),Me=N.width,be=N.height,Ie=Math.max(8,Me-Se-4),Ee=j.scrollHeight||0,w=/^H[1-6]$/.test(j.tagName),de=w?Math.min(Math.max(8,oe*.05),32):Math.min(Math.max(2,oe*.02),12);w?oe=Math.max(oe+de,Me*.92-Se):oe=Math.min(oe+de,Ie),oe=Math.min(oe,Ie);let te=Math.max(6,ve*(w?.18:.12)),U=Math.max(8,be-ye-4);return Ee>ve+2?ve=Math.min(Ee+te,U):ve=Math.min(ve+te,U),{x:Se,y:ye,w:oe,h:ve}},V=j=>{let $=r.getComputedStyle(j).zIndex;if(!$||$==="auto")return 0;let Y=parseInt($,10);return Number.isFinite(Y)?Y:0},C=(j,$)=>{$&&(j.zIndex=V($)),ce.push(j)},q=(j,$,Y)=>{let ye=r.getComputedStyle(j).listStyleColor;if(ye&&ye!=="rgba(0, 0, 0, 0)"){let oe=s(ye);if(oe&&oe!==Y)return oe}for(let oe of $)try{let ve=r.getComputedStyle(oe,"::marker");if(ve?.color){let Me=s(ve.color);if(Me&&Me!==Y)return Me}}catch{}return null},y=[],M=S(F);M.gradient&&y.push("CSS gradients are not supported. Use Sharp to rasterize gradients as PNG images first, then reference with background-image: url('gradient.png')");let ne=M.gradient?{type:"color",value:"FFFFFF"}:{type:M.type,...M.path?{path:M.path}:{value:M.value}},_=ne.value||"0E0E12",ce=[],ae=[],Te=["P","H1","H2","H3","H4","H5","H6","UL","OL","LI"],Q=new Set;t.querySelectorAll("*").forEach(j=>{if(Q.has(j))return;if(j.tagName==="DIV"&&j.dataset&&j.dataset.pptxMerge==="true"){let P=D(j);if(P.width===0||P.height===0){Q.add(j);return}if(j.querySelector('[data-pptx-merge="true"]')){y.push("data-pptx-merge container cannot contain another data-pptx-merge container. Nested merge is not supported."),Q.add(j);return}let W=r.getComputedStyle(j);if(W.backgroundImage&&W.backgroundImage!=="none"){y.push("Background images on data-pptx-merge container are not supported. Use solid colors or borders, or layer images via slide.addImage().");return}let le=W.backgroundColor&&W.backgroundColor!=="rgba(0, 0, 0, 0)",he=[W.borderTopWidth,W.borderRightWidth,W.borderBottomWidth,W.borderLeftWidth].map(Re=>parseFloat(Re)||0),pe=he.some(Re=>Re>0)&&he.every(Re=>Re===he[0]);(le||pe)&&ce.push({type:"shape",text:"",position:{x:l(P.left),y:l(P.top),w:l(P.width),h:l(P.height)},shape:{fill:le?s(W.backgroundColor):null,transparency:le?d(W.backgroundColor):null,line:pe?{color:s(W.borderColor),width:c(W.borderWidth)}:null,rectRadius:(()=>{let Re=W.borderRadius,ot=parseFloat(Re);if(ot===0)return 0;if(Re.includes("%")){if(ot>=50)return 1;let pt=Math.min(P.width,P.height);return ot/100*l(pt)}return Re.includes("pt")?ot/72:ot/i})(),shadow:g(W.boxShadow)}});let Ce=Array.from(j.querySelectorAll("p, h1, h2, h3, h4, h5, h6"));if(Ce.length===0){y.push("data-pptx-merge container has no

/ children to merge. Remove the data-pptx-merge attribute or add text elements."),Q.add(j);return}let fe=r.getComputedStyle(Ce[0]),De={fontSize:c(fe.fontSize),fontFace:fe.fontFamily.split(",")[0].replace(/['"]/g,"").trim(),color:s(fe.color),align:fe.textAlign==="start"?"left":fe.textAlign,lineSpacing:fe.lineHeight&&fe.lineHeight!=="normal"?c(fe.lineHeight):null,paraSpaceBefore:0,paraSpaceAfter:0,margin:[c(W.paddingLeft),c(W.paddingRight),c(W.paddingBottom),c(W.paddingTop)]},qe=d(fe.color);qe!==null&&(De.transparency=qe);let ze=[];if(Ce.forEach((Re,ot)=>{let pt=ot===Ce.length-1,R=r.getComputedStyle(Re),se=R.textTransform,Ae=c(R.fontSize),Pe=R.fontFamily.split(",")[0].replace(/['"]/g,"").trim(),H=s(R.color),ue=R.fontWeight==="bold"||parseInt(R.fontWeight)>=600,k=R.fontStyle==="italic",ge=R.textDecoration.includes("underline"),Oe={};Ae!==De.fontSize&&(Oe.fontSize=Ae),Pe!==De.fontFace&&(Oe.fontFace=Pe),H!==De.color&&(Oe.color=H),ue&&!o(R.fontFamily)&&(Oe.bold=!0),k&&(Oe.italic=!0),ge&&(Oe.underline=!0);let m=Re.querySelector("b, i, u, strong, em, span, br"),ee;if(m)ee=b(Re,Oe,[],ie=>h(ie,se));else{let ie=h(Re.textContent.trim(),se);if(!ie)return;ee=[{text:ie,options:{...Oe}}]}ee.length>0&&!pt&&(ee[ee.length-1].options.breakLine=!0),ze.push(...ee),Q.add(Re)}),ze.length===0){Q.add(j);return}ce.push({type:"merged-text",items:ze,position:{x:l(P.left),y:l(P.top),w:l(P.width),h:l(P.height)},style:De}),Q.add(j);return}if(Te.includes(j.tagName)){let P=r.getComputedStyle(j),W=P.backgroundColor&&P.backgroundColor!=="rgba(0, 0, 0, 0)",le=P.borderWidth&&parseFloat(P.borderWidth)>0||P.borderTopWidth&&parseFloat(P.borderTopWidth)>0||P.borderRightWidth&&parseFloat(P.borderRightWidth)>0||P.borderBottomWidth&&parseFloat(P.borderBottomWidth)>0||P.borderLeftWidth&&parseFloat(P.borderLeftWidth)>0,he=P.boxShadow&&P.boxShadow!=="none";if(W||le||he){let K=D(j);if(K.width>0&&K.height>0){let pe=[P.borderTopWidth,P.borderRightWidth,P.borderBottomWidth,P.borderLeftWidth].map(De=>parseFloat(De)||0),Ce=pe.some(De=>De>0)&&pe.every(De=>De===pe[0]),fe=W?f(P.backgroundColor,_):{fill:null,transparency:null};if(fe.fill||Ce){let De=P.borderRadius,qe=parseFloat(De);C({type:"shape",text:"",position:{x:l(K.left),y:l(K.top),w:l(K.width),h:l(K.height)},shape:{fill:fe.fill,transparency:fe.transparency,line:Ce?{color:s(P.borderColor),width:c(P.borderWidth)}:null,rectRadius:(()=>{if(!qe)return 0;if(De.includes("%")){if(qe>=50)return 1;let ze=Math.min(K.width,K.height);return qe/100*l(ze)}return De.includes("pt")?qe/72:qe/i})(),shadow:g(P.boxShadow)}},j)}}}}if(j.className&&j.className.includes("placeholder")){let P=D(j);P.width===0||P.height===0?y.push(`Placeholder "${j.id||"unnamed"}" has ${P.width===0?"width: 0":"height: 0"}. Check the layout CSS.`):ae.push({id:j.id||`placeholder-${ae.length}`,x:l(P.left),y:l(P.top),w:l(P.width),h:l(P.height)}),Q.add(j);return}if(j.tagName==="IMG"){let P=D(j);if(P.width>0&&P.height>0){ce.push({type:"image",src:j.src,position:{x:l(P.left),y:l(P.top),w:l(P.width),h:l(P.height)}}),Q.add(j);return}}if(new Set(["DIV","SECTION","ARTICLE","ASIDE"]).has(j.tagName)){let P=r.getComputedStyle(j),W=P.backgroundColor&&P.backgroundColor!=="rgba(0, 0, 0, 0)";for(let Re of j.childNodes)if(Re.nodeType===Node.TEXT_NODE){let ot=Re.textContent.trim();ot&&y.push(`DIV element contains unwrapped text "${ot.substring(0,50)}${ot.length>50?"...":""}". All text must be wrapped in

,

-

,
    , or
      tags to appear in PowerPoint.`)}let le=P.backgroundImage;if(le&&le!=="none"){y.push("Background images on DIV elements are not supported. Use solid colors or borders for shapes, or use slide.addImage() in PptxGenJS to layer images.");return}let he=P.borderTopWidth,K=P.borderRightWidth,pe=P.borderBottomWidth,Ce=P.borderLeftWidth,fe=[he,K,pe,Ce].map(Re=>parseFloat(Re)||0),De=fe.some(Re=>Re>0),qe=De&&fe.every(Re=>Re===fe[0]),ze=[];if(De&&!qe){let Re=D(j),ot=l(Re.left),pt=l(Re.top),R=l(Re.width),se=l(Re.height);if(parseFloat(he)>0){let Ae=c(he),Pe=Ae/72/2;ze.push({type:"line",x1:ot,y1:pt+Pe,x2:ot+R,y2:pt+Pe,width:Ae,color:s(P.borderTopColor)})}if(parseFloat(K)>0){let Ae=c(K),Pe=Ae/72/2;ze.push({type:"line",x1:ot+R-Pe,y1:pt,x2:ot+R-Pe,y2:pt+se,width:Ae,color:s(P.borderRightColor)})}if(parseFloat(pe)>0){let Ae=c(pe),Pe=Ae/72/2;ze.push({type:"line",x1:ot,y1:pt+se-Pe,x2:ot+R,y2:pt+se-Pe,width:Ae,color:s(P.borderBottomColor)})}if(parseFloat(Ce)>0){let Ae=c(Ce),Pe=Ae/72/2;ze.push({type:"line",x1:ot+Pe,y1:pt,x2:ot+Pe,y2:pt+se,width:Ae,color:s(P.borderLeftColor)})}}if(W||De){let Re=D(j);if(Re.width>=N.width*.97&&Re.height>=N.height*.97&&W){Q.add(j);return}if(Re.width>0&&Re.height>0){let pt=g(P.boxShadow);if(W||qe){let R=W?f(P.backgroundColor,_):{fill:null,transparency:null},se=R.fill,Ae=R.transparency;!se&&qe&&(se=s(P.borderColor)||"2A2A30",Ae=Ae??88),C({type:"shape",text:"",position:{x:l(Re.left),y:l(Re.top),w:l(Re.width),h:l(Re.height)},shape:{fill:se,transparency:Ae,line:qe?{color:s(P.borderColor),width:c(P.borderWidth)}:null,rectRadius:(()=>{let Pe=P.borderRadius,H=parseFloat(Pe);if(H===0)return 0;if(Pe.includes("%")){if(H>=50)return 1;let ue=Math.min(Re.width,Re.height);return H/100*l(ue)}return Pe.includes("pt")?H/72:H/i})(),shadow:pt}},j)}ze.forEach(R=>C(R,j)),Q.add(j);return}}}if(j.tagName==="UL"||j.tagName==="OL"){let P=D(j);if(P.width===0||P.height===0)return;let W=Array.from(j.querySelectorAll("li")),le=[],he=r.getComputedStyle(j),K=c(he.paddingLeft),pe=K*.5,Ce=K*.5,fe=r.getComputedStyle(W[0]||j),De=s(fe.color),qe=q(j,W,De);W.forEach((Re,ot)=>{let pt=ot===W.length-1,R=b(Re,{breakLine:!1});R.length>0&&(R[0].text=R[0].text.replace(/^[•\-\*▪▸]\s*/,""),R[0].options.bullet={indent:Ce}),R.length>0&&qe&&qe!==De&&R.unshift({text:"\u200B",options:{bullet:{indent:Ce},color:qe,fontSize:R[0]?.options?.fontSize||c(fe.fontSize),breakLine:!1}}),R.length>0&&!pt&&(R[R.length-1].options.breakLine=!0),le.push(...R)});let ze=G(j,P,null);C({type:"list",items:le,position:{x:l(ze.x),y:l(ze.y),w:l(ze.w),h:l(ze.h)},style:{fontSize:c(fe.fontSize),fontFace:fe.fontFamily.split(",")[0].replace(/['"]/g,"").trim(),color:De,bulletColor:qe,transparency:d(fe.color),align:fe.textAlign==="start"?"left":fe.textAlign,lineSpacing:fe.lineHeight&&fe.lineHeight!=="normal"?c(fe.lineHeight):null,paraSpaceBefore:0,paraSpaceAfter:c(fe.marginBottom),margin:[pe,0,0,0]}},j),W.forEach(Re=>Q.add(Re)),Q.add(j);return}if(!Te.includes(j.tagName))return;let Se=D(j),ye=j.textContent.trim();if(Se.width===0||Se.height===0||!ye)return;if(j.tagName!=="LI"&&/^[•\-\*▪▸○●◆◇■□]\s/.test(ye.trimStart())){y.push(`Text element <${j.tagName.toLowerCase()}> starts with bullet symbol "${ye.substring(0,20)}...". Use
        or
          lists instead of manual bullet symbols.`);return}let oe=r.getComputedStyle(j),ve=A(oe.transform,oe.writingMode),{x:Me,y:be,w:Ie,h:Ee}=G(j,Se,ve),w=oe.fontWeight==="bold"||parseInt(oe.fontWeight,10)>=600,de={fontSize:c(oe.fontSize),fontFace:oe.fontFamily.split(",")[0].replace(/['"]/g,"").trim(),color:T(oe,j),align:oe.textAlign==="start"?"left":oe.textAlign,lineSpacing:c(oe.lineHeight),paraSpaceBefore:c(oe.marginTop),paraSpaceAfter:c(oe.marginBottom),margin:[c(oe.paddingLeft),c(oe.paddingRight),c(oe.paddingBottom),c(oe.paddingTop)]},te=d(oe.color);if(te!==null&&(de.transparency=te),ve!==null&&(de.rotate=ve),j.querySelector("b, i, u, strong, em, span, br")){let P=oe.textTransform,W={};w&&!o(oe.fontFamily)&&(W.bold=!0);let le=b(j,W,[],pe=>h(pe,P));!le.map(pe=>pe.text).join("").trim()&&ye&&(le=[{text:h(ye,P),options:{...W}}]);let K={...de};if(K.lineSpacing){let pe=Math.max(K.fontSize,...le.map(Ce=>Ce.options?.fontSize||0));if(pe>K.fontSize){let Ce=K.lineSpacing/K.fontSize;K.lineSpacing=pe*Ce}}C({type:j.tagName.toLowerCase(),text:le,position:{x:l(Me),y:l(be),w:l(Ie),h:l(Ee)},style:K},j)}else{let P=oe.textTransform,W=h(ye,P);C({type:j.tagName.toLowerCase(),text:W,position:{x:l(Me),y:l(be),w:l(Ie),h:l(Ee)},style:{...de,bold:w&&!o(oe.fontFamily),italic:oe.fontStyle==="italic",underline:oe.textDecoration.includes("underline")}},j)}Q.add(j)});let Z=j=>j==="shape"?0:j==="line"?1:j==="image"?2:3;return ce.sort((j,$)=>{let Y=(j.zIndex??0)-($.zIndex??0);return Y!==0?Y:Z(j.type)-Z($.type)}),{background:ne,elements:ce,placeholders:ae,errors:y}}var tr={width:1280,height:720},gp={p:["p"],h1:["h1"],h2:["h2"],h3:["h3"],h4:["h4"],h5:["h5"],h6:["h6"],list:["li"],"merged-text":["span","em","strong","b","i","p","h1","h2","h3","h4","h5","h6"]};function dd(e){return(e?.elements||[]).filter(t=>ud.has(t.type)).length}function mp(e){let t=new Set;for(let n of e?.elements||[])if(ud.has(n.type))for(let i of gp[n.type]||[n.type])t.add(i);return t.size?[...t].map(n=>`body[data-pptx-raster="1"] ${n} { + `,(B.head||B.documentElement).appendChild(T)}s(),d(r),u(r),h(r),A(r),y(r),t?(p(r),g(r),S(r),I(r),S(r),F(r),r.querySelectorAll("[class]").forEach(B=>B.removeAttribute("class")),x(r),b(r),g(r),S(r),I(r)):F(r)}function Kc(e=document){let t=e.defaultView||window,r=e.body,n=t.getComputedStyle(r),a={width:parseFloat(n.width),height:parseFloat(n.height),scrollWidth:r.scrollWidth,scrollHeight:r.scrollHeight},i=[],o=Math.max(0,a.scrollWidth-a.width-1),l=Math.max(0,a.scrollHeight-a.height-1),c=o*.75,s=l*.75;if(c>0||s>0){let d=[];c>0&&d.push(`${c.toFixed(1)}pt horizontally`),s>0&&d.push(`${s.toFixed(1)}pt vertically`);let u=s>0?' (Remember: leave 0.5" margin at bottom of slide)':"";i.push(`HTML content overflows body by ${d.join(" and ")}${u}`)}return{...a,errors:i}}function Qc(e=document){let t=e,r=t.defaultView||window,n=.75,a=96,i=["impact"],o=j=>{if(!j)return!1;let $=j.toLowerCase().replace(/['"]/g,"").split(",")[0].trim();return i.includes($)},l=j=>j/a,c=j=>parseFloat(j)*n,s=j=>{if(j==="rgba(0, 0, 0, 0)"||j==="transparent")return"FFFFFF";let $=j.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return $?$.slice(1).map(Y=>parseInt(Y).toString(16).padStart(2,"0")).join(""):"FFFFFF"},d=j=>{let $=j.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(!$||!$[4])return null;let Y=parseFloat($[4]);return Math.round((1-Y)*100)},u=j=>{let $=String(j||"").match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);return $?{r:parseInt($[1],10),g:parseInt($[2],10),b:parseInt($[3],10),a:$[4]!=null?parseFloat($[4]):1}:null},h=j=>{let $=String(j||"0E0E12").replace("#","");return{r:parseInt($.slice(0,2),16),g:parseInt($.slice(2,4),16),b:parseInt($.slice(4,6),16)}},f=(j,$="0E0E12")=>{let Y=u(j);if(!Y)return{fill:s(j),transparency:d(j)};if(Y.a>=.98)return{fill:s(j),transparency:null};let Se=h($),ye=Math.round(Se.r*(1-Y.a)+Y.r*Y.a),oe=Math.round(Se.g*(1-Y.a)+Y.g*Y.a),ve=Math.round(Se.b*(1-Y.a)+Y.b*Y.a);return{fill:[ye,oe,ve].map(Me=>Me.toString(16).padStart(2,"0")).join("").toUpperCase(),transparency:null}},p=(j,$)=>$==="uppercase"?j.toUpperCase():$==="lowercase"?j.toLowerCase():$==="capitalize"?j.replace(/\b\w/g,Y=>Y.toUpperCase()):j,A=(j,$)=>{let Y=0;if($==="vertical-rl"?Y=90:$==="vertical-lr"&&(Y=270),j&&j!=="none"){let Se=j.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/);if(Se)Y+=parseFloat(Se[1]);else{let ye=j.match(/matrix\(([^)]+)\)/);if(ye){let oe=ye[1].split(",").map(parseFloat),ve=Math.atan2(oe[1],oe[0])*(180/Math.PI);Y+=Math.round(ve)}}}return Y=Y%360,Y<0&&(Y+=360),Y===0?null:Y},y=(j,$,Y)=>{if(Y===null)return{x:$.left,y:$.top,w:$.width,h:$.height};if(Y===90||Y===270){let ve=$.left+$.width/2,Me=$.top+$.height/2;return{x:ve-$.height/2,y:Me-$.width/2,w:$.height,h:$.width}}let ye=$.left+$.width/2,oe=$.top+$.height/2;return{x:ye-j.offsetWidth/2,y:oe-j.offsetHeight/2,w:j.offsetWidth,h:j.offsetHeight}},g=j=>{if(!j||j==="none"||j.match(/inset/))return null;let Y=j.match(/rgba?\([^)]+\)/),Se=j.match(/([-\d.]+)(px|pt)/g);if(!Se||Se.length<2)return null;let ye=parseFloat(Se[0]),oe=parseFloat(Se[1]),ve=Se.length>2?parseFloat(Se[2]):0,Me=0;(ye!==0||oe!==0)&&(Me=Math.atan2(oe,ye)*(180/Math.PI),Me<0&&(Me+=360));let be=Math.sqrt(ye*ye+oe*oe)*n,Ie=.5;if(Y){let Ee=Y[0].match(/[\d.]+\)$/);Ee&&(Ie=parseFloat(Ee[0].replace(")","")))}return{type:"outer",angle:Math.round(Me),blur:ve*.75,color:Y?s(Y[0]):"000000",offset:be,opacity:Ie}},b=(j,$={},Y=[],Se=ye=>ye)=>{let ye=!1;return j.childNodes.forEach(oe=>{let ve=Se,Me=oe.nodeType===Node.TEXT_NODE||oe.tagName==="BR";if(Me){let be=oe.tagName==="BR"?` +`:ve(oe.textContent.replace(/\s+/g," ")),Ie=Y[Y.length-1];ye&&Ie?Ie.text+=be:Y.push({text:be,options:{...$}})}else if(oe.nodeType===Node.ELEMENT_NODE&&oe.textContent.trim()){let be={...$},Ie=r.getComputedStyle(oe);if(oe.tagName==="SPAN"||oe.tagName==="B"||oe.tagName==="STRONG"||oe.tagName==="I"||oe.tagName==="EM"||oe.tagName==="U"){if((Ie.fontWeight==="bold"||parseInt(Ie.fontWeight)>=600)&&!o(Ie.fontFamily)&&(be.bold=!0),Ie.fontStyle==="italic"&&(be.italic=!0),Ie.textDecoration&&Ie.textDecoration.includes("underline")&&(be.underline=!0),Ie.color&&Ie.color!=="rgb(0, 0, 0)"){be.color=s(Ie.color);let w=d(Ie.color);w!==null&&(be.transparency=w)}if(Ie.fontSize&&(be.fontSize=c(Ie.fontSize)),Ie.textTransform&&Ie.textTransform!=="none"){let w=Ie.textTransform;ve=de=>p(de,w)}Ie.marginLeft&&parseFloat(Ie.marginLeft)>0&&v.push(`Inline element <${oe.tagName.toLowerCase()}> has margin-left which is not supported in PowerPoint. Remove margin from inline elements.`),Ie.marginRight&&parseFloat(Ie.marginRight)>0&&v.push(`Inline element <${oe.tagName.toLowerCase()}> has margin-right which is not supported in PowerPoint. Remove margin from inline elements.`),Ie.marginTop&&parseFloat(Ie.marginTop)>0&&v.push(`Inline element <${oe.tagName.toLowerCase()}> has margin-top which is not supported in PowerPoint. Remove margin from inline elements.`),Ie.marginBottom&&parseFloat(Ie.marginBottom)>0&&v.push(`Inline element <${oe.tagName.toLowerCase()}> has margin-bottom which is not supported in PowerPoint. Remove margin from inline elements.`),b(oe,be,Y,ve)}}ye=Me}),Y.length>0&&(Y[0].text=Y[0].text.replace(/^\s+/,""),Y[Y.length-1].text=Y[Y.length-1].text.replace(/\s+$/,"")),Y.filter(oe=>oe.text.length>0)},x=j=>!j||j==="transparent"||j==="rgba(0, 0, 0, 0)",S=j=>{let $=[j,t.documentElement,j?.querySelector?.(":scope > section, :scope > div, :scope > main")].filter(Boolean);for(let Y of $){let Se=r.getComputedStyle(Y),ye=Se.backgroundImage||"";if(ye.includes("linear-gradient")||ye.includes("radial-gradient"))return{gradient:!0};if(ye&&ye!=="none"){let ve=ye.match(/url\(["']?([^"')]+)["']?\)/);if(ve)return{type:"image",path:ve[1]}}let oe=Se.backgroundColor;if(!x(oe))return{type:"color",value:s(oe)}}return{type:"color",value:"FFFFFF"}},F=t.body,I=F.getBoundingClientRect(),B=j=>({left:j.left-I.left,top:j.top-I.top,width:j.width,height:j.height}),D=j=>B(j.getBoundingClientRect()),T=(j,$)=>{let Y=u(j.color);return!Y||Y.a>=.2||!$.textContent.trim()?s(j.color):"E8E8E8"},G=(j,$,Y)=>{let{x:Se,y:ye,w:oe,h:ve}=y(j,$,Y),Me=I.width,be=I.height,Ie=Math.max(8,Me-Se-4),Ee=j.scrollHeight||0,w=/^H[1-6]$/.test(j.tagName),de=w?Math.min(Math.max(8,oe*.05),32):Math.min(Math.max(2,oe*.02),12);w?oe=Math.max(oe+de,Me*.92-Se):oe=Math.min(oe+de,Ie),oe=Math.min(oe,Ie);let te=Math.max(6,ve*(w?.18:.12)),O=Math.max(8,be-ye-4);return Ee>ve+2?ve=Math.min(Ee+te,O):ve=Math.min(ve+te,O),{x:Se,y:ye,w:oe,h:ve}},V=j=>{let $=r.getComputedStyle(j).zIndex;if(!$||$==="auto")return 0;let Y=parseInt($,10);return Number.isFinite(Y)?Y:0},C=(j,$)=>{$&&(j.zIndex=V($)),ce.push(j)},q=(j,$,Y)=>{let ye=r.getComputedStyle(j).listStyleColor;if(ye&&ye!=="rgba(0, 0, 0, 0)"){let oe=s(ye);if(oe&&oe!==Y)return oe}for(let oe of $)try{let ve=r.getComputedStyle(oe,"::marker");if(ve?.color){let Me=s(ve.color);if(Me&&Me!==Y)return Me}}catch{}return null},v=[],M=S(F);M.gradient&&v.push("CSS gradients are not supported. Use Sharp to rasterize gradients as PNG images first, then reference with background-image: url('gradient.png')");let ne=M.gradient?{type:"color",value:"FFFFFF"}:{type:M.type,...M.path?{path:M.path}:{value:M.value}},_=ne.value||"0E0E12",ce=[],ie=[],Te=["P","H1","H2","H3","H4","H5","H6","UL","OL","LI"],Q=new Set;t.querySelectorAll("*").forEach(j=>{if(Q.has(j))return;if(j.tagName==="DIV"&&j.dataset&&j.dataset.pptxMerge==="true"){let P=D(j);if(P.width===0||P.height===0){Q.add(j);return}if(j.querySelector('[data-pptx-merge="true"]')){v.push("data-pptx-merge container cannot contain another data-pptx-merge container. Nested merge is not supported."),Q.add(j);return}let W=r.getComputedStyle(j);if(W.backgroundImage&&W.backgroundImage!=="none"){v.push("Background images on data-pptx-merge container are not supported. Use solid colors or borders, or layer images via slide.addImage().");return}let le=W.backgroundColor&&W.backgroundColor!=="rgba(0, 0, 0, 0)",he=[W.borderTopWidth,W.borderRightWidth,W.borderBottomWidth,W.borderLeftWidth].map(Re=>parseFloat(Re)||0),pe=he.some(Re=>Re>0)&&he.every(Re=>Re===he[0]);(le||pe)&&ce.push({type:"shape",text:"",position:{x:l(P.left),y:l(P.top),w:l(P.width),h:l(P.height)},shape:{fill:le?s(W.backgroundColor):null,transparency:le?d(W.backgroundColor):null,line:pe?{color:s(W.borderColor),width:c(W.borderWidth)}:null,rectRadius:(()=>{let Re=W.borderRadius,ot=parseFloat(Re);if(ot===0)return 0;if(Re.includes("%")){if(ot>=50)return 1;let pt=Math.min(P.width,P.height);return ot/100*l(pt)}return Re.includes("pt")?ot/72:ot/a})(),shadow:g(W.boxShadow)}});let Ce=Array.from(j.querySelectorAll("p, h1, h2, h3, h4, h5, h6"));if(Ce.length===0){v.push("data-pptx-merge container has no

          / children to merge. Remove the data-pptx-merge attribute or add text elements."),Q.add(j);return}let fe=r.getComputedStyle(Ce[0]),De={fontSize:c(fe.fontSize),fontFace:fe.fontFamily.split(",")[0].replace(/['"]/g,"").trim(),color:s(fe.color),align:fe.textAlign==="start"?"left":fe.textAlign,lineSpacing:fe.lineHeight&&fe.lineHeight!=="normal"?c(fe.lineHeight):null,paraSpaceBefore:0,paraSpaceAfter:0,margin:[c(W.paddingLeft),c(W.paddingRight),c(W.paddingBottom),c(W.paddingTop)]},qe=d(fe.color);qe!==null&&(De.transparency=qe);let ze=[];if(Ce.forEach((Re,ot)=>{let pt=ot===Ce.length-1,R=r.getComputedStyle(Re),se=R.textTransform,Ae=c(R.fontSize),Pe=R.fontFamily.split(",")[0].replace(/['"]/g,"").trim(),H=s(R.color),ue=R.fontWeight==="bold"||parseInt(R.fontWeight)>=600,k=R.fontStyle==="italic",ge=R.textDecoration.includes("underline"),Oe={};Ae!==De.fontSize&&(Oe.fontSize=Ae),Pe!==De.fontFace&&(Oe.fontFace=Pe),H!==De.color&&(Oe.color=H),ue&&!o(R.fontFamily)&&(Oe.bold=!0),k&&(Oe.italic=!0),ge&&(Oe.underline=!0);let m=Re.querySelector("b, i, u, strong, em, span, br"),ee;if(m)ee=b(Re,Oe,[],ae=>p(ae,se));else{let ae=p(Re.textContent.trim(),se);if(!ae)return;ee=[{text:ae,options:{...Oe}}]}ee.length>0&&!pt&&(ee[ee.length-1].options.breakLine=!0),ze.push(...ee),Q.add(Re)}),ze.length===0){Q.add(j);return}ce.push({type:"merged-text",items:ze,position:{x:l(P.left),y:l(P.top),w:l(P.width),h:l(P.height)},style:De}),Q.add(j);return}if(Te.includes(j.tagName)){let P=r.getComputedStyle(j),W=P.backgroundColor&&P.backgroundColor!=="rgba(0, 0, 0, 0)",le=P.borderWidth&&parseFloat(P.borderWidth)>0||P.borderTopWidth&&parseFloat(P.borderTopWidth)>0||P.borderRightWidth&&parseFloat(P.borderRightWidth)>0||P.borderBottomWidth&&parseFloat(P.borderBottomWidth)>0||P.borderLeftWidth&&parseFloat(P.borderLeftWidth)>0,he=P.boxShadow&&P.boxShadow!=="none";if(W||le||he){let K=D(j);if(K.width>0&&K.height>0){let pe=[P.borderTopWidth,P.borderRightWidth,P.borderBottomWidth,P.borderLeftWidth].map(De=>parseFloat(De)||0),Ce=pe.some(De=>De>0)&&pe.every(De=>De===pe[0]),fe=W?f(P.backgroundColor,_):{fill:null,transparency:null};if(fe.fill||Ce){let De=P.borderRadius,qe=parseFloat(De);C({type:"shape",text:"",position:{x:l(K.left),y:l(K.top),w:l(K.width),h:l(K.height)},shape:{fill:fe.fill,transparency:fe.transparency,line:Ce?{color:s(P.borderColor),width:c(P.borderWidth)}:null,rectRadius:(()=>{if(!qe)return 0;if(De.includes("%")){if(qe>=50)return 1;let ze=Math.min(K.width,K.height);return qe/100*l(ze)}return De.includes("pt")?qe/72:qe/a})(),shadow:g(P.boxShadow)}},j)}}}}if(j.className&&j.className.includes("placeholder")){let P=D(j);P.width===0||P.height===0?v.push(`Placeholder "${j.id||"unnamed"}" has ${P.width===0?"width: 0":"height: 0"}. Check the layout CSS.`):ie.push({id:j.id||`placeholder-${ie.length}`,x:l(P.left),y:l(P.top),w:l(P.width),h:l(P.height)}),Q.add(j);return}if(j.tagName==="IMG"){let P=D(j);if(P.width>0&&P.height>0){ce.push({type:"image",src:j.src,position:{x:l(P.left),y:l(P.top),w:l(P.width),h:l(P.height)}}),Q.add(j);return}}if(new Set(["DIV","SECTION","ARTICLE","ASIDE"]).has(j.tagName)){let P=r.getComputedStyle(j),W=P.backgroundColor&&P.backgroundColor!=="rgba(0, 0, 0, 0)";for(let Re of j.childNodes)if(Re.nodeType===Node.TEXT_NODE){let ot=Re.textContent.trim();ot&&v.push(`DIV element contains unwrapped text "${ot.substring(0,50)}${ot.length>50?"...":""}". All text must be wrapped in

          ,

          -

          ,
            , or
              tags to appear in PowerPoint.`)}let le=P.backgroundImage;if(le&&le!=="none"){v.push("Background images on DIV elements are not supported. Use solid colors or borders for shapes, or use slide.addImage() in PptxGenJS to layer images.");return}let he=P.borderTopWidth,K=P.borderRightWidth,pe=P.borderBottomWidth,Ce=P.borderLeftWidth,fe=[he,K,pe,Ce].map(Re=>parseFloat(Re)||0),De=fe.some(Re=>Re>0),qe=De&&fe.every(Re=>Re===fe[0]),ze=[];if(De&&!qe){let Re=D(j),ot=l(Re.left),pt=l(Re.top),R=l(Re.width),se=l(Re.height);if(parseFloat(he)>0){let Ae=c(he),Pe=Ae/72/2;ze.push({type:"line",x1:ot,y1:pt+Pe,x2:ot+R,y2:pt+Pe,width:Ae,color:s(P.borderTopColor)})}if(parseFloat(K)>0){let Ae=c(K),Pe=Ae/72/2;ze.push({type:"line",x1:ot+R-Pe,y1:pt,x2:ot+R-Pe,y2:pt+se,width:Ae,color:s(P.borderRightColor)})}if(parseFloat(pe)>0){let Ae=c(pe),Pe=Ae/72/2;ze.push({type:"line",x1:ot,y1:pt+se-Pe,x2:ot+R,y2:pt+se-Pe,width:Ae,color:s(P.borderBottomColor)})}if(parseFloat(Ce)>0){let Ae=c(Ce),Pe=Ae/72/2;ze.push({type:"line",x1:ot+Pe,y1:pt,x2:ot+Pe,y2:pt+se,width:Ae,color:s(P.borderLeftColor)})}}if(W||De){let Re=D(j);if(Re.width>=I.width*.97&&Re.height>=I.height*.97&&W){Q.add(j);return}if(Re.width>0&&Re.height>0){let pt=g(P.boxShadow);if(W||qe){let R=W?f(P.backgroundColor,_):{fill:null,transparency:null},se=R.fill,Ae=R.transparency;!se&&qe&&(se=s(P.borderColor)||"2A2A30",Ae=Ae??88),C({type:"shape",text:"",position:{x:l(Re.left),y:l(Re.top),w:l(Re.width),h:l(Re.height)},shape:{fill:se,transparency:Ae,line:qe?{color:s(P.borderColor),width:c(P.borderWidth)}:null,rectRadius:(()=>{let Pe=P.borderRadius,H=parseFloat(Pe);if(H===0)return 0;if(Pe.includes("%")){if(H>=50)return 1;let ue=Math.min(Re.width,Re.height);return H/100*l(ue)}return Pe.includes("pt")?H/72:H/a})(),shadow:pt}},j)}ze.forEach(R=>C(R,j)),Q.add(j);return}}}if(j.tagName==="UL"||j.tagName==="OL"){let P=D(j);if(P.width===0||P.height===0)return;let W=Array.from(j.querySelectorAll("li")),le=[],he=r.getComputedStyle(j),K=c(he.paddingLeft),pe=K*.5,Ce=K*.5,fe=r.getComputedStyle(W[0]||j),De=s(fe.color),qe=q(j,W,De);W.forEach((Re,ot)=>{let pt=ot===W.length-1,R=b(Re,{breakLine:!1});R.length>0&&(R[0].text=R[0].text.replace(/^[•\-\*▪▸]\s*/,""),R[0].options.bullet={indent:Ce}),R.length>0&&qe&&qe!==De&&R.unshift({text:"\u200B",options:{bullet:{indent:Ce},color:qe,fontSize:R[0]?.options?.fontSize||c(fe.fontSize),breakLine:!1}}),R.length>0&&!pt&&(R[R.length-1].options.breakLine=!0),le.push(...R)});let ze=G(j,P,null);C({type:"list",items:le,position:{x:l(ze.x),y:l(ze.y),w:l(ze.w),h:l(ze.h)},style:{fontSize:c(fe.fontSize),fontFace:fe.fontFamily.split(",")[0].replace(/['"]/g,"").trim(),color:De,bulletColor:qe,transparency:d(fe.color),align:fe.textAlign==="start"?"left":fe.textAlign,lineSpacing:fe.lineHeight&&fe.lineHeight!=="normal"?c(fe.lineHeight):null,paraSpaceBefore:0,paraSpaceAfter:c(fe.marginBottom),margin:[pe,0,0,0]}},j),W.forEach(Re=>Q.add(Re)),Q.add(j);return}if(!Te.includes(j.tagName))return;let Se=D(j),ye=j.textContent.trim();if(Se.width===0||Se.height===0||!ye)return;if(j.tagName!=="LI"&&/^[•\-\*▪▸○●◆◇■□]\s/.test(ye.trimStart())){v.push(`Text element <${j.tagName.toLowerCase()}> starts with bullet symbol "${ye.substring(0,20)}...". Use
                or
                  lists instead of manual bullet symbols.`);return}let oe=r.getComputedStyle(j),ve=A(oe.transform,oe.writingMode),{x:Me,y:be,w:Ie,h:Ee}=G(j,Se,ve),w=oe.fontWeight==="bold"||parseInt(oe.fontWeight,10)>=600,de={fontSize:c(oe.fontSize),fontFace:oe.fontFamily.split(",")[0].replace(/['"]/g,"").trim(),color:T(oe,j),align:oe.textAlign==="start"?"left":oe.textAlign,lineSpacing:c(oe.lineHeight),paraSpaceBefore:c(oe.marginTop),paraSpaceAfter:c(oe.marginBottom),margin:[c(oe.paddingLeft),c(oe.paddingRight),c(oe.paddingBottom),c(oe.paddingTop)]},te=d(oe.color);if(te!==null&&(de.transparency=te),ve!==null&&(de.rotate=ve),j.querySelector("b, i, u, strong, em, span, br")){let P=oe.textTransform,W={};w&&!o(oe.fontFamily)&&(W.bold=!0);let le=b(j,W,[],pe=>p(pe,P));!le.map(pe=>pe.text).join("").trim()&&ye&&(le=[{text:p(ye,P),options:{...W}}]);let K={...de};if(K.lineSpacing){let pe=Math.max(K.fontSize,...le.map(Ce=>Ce.options?.fontSize||0));if(pe>K.fontSize){let Ce=K.lineSpacing/K.fontSize;K.lineSpacing=pe*Ce}}C({type:j.tagName.toLowerCase(),text:le,position:{x:l(Me),y:l(be),w:l(Ie),h:l(Ee)},style:K},j)}else{let P=oe.textTransform,W=p(ye,P);C({type:j.tagName.toLowerCase(),text:W,position:{x:l(Me),y:l(be),w:l(Ie),h:l(Ee)},style:{...de,bold:w&&!o(oe.fontFamily),italic:oe.fontStyle==="italic",underline:oe.textDecoration.includes("underline")}},j)}Q.add(j)});let Z=j=>j==="shape"?0:j==="line"?1:j==="image"?2:3;return ce.sort((j,$)=>{let Y=(j.zIndex??0)-($.zIndex??0);return Y!==0?Y:Z(j.type)-Z($.type)}),{background:ne,elements:ce,placeholders:ie,errors:v}}var or={width:1280,height:720},rp={p:["p"],h1:["h1"],h2:["h2"],h3:["h3"],h4:["h4"],h5:["h5"],h6:["h6"],list:["li"],"merged-text":["span","em","strong","b","i","p","h1","h2","h3","h4","h5","h6"]};function Yc(e){return(e?.elements||[]).filter(t=>Jc.has(t.type)).length}function np(e){let t=new Set;for(let n of e?.elements||[])if(Jc.has(n.type))for(let a of rp[n.type]||[n.type])t.add(a);return t.size?[...t].map(n=>`body[data-pptx-raster="1"] ${n} { color: transparent !important; -webkit-text-fill-color: transparent !important; text-shadow: none !important; }`).join(` -`):""}function vp(e,t=null){let r=Ur(e);if(!t||dd(t)===0)return r;let n=mp(t);if(!n||r.includes('data-pptx-raster="1"')&&r.includes("pptx-raster-hide-text"))return r;let i=``;return/<\/head>/i.test(r)?r.replace(/<\/head>/i,`${i}`).replace(/e.querySelectorAll(r),createElement:r=>document.createElement(r),getElementById:r=>e.querySelector(`#${r}`),head:e.querySelector("style")?.parentElement||e,_exportRoot:e}}function Sp(){let e=document.createElement("div");e.className="ppt-export-root-host",e.setAttribute("aria-hidden","true"),e.style.cssText=[`width:${tr.width}px`,`height:${tr.height}px`,"overflow:hidden"].join(";"),yp().appendChild(e);let t=e.attachShadow({mode:"open"}),r=document.createElement("div");return r.className="ppt-export-root",r.style.cssText=[`width:${tr.width}px`,`height:${tr.height}px`,"overflow:hidden"].join(";"),t.appendChild(r),r._exportHost=e,r}function fd(e){let t=e?._exportHost||e;t?.isConnected&&t.remove()}async function hd(){await new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(e))})}function Cp(e,t){let r=new DOMParser().parseFromString(t,"text/html");e.replaceChildren(),r.querySelectorAll("style").forEach(i=>{let a=document.createElement("style");a.textContent=wp(i.textContent||""),e.appendChild(a)});let n=document.createElement("div");if(n.className="ppt-export-body",r.body){for(let i of r.body.attributes)i.name==="class"?n.classList.add(...i.value.split(/\s+/).filter(Boolean)):i.name==="style"?n.style.cssText+=`;${i.value}`:n.setAttribute(i.name,i.value);n.innerHTML=r.body.innerHTML}return n.style.boxSizing="border-box",/\bwidth\s*:/i.test(n.style.cssText)||(n.style.width=`${tr.width}px`),/\bheight\s*:/i.test(n.style.cssText)||(n.style.height=`${tr.height}px`),e.appendChild(n),n}async function pd(e){let t=Ur(e),r=Sp(),n=Cp(r,t);return await hd(),xp(r,n)}function sd(e){return["Top","Right","Bottom","Left"].some(t=>parseFloat(e[`border${t}Width`]||0)>0)}function ld(e){return!e||e==="transparent"||e==="rgba(0, 0, 0, 0)"}function kp(e){let t=e.id?`#${e.id}`:"",r=typeof e.className=="string"?e.className.trim().split(/\s+/).filter(Boolean).slice(0,2).map(n=>`.${n}`).join(""):"";return`${e.tagName.toLowerCase()}${t}${r}`}async function Ad(e){let t=String(e||"").trim(),r=[],n=new Set,i=(o,l,c=null)=>{let s=c?` (${kp(c)})`:"",d=`${o}:${l}${s}`;n.has(d)||(n.add(d),r.push({code:o,message:`${l}${s}`}))};(!t||!/<\/html>\s*$/i.test(t))&&i("incomplete_html","The slide must be a complete HTML document ending with ."),/i("canvas_overflow",h));let u=tr.width,p=tr.height;(Math.abs(s.width-u)>2||Math.abs(s.height-p)>2)&&i("canvas_size",`Computed canvas must be 960pt x 540pt (${u}px x ${p}px); got ${s.width.toFixed(1)}px x ${s.height.toFixed(1)}px.`),c.querySelectorAll("div").forEach(h=>{[...h.childNodes].forEach(v=>{v.nodeType===Node.TEXT_NODE&&v.textContent.replace(/\s+/g," ").trim()&&i("direct_div_text","Visible DIV text must be wrapped in p, h1-h6, or li.",h)});let A=l.getComputedStyle(h);A.backgroundImage&&A.backgroundImage!=="none"&&i("div_background_image","DIV background-image is unsupported; use an img element.",h)}),c.querySelectorAll("p,h1,h2,h3,h4,h5,h6,li").forEach(h=>{let A=l.getComputedStyle(h);(!ld(A.backgroundColor)||A.backgroundImage&&A.backgroundImage!=="none"||sd(A)||A.boxShadow&&A.boxShadow!=="none")&&i("decorated_text_element","Background, border, image, and shadow styling must be on an enclosing DIV shape.",h);let v=h.getBoundingClientRect();v.width<=0||v.height<=0||((v.lefts.right+1||v.bottom>s.bottom+1)&&i("text_out_of_bounds","A text element extends outside the slide canvas.",h),parseFloat(A.fontSize||0)>12&&v.bottom>s.bottom-48&&i("bottom_safety_margin","Text larger than 12px must keep a 36pt bottom safety margin.",h))}),c.querySelectorAll("span,em,strong,b,i,u,a,small,mark,sub,sup,code").forEach(h=>{let A=l.getComputedStyle(h);(["marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft"].some(g=>parseFloat(A[g]||0)>0)||!ld(A.backgroundColor)||A.backgroundImage&&A.backgroundImage!=="none"||sd(A)||A.boxShadow&&A.boxShadow!=="none")&&i("unsafe_inline_style","Inline text elements cannot carry box spacing, fills, borders, or shadows.",h)}),c.querySelectorAll("*").forEach(h=>{let A=l.getComputedStyle(h);String(A.backgroundImage||"").includes("gradient")&&i("computed_gradient","Computed CSS contains an unsupported gradient.",h);for(let v of["::before","::after"])try{let g=l.getComputedStyle(h,v)?.content;g&&g!=="none"&&g!=="normal"&&g!=='""'&&i("generated_content",`${v} generated text/content is unsupported for editable PPTX.`,h)}catch{}});try{(Ms(o).errors||[]).forEach(A=>i("pptx_conversion",A))}catch(h){i("pptx_conversion",String(h?.message||h||"PPTX conversion validation failed."))}}finally{a&&fd(a)}return{valid:r.length===0,issues:r.slice(0,32)}}async function cd(e,t,r={}){let n=null;try{let i=await pd(e);n=i._exportRoot,od(i,t),await hd();let a=Is(i),o=Ms(i),l=a.errors||[];l.length&&console.warn("[ppt-live-export] slide overflows canvas; exporting anyway:",l.join("; "));let c={...a,errors:[]},s=o.errors||[];return!s.length||r.allowValidationErrors?{slideData:o,bodyDimensions:c,aggressive:t,warnings:l}:{error:new Error(s.join(` -`))}}finally{n&&fd(n)}}async function Pp(e,t={}){let r=await cd(e,!1,t);if(r?.slideData)return r;let n=await cd(e,!0,t);if(n?.slideData)return n;throw n?.error||r?.error||new Error("PPT Live slide preparation failed")}async function gd(e,t={}){let r=[];try{for(let[n,i]of e.entries()){if(!i?.html)continue;let a=await Pp(i.html,t),o=null,c=dd(a.slideData)===0;if(typeof t.renderRaster=="function")try{typeof t.onRasterProgress=="function"&&t.onRasterProgress(n,i);let s=c?zs(i):vp(i.html,a.slideData);o=await t.renderRaster(s,n)}catch{o=null}r.push({index:n,slideId:i.id,notes:i,...a,rasterBase64:o,rasterOnly:!!(o&&c)})}return r}finally{bp()}}function Fp(e={}){let t=e.theme||{},r=String(e.title||"Slide").replace(/[<>&]/g,l=>({"<":"<",">":">","&":"&"})[l]||l),n=String(e.subtitle||e.claim||"").replace(/[<>&]/g,l=>({"<":"<",">":">","&":"&"})[l]||l),i=t.background||"#ffffff",a=t.ink||"#111111",o=t.muted||"#666666";return` +`):""}function ap(e,t=null){let r=Or(e);if(!t||Yc(t)===0)return r;let n=np(t);if(!n||r.includes('data-pptx-raster="1"')&&r.includes("pptx-raster-hide-text"))return r;let a=``;return/<\/head>/i.test(r)?r.replace(/<\/head>/i,`${a}`).replace(/e.querySelectorAll(r),createElement:r=>document.createElement(r),getElementById:r=>e.querySelector(`#${r}`),head:e.querySelector("style")?.parentElement||e,_exportRoot:e}}function cp(){let e=document.createElement("div");e.className="ppt-export-root-host",e.setAttribute("aria-hidden","true"),e.style.cssText=[`width:${or.width}px`,`height:${or.height}px`,"overflow:hidden"].join(";"),ip().appendChild(e);let t=e.attachShadow({mode:"open"}),r=document.createElement("div");return r.className="ppt-export-root",r.style.cssText=[`width:${or.width}px`,`height:${or.height}px`,"overflow:hidden"].join(";"),t.appendChild(r),r._exportHost=e,r}function dp(e){let t=e?._exportHost||e;t?.isConnected&&t.remove()}async function $c(){await new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(e))})}function up(e,t){let r=new DOMParser().parseFromString(t,"text/html");e.replaceChildren(),r.querySelectorAll("style").forEach(a=>{let i=document.createElement("style");i.textContent=sp(a.textContent||""),e.appendChild(i)});let n=document.createElement("div");if(n.className="ppt-export-body",r.body){for(let a of r.body.attributes)a.name==="class"?n.classList.add(...a.value.split(/\s+/).filter(Boolean)):a.name==="style"?n.style.cssText+=`;${a.value}`:n.setAttribute(a.name,a.value);n.innerHTML=r.body.innerHTML}return n.style.boxSizing="border-box",/\bwidth\s*:/i.test(n.style.cssText)||(n.style.width=`${or.width}px`),/\bheight\s*:/i.test(n.style.cssText)||(n.style.height=`${or.height}px`),e.appendChild(n),n}async function fp(e){let t=Or(e),r=cp(),n=up(r,t);return await $c(),lp(r,n)}async function Zc(e,t,r={}){let n=null;try{let a=await fp(e);n=a._exportRoot,_c(a,t),await $c();let i=Kc(a),o=Qc(a),l=i.errors||[];l.length&&console.warn("[ppt-live-export] slide overflows canvas; exporting anyway:",l.join("; "));let c={...i,errors:[]},s=o.errors||[];return!s.length||r.allowValidationErrors?{slideData:o,bodyDimensions:c,aggressive:t,warnings:l}:{error:new Error(s.join(` +`))}}finally{n&&dp(n)}}async function hp(e,t={}){let r=await Zc(e,!1,t);if(r?.slideData)return r;let n=await Zc(e,!0,t);if(n?.slideData)return n;throw n?.error||r?.error||new Error("PPT Live slide preparation failed")}async function ed(e,t={}){let r=[];try{for(let[n,a]of e.entries()){if(!a?.html)continue;let i=await hp(a.html,t),o=null,c=Yc(i.slideData)===0;if(typeof t.renderRaster=="function")try{typeof t.onRasterProgress=="function"&&t.onRasterProgress(n,a);let s=c?Ps(a):ap(a.html,i.slideData);o=await t.renderRaster(s,n)}catch{o=null}r.push({index:n,slideId:a.id,notes:a,...i,rasterBase64:o,rasterOnly:!!(o&&c)})}return r}finally{op()}}function pp(e={}){let t=e.theme||{},r=String(e.title||"Slide").replace(/[<>&]/g,l=>({"<":"<",">":">","&":"&"})[l]||l),n=String(e.subtitle||e.claim||"").replace(/[<>&]/g,l=>({"<":"<",">":">","&":"&"})[l]||l),a=t.background||"#ffffff",i=t.ink||"#111111",o=t.muted||"#666666";return`
                  ${t}
                  -`}function zy(e){let t=(e.slides||[]).map((r,n)=>`
                  - +`}function Cy(e){let t=(e.slides||[]).map((r,n)=>`
                  +
                  `).join(` `);return` - + -${Be(e.title||"PPT Live")} +${Le(e.title||"PPT Live")} ..." - }`;function Dn(e){try{return JSON.stringify(e??{},null,2)}catch{return"{}"}}function Gy(e){return Array.isArray(e?.currentDeck?.slides)&&e.currentDeck.slides.length>0}function qy(e){let t=e?.operation||"auto";return Gy(e)?` + }`;function qo(e){try{return JSON.stringify(e??{},null,2)}catch{return"{}"}}function Ty(e){return Array.isArray(e?.currentDeck?.slides)&&e.currentDeck.slides.length>0}function Dy(e){let t=e?.operation||"auto";return Ty(e)?` ## Current operation @@ -404,13 +404,13 @@ Patch rules: - Operation: ${t} - No current deck was provided. This is a first-pass deck generation run. Return a complete \`slides\` array. -`}function ti(e){let t=e?.style||{},r=t.fontFamily||"sans",n=t.density||"standard",i=n==="loose"?"spacious":n,a=t.colorMode||t.theme||"light",o=t.stylePreset||"",l=t.palette,c=r==="serif"?'serif \u2014 use serif typography in every slide HTML (for example Georgia, "Songti SC", "Times New Roman", Cambria). Avoid sans-serif body copy.':'sans-serif \u2014 use clean sans-serif typography in every slide HTML (for example system-ui, "PingFang SC", "Microsoft YaHei", Arial, Helvetica). Avoid serif body copy.',s;i==="compact"?s="compact \u2014 information-forward: body padding 24-32px, line-height 1.2-1.28, and 4-6 concise bullets, metrics, or a two-column grid when the content supports it. Prefer readable tightness over decorative whitespace; never overflow the slide.":i==="spacious"?s="spacious \u2014 the loosest tier, still content-rich: body padding 44-52px, line-height 1.32-1.4, and 2-4 concise bullets or 2-3 short content blocks per slide. Keep clear hierarchy without leaving large empty regions.":s="standard \u2014 balanced professional density: body padding 34-42px, line-height 1.26-1.34, and 3-5 bullets, metrics, or paired columns when useful. Use whitespace to separate sections, not to leave half the slide blank.";let u=` +`}function jo(e){let t=e?.style||{},r=t.fontFamily||"sans",n=t.density||"standard",a=n==="loose"?"spacious":n,i=t.colorMode||t.theme||"light",o=t.stylePreset||"",l=t.palette,c=r==="serif"?'serif \u2014 use serif typography in every slide HTML (for example Georgia, "Songti SC", "Times New Roman", Cambria). Avoid sans-serif body copy.':'sans-serif \u2014 use clean sans-serif typography in every slide HTML (for example system-ui, "PingFang SC", "Microsoft YaHei", Arial, Helvetica). Avoid serif body copy.',s;a==="compact"?s="compact \u2014 information-forward: body padding 24-32px, line-height 1.2-1.28, and 4-6 concise bullets, metrics, or a two-column grid when the content supports it. Prefer readable tightness over decorative whitespace; never overflow the slide.":a==="spacious"?s="spacious \u2014 the loosest tier, still content-rich: body padding 44-52px, line-height 1.32-1.4, and 2-4 concise bullets or 2-3 short content blocks per slide. Keep clear hierarchy without leaving large empty regions.":s="standard \u2014 balanced professional density: body padding 34-42px, line-height 1.26-1.34, and 3-5 bullets, metrics, or paired columns when useful. Use whitespace to separate sections, not to leave half the slide blank.";let u=` ## Presentation style preferences (must follow in slides[].html) - Font family: ${c} - Information density: ${s} -- Slide color mode: ${a==="dark"?"dark \u2014 use dark slide backgrounds with light text, high-contrast panels, and a keynote-style atmosphere. Set design.theme to dark and reflect it in every slides[].html background, text, and panel colors.":"light \u2014 use light slide backgrounds with dark text, clean readable contrast, and a professional presentation look. Set design.theme to light and reflect it in every slides[].html background, text, and panel colors."} +- Slide color mode: ${i==="dark"?"dark \u2014 use dark slide backgrounds with light text, high-contrast panels, and a keynote-style atmosphere. Set design.theme to dark and reflect it in every slides[].html background, text, and panel colors.":"light \u2014 use light slide backgrounds with dark text, clean readable contrast, and a professional presentation look. Set design.theme to light and reflect it in every slides[].html background, text, and panel colors."} ## Hard layout rules (apply to every slides[].html, any style) @@ -422,9 +422,9 @@ Patch rules: `,l)try{u+=`- Style palette (matches the preset; use these exact colors for backgrounds, text, accents, and panels in every slide HTML): ${JSON.stringify(l)} `}catch{}u+=`- The preset does not suspend the ppt-design core rules: assertion-led titles, one core message per slide, anti-AI-slop rules, the 960pt x 540pt canvas, editable-PPTX constraints, and zero content overflow all still apply. - Pick the closest of the skill's five design philosophies as the structural grammar for layout, then skin it with the preset. If the preset file cannot be read, keep the palette above and fall back to that philosophy. -`}return u}var jy=`Your previous response in this session was interrupted before it finished. Continue the task now. If your deliverable is a project file, first inspect what you already wrote (Read it) and rewrite that file completely if it could be incomplete. If your deliverable is a final JSON message, re-emit the complete JSON from scratch \u2014 do not assume any part of the interrupted output was received. +`}return u}var Ey=`Your previous response in this session was interrupted before it finished. Continue the task now. If your deliverable is a project file, first inspect what you already wrote (Read it) and rewrite that file completely if it could be incomplete. If your deliverable is a final JSON message, re-emit the complete JSON from scratch \u2014 do not assume any part of the interrupted output was received. -`;function Vy(e){let t=Array.isArray(e?.issues)?e.issues.map(String).filter(Boolean):[],r=String(e?.previousFailure||"").trim();return`AUTOMATIC COMPLETION CONTINUATION ${e?.attempt||1}/${e?.maxAttempts||1}. +`;function Ry(e){let t=Array.isArray(e?.issues)?e.issues.map(String).filter(Boolean):[],r=String(e?.previousFailure||"").trim();return`AUTOMATIC COMPLETION CONTINUATION ${e?.attempt||1}/${e?.maxAttempts||1}. The host has verified that the "${e?.stage||"current"}" stage is still incomplete after its normal retry budget. Continue the unfinished task in this user turn; do not restart completed work and do not merely explain what remains. - Inspect the durable project files first and reuse every valid artifact already present. @@ -435,22 +435,16 @@ ${r?`- Previous verified failure: ${r} - ${t.join(` - `)} `:""} -`}function Bf(e){let t=Array.isArray(e?.auditIssues)?e.auditIssues.map(String).filter(Boolean):[];return t.length?`The host rejected the previous audit turn because the audit artifact was not complete: -- ${t.join(` -- `)} - -Resolve every issue above in this turn. In particular, use the Write tool to create or completely rewrite \`quality-report.json\`; do not answer "DECK AUDIT PASSED" unless that file has been successfully written and covers every slide id. - -`:""}function Xy(e){let t=e?.style?.palette||{};return JSON.stringify(t,null,2).split(` +`}function By(e){let t=e?.style?.palette||{};return JSON.stringify(t,null,2).split(` `).map(r=>` ${r}`).join(` -`)}function Hy(e){let t=e?.style?.stylePreset||"",r=e?.style?.colorMode||e?.style?.theme||"light",n=t?`references/style-presets/${t}.md`:"",i=Array.isArray(e?.complianceIssues)&&e.complianceIssues.length?`The host rejected the previous plan because required Skill evidence was missing. Complete these exact missing actions before accepting or rewriting project.json: +`)}function Ly(e){let t=e?.style?.stylePreset||"",r=e?.style?.colorMode||e?.style?.theme||"light",n=t?`references/style-presets/${t}.md`:"",a=Array.isArray(e?.complianceIssues)&&e.complianceIssues.length?`The host rejected the previous plan because required Skill evidence was missing. Complete these exact missing actions before accepting or rewriting project.json: - ${e.complianceIssues.join(` - `)} -`:"",a=`Plan a PPT Live deck. This is the PLANNING phase of a staged pipeline running in a dedicated deck project directory: the workspace root of this session is the deck's \`{{ppt_project_dir}}\`. Research the topic, lock the narrative, design the visual system, write a per-slide brief, and SAVE the complete plan to \`project.json\` at the workspace root. Later turns run in THIS SAME session, but must be able to recover from context compression using the self-contained generation contract in that file. +`:"",i=`Plan a PPT Live deck. This is the PLANNING phase of a staged pipeline running in a dedicated deck project directory: the workspace root of this session is the deck's \`{{ppt_project_dir}}\`. Research the topic, lock the narrative, design the visual system, write a per-slide brief, and SAVE the complete plan to \`project.json\` at the workspace root. Later turns run in THIS SAME session, but must be able to recover from context compression using the self-contained generation contract in that file. -1. Call \`Skill('${ir}')\`. This exact stable key is mandatory. Check the tool result reports \`skill_key="${ir}"\`; if it does not, stop with an error. Never invoke or substitute a different PPT/presentation skill. -2. From the skill directory returned by Skill, \`Read\` all mandatory references: \`${$n.join("`, `")}\`. +1. Call \`Skill('${pr}')\`. This exact stable key is mandatory. Check the tool result reports \`skill_key="${pr}"\`; if it does not, stop with an error. Never invoke or substitute a different PPT/presentation skill. +2. From the skill directory returned by Skill, \`Read\` all mandatory references: \`${Ca.join("`, `")}\`. ${n?`3. \`Read\` the selected style preset \`${n}\` and apply its visual rules when planning.`:"3. No named style preset was supplied; derive one coherent visual system from the user intent and skill."} 4. If the deck is data-heavy, analytical, explanatory, or structurally complex, \`Read\` \`references/data-information-visualization.md\` before drafting slide plans. 5. Use any BitFun research tools needed by the user's prompt. All external research happens NOW; render runs must not re-research. @@ -476,10 +470,10 @@ ${n?`3. \`Read\` the selected style preset \`${n}\` and apply its visual rules w "assumptions": ["one-shot assumptions"], "generationContract": { "version": 1, - "skillKey": "${ir}", + "skillKey": "${pr}", "skillName": "ppt-design", "requiredReferences": [ - ${$n.map(o=>`"${o}"`).join(`, + ${Ca.map(o=>`"${o}"`).join(`, `)}${n?`, "${n}"`:""} ], @@ -516,7 +510,7 @@ ${n?`3. \`Read\` the selected style preset \`${n}\` and apply its visual rules w "stylePhilosophy": "pentagram|muller-brockmann|build|kenya-hara|takram", "theme": "${r==="dark"?"dark":"light"}", "palette": { -${Xy(e)} +${By(e)} }, "layoutPrinciples": ["specific visual rules every slide of this deck must share"] }, @@ -551,7 +545,7 @@ Plan rules: - \`design.layoutPrinciples\` and \`design.palette\` are the consistency contract across render runs \u2014 make them specific. - Distill the skill, mandatory references, selected preset, and user style into \`generationContract.hardRules\` and \`generationContract.visualGrammar\` so later turns can recover after context compression. - The editable PPTX rules below are non-negotiable and must appear compactly in \`generationContract.hardRules\`: -${ei} +${Go} Plan density (quality bar, not a protocol limit): - Write dense, telegraphic notes, never prose paragraphs. Pack facts, numbers, and names; drop filler words. @@ -562,10 +556,10 @@ Plan density (quality bar, not a protocol limit): Input JSON: \`\`\`json -${Dn(e)} -\`\`\``;return i+a+ti(e)}function ec(e){return`slides/slide-${String(e).padStart(2,"0")}.html`}function _y(e){let t=(e?.assignedSlides||[])[0]||{},r=t?.slideNumber??"?",n=ec(t?.slideNumber||0);return`Render PPT Live slide ${r}. This turn runs in the SAME deck Agent Session as planning, but you must rely on the durable project contract rather than assuming old context is still present. +${qo(e)} +\`\`\``;return a+i+jo(e)}function mf(e){return`slides/slide-${String(e).padStart(2,"0")}.html`}function Ny(e){let t=(e?.assignedSlides||[])[0]||{},r=t?.slideNumber??"?",n=mf(t?.slideNumber||0);return`Render PPT Live slide ${r}. This turn runs in the SAME deck Agent Session as planning, but you must rely on the durable project contract rather than assuming old context is still present. -1. \`Read\` \`project.json\` on every page turn. Verify \`generationContract.skillKey\` is exactly \`${ir}\`, then follow its userPrompt, userBrief, userStyle, hardRules, visualGrammar, design system, and assigned slide plan together. +1. \`Read\` \`project.json\` on every page turn. Verify \`generationContract.skillKey\` is exactly \`${pr}\`, then follow its userPrompt, userBrief, userStyle, hardRules, visualGrammar, design system, and assigned slide plan together. 2. If \`showcaseSlideNumbers\` contains already-rendered pages, \`Read\` those slide files before rendering a non-showcase page and reuse their visual grammar without copying their layout mechanically. 3. Do not re-run research or change the planned title, claim, layout, or narrative role. Apply \`plan.design\` and the assigned slide plan together. 4. \`Write\` exactly one complete document to \`${n}\`. Do not modify any other slide. @@ -575,17 +569,17 @@ Hard HTML/PPTX constraints: - The file must be a complete self-contained 960pt \xD7 540pt document with inline CSS only and no remote assets. - \`body { overflow: hidden; }\`, flex-column root with \`height: 540pt\`, stretchable areas \`flex:1; min-height:0; overflow:hidden;\`. - Budget the vertical space before writing; body text >= 10px; keep a >=36pt bottom safety margin; never overflow the canvas. -${ei} +${Go} - Slide copy must be audience-ready, never placeholder instructions. -${ti(e)} +${jo(e)} Current page contract: \`\`\`json -${Dn({generationContract:e?.generationContract||{},design:e?.design||{},style:e?.style||{},showcaseSlideNumbers:e?.showcaseSlideNumbers||[],assignedSlide:t})} -\`\`\``}function Ky(e){let t=(e?.assignedSlides||[])[0]||{},r=t?.slideNumber??"?",n=ec(t?.slideNumber||0);return`Render one PPT Live slide. This is the RENDER phase of a staged pipeline running in a dedicated deck project directory: the workspace root of this session is the deck's \`{{ppt_project_dir}}\`. The plan (research, outline, design system, render guide, and per-slide briefs) is already final and is provided in the input JSON as \`plan\`. This turn must render ONLY slide ${r}. +${qo({generationContract:e?.generationContract||{},design:e?.design||{},style:e?.style||{},showcaseSlideNumbers:e?.showcaseSlideNumbers||[],assignedSlide:t})} +\`\`\``}function Iy(e){let t=(e?.assignedSlides||[])[0]||{},r=t?.slideNumber??"?",n=mf(t?.slideNumber||0);return`Render one PPT Live slide. This is the RENDER phase of a staged pipeline running in a dedicated deck project directory: the workspace root of this session is the deck's \`{{ppt_project_dir}}\`. The plan (research, outline, design system, render guide, and per-slide briefs) is already final and is provided in the input JSON as \`plan\`. This turn must render ONLY slide ${r}. -1. Call \`Skill('${ir}')\`; verify the result reports the exact stable key. Never substitute another skill. -2. \`Read\` every path in \`plan.generationContract.requiredReferences\`, including mandatory references \`${$n.join("`, `")}\`, plus the selected style preset when listed. +1. Call \`Skill('${pr}')\`; verify the result reports the exact stable key. Never substitute another skill. +2. \`Read\` every path in \`plan.generationContract.requiredReferences\`, including mandatory references \`${Ca.join("`, `")}\`, plus the selected style preset when listed. 3. \`Read\` \`project.json\`, then follow \`generationContract\`, \`plan.design\`, and the assigned slide together. Do not re-research or change the planned title, claim, layout, or narrative role. 4. \`Write\` exactly one complete document to \`${n}\`: self-contained 960pt \xD7 540pt HTML with inline CSS and audience-ready copy. 5. End with "SLIDE ${r} READY"; do not paste HTML into the reply. @@ -593,81 +587,20 @@ ${Dn({generationContract:e?.generationContract||{},design:e?.design||{},style:e? Render rules: - Apply every explicit user style setting from \`generationContract.userStyle\`. - Keep the HTML compact: no HTML comments, no unused CSS rules, minimal whitespace and indentation. Density of CONTENT is good; padding of MARKUP is not. -${ei} +${Go} Input JSON: \`\`\`json -${Dn(e)} -\`\`\``+ti(e)}function Qy(e){let t=e?.assignedSlide||(e?.assignedSlides||[])[0]||{},r=t?.slideNumber??"?",n=ec(t?.slideNumber||0);return`Repair PPT Live slide ${r} in the existing deck Agent Session. - -The host validated \`${n}\` and rejected it for editable-PPTX export. Fix the slide on disk. Do not regenerate the deck, re-research, or replace the page with a generic template. - -You choose how to repair: -1. \`Read\` \`project.json\` and \`${n}\` first. -2. Treat the validator findings below as the acceptance checklist. Keep the planned content, claim, evidence, visual identity, and layout unless a finding requires a structural change. -3. Make the smallest change that clears every finding. Prefer targeted \`Edit\` on \`${n}\` when a finding points at a specific element or block (for example move background/border/shadow from a text tag onto an enclosing DIV, fix one rule, adjust one section). Use \`Write\` for the whole file only when localized edits are impractical or would leave the file inconsistent. -4. Do not call Skill again, do not re-read reference markdown, and do not modify other slides. -5. When \`${n}\` satisfies every finding, end with "SLIDE ${r} REPAIRED". - -Editable-PPTX rules the validator enforces: -${ei} -${ti(e)} - -Validator findings: -\`\`\`json -${Dn(e?.validationIssues||[])} -\`\`\` - -Assigned slide and contract: -\`\`\`json -${Dn({generationContract:e?.generationContract||{},design:e?.design||{},style:e?.style||{},assignedSlide:t})} -\`\`\``}function Zy(e){return`Perform the FINAL whole-deck audit for this PPT Live project in the SAME deck Agent Session where planning and rendering already loaded Skill('${ir}') and distilled rules into \`project.json\`. - -Do NOT call Skill again and do NOT re-read reference markdown unless you must verify one specific rule. Treat \`generationContract.hardRules\`, \`visualGrammar\`, and \`design.renderGuide\` as authoritative. - -${Bf(e)} -1. \`Read\` \`project.json\` and every \`slides/slide-XX.html\` listed in \`slide_order\`. -2. Check every page against the generation contract, user prompt/style, narrative role, evidence, editable PPTX constraints, and taste guardrails already captured in the contract. -3. Check deck-level quality using a thumbnail/contact-sheet pass: visual thesis, signature move discipline, distinct adjacent silhouettes, deliberate density curve, one dominant element per page, no SaaS card-template repetition, no filler labels or fake UI, no missed high-value visual explanation, accurate sources, readable density, and consistent typography/palette/object styles. -4. Rewrite only slide files that need improvement. Preserve correct content and never invent facts. -5. Write \`quality-report.json\` containing \`{"status":"passed","checkedSlides":["every slide_id from slide_order"],"fixedSlides":["only slide_ids you rewrote"],"notes":["specific deck-level findings and fixes, or a concise reason no fixes were needed"]}\`. \`checkedSlides\` must cover every slide id; \`fixedSlides\` must list only pages you changed. -6. End with "DECK AUDIT PASSED". - -Editable PPTX rules: -${ei} -${ti(e)} - -Deck audit contract: -\`\`\`json -${Dn({generationContract:e?.generationContract||{},design:e?.design||{},style:e?.style||{},slideOrder:e?.slideOrder||[],slidePlans:e?.slidePlans||[]})} -\`\`\``}function Yy(e){return`Perform the FINAL whole-deck audit for this PPT Live project in the SAME Agent Session. - -${Bf(e)} -1. Call \`Skill('${ir}')\` and verify the returned stable key is exact. -2. \`Read\` mandatory references \`${$n.join("`, `")}\`, then \`Read\` every additional style reference listed in \`generationContract.requiredReferences\`. -3. \`Read\` \`project.json\` and every file named by \`slide_order\`. -4. Check every page against \`generationContract\`, the pinned ppt-design skill, the selected style preset, user Prompt, user style/layout settings, narrative role, evidence, and editable PPTX constraints. -5. Check deck-level quality using a thumbnail/contact-sheet pass: visual thesis, signature move discipline, distinct adjacent silhouettes, deliberate density curve, one dominant element per page, no SaaS card-template repetition, no filler labels or fake UI, no missed high-value visual explanation, accurate sources, readable density, and consistent typography/palette/object styles. -6. Rewrite only slide files that need improvement. Preserve correct content and never invent facts. -7. Write \`quality-report.json\` containing \`{"status":"passed","checkedSlides":["every slide_id from slide_order"],"fixedSlides":["only slide_ids you rewrote"],"notes":["specific deck-level findings and fixes, or a concise reason no fixes were needed"]}\`. The report is required and \`checkedSlides\` must cover every slide id. -8. End with "DECK AUDIT PASSED". - -Editable PPTX rules: -${ei} -${ti(e)} - -Deck audit contract: -\`\`\`json -${Dn({generationContract:e?.generationContract||{},design:e?.design||{},style:e?.style||{},slideOrder:e?.slideOrder||[],slidePlans:e?.slidePlans||[]})} -\`\`\``}function Jy(e){return`Generate or revise a PPT Live deck. The user only sees the PPT Live app UI. +${qo(e)} +\`\`\``+jo(e)}function My(e){return`Generate or revise a PPT Live deck. The user only sees the PPT Live app UI. -1. Call \`Skill('${ir}')\` and verify the returned stable key. Never substitute a user or project skill. -2. \`Read\` every mandatory reference \`${$n.join("`, `")}\` and the selected style preset reference. If this deck has a project file, \`Read\` \`project.json\` and preserve its generationContract. +1. Call \`Skill('${pr}')\` and verify the returned stable key. Never substitute a user or project skill. +2. \`Read\` every mandatory reference \`${Ca.join("`, `")}\` and the selected style preset reference. If this deck has a project file, \`Read\` \`project.json\` and preserve its generationContract. 3. Use research tools only when the edit introduces factual claims not already grounded by the deck. 4. Finish with only one strict JSON object. Every slide must include complete \`slides[].html\`: self-contained 960pt \xD7 540pt HTML with inline CSS (ppt-design editable PPTX rules). Slide copy must be audience-ready, never placeholder instructions. -${ei} +${Go} Return JSON matching this shape: { @@ -694,30 +627,30 @@ Return JSON matching this shape: "layoutPrinciples": ["specific visual rules used for this deck"] }, "slides": [ - ${Wy} + ${Fy} ] } Input JSON: \`\`\`json -${Dn(e)} -\`\`\``+qy(e)+ti(e)}function $y(e){let t;return e?.phase==="plan"?t=Hy(e):e?.phase==="slides"?t=e?.inSession?_y(e):Ky(e):e?.phase==="repair"?t=Qy(e):e?.phase==="audit"?t=e?.inSession?Zy(e):Yy(e):t=Jy(e),e?.completionRecovery?t=Vy(e.completionRecovery)+t:e?.continueAfterInterruption&&(t=jy+t),t}function eb(e){let t=!1,r=()=>{t||(t=!0,e.agent.onEvent(n=>{!n||typeof n!="object"||Uy(n)}))};e.backend={protocol:"files",async call(n,i,a={}){if(n!=="ppt.generate")throw new Error(`Unsupported PPT Live action: ${n}`);r();let o=$y(i),l=await e.agent.run(o,{runId:a.idempotencyKey,sessionName:"PPT Live",sessionId:a.sessionId,appDataWorkspace:a.appDataWorkspace});if(!l?.sessionId||!l?.turnId)throw new Error("PPT Live agent backend did not return sessionId/turnId");return{sessionId:l.sessionId,turnId:l.turnId,actionRunId:l.actionRunId||l.turnId}},onEvent(n){$l.add(n)},offEvent(n){$l.delete(n)},async cancel(n,i){await e.agent.cancel(n,i)},async turnText(n,i){return{text:(await e.agent.turnText(n,i))?.text||""}},async cancelStaleRuns(){await e.agent.cancelStaleRuns()}}}function Nf(e=window.app){!e||e.backend?.call||e.agent?.run&&eb(e)}var B=On(),En=!1,Rr=null,Ln=[],Nn=0,Ho=!1,wa=!1,ni=[],tc=0,xe=e=>document.getElementById(e),at=()=>window.app||{};Nf(at());var Kf=2500,Jo=new Map;function rc(e){try{return localStorage.getItem(e)}catch{return Jo.has(e)?Jo.get(e):null}}function nc(e,t){try{localStorage.setItem(e,t)}catch{Jo.set(e,t)}}var xa={get:async e=>JSON.parse(rc(e)||"null"),set:async(e,t)=>nc(e,JSON.stringify(t))};function Qf(){let e=at();return e.storage?e.storage:xa}async function Zf(e){let t=Qf();if(t===xa||!at().storage)return t.get(e);try{return await Promise.race([t.get(e),new Promise((r,n)=>setTimeout(()=>n(new Error("storage-timeout")),Kf))])}catch(r){return at().log?.warn?.("Host storage read timed out, using local fallback",{key:e,error:String(r)}),xa.get(e)}}async function is(e,t){let r=Qf();if(r===xa||!at().storage){await r.set(e,t);return}try{await Promise.race([r.set(e,t),new Promise((n,i)=>setTimeout(()=>i(new Error("storage-timeout")),Kf))])}catch(n){at().log?.warn?.("Host storage write timed out, using local fallback",{key:e,error:String(n)}),await xa.set(e,t)}}async function tb(){try{ni=await rb();let e=await Zf(Bi);if(e){B=Un(e),cc(B)&&(B=On(),await is(Bi,{...B,updatedAt:Date.now()}));return}B=On(),await yt(!0)}catch(e){at().log?.warn?.("Failed to load PPT Live state",{error:String(e)}),B=On()}}async function yt(e=!1){B=Un(B),await is(Bi,{...B,updatedAt:Date.now()}),await as(e?"autosave":"manual"),e||Lt(O("saved"))}async function rb(){try{let e=await Zf(vs);return Array.isArray(e)?e.map(Yf).filter(Boolean).slice(0,40):[]}catch(e){return at().log?.warn?.("Failed to load PPT Live history",{error:String(e)}),[]}}async function as(e="autosave"){if(!B?.slides?.length||cc(B))return;let t=Date.now();if(e==="autosave"&&tc&&t-tc<15e3)return;tc=t;let r=Yf({id:B.sessionId||yr("deck"),title:B.title||O("blankDeckTitle"),updatedAt:t,slideCount:B.slides.length,reason:e,prompt:B.promptDraft||B.brief?.topic||"",state:Xr({...B,generation:{...B.generation,active:!1}})});r&&(ni=[r,...ni.filter(n=>n.id!==r.id)].slice(0,40),await is(vs,ni),Jf())}function cc(e){let t=Array.isArray(e?.slides)?e.slides:[];return t.length===1&&!t[0]?.html&&String(t[0]?.id||"").startsWith("agent-working-slide")&&String(e?.title||"")===O("agentWorkingTitle")&&!e?.generation?.active}function Yf(e){return!e?.id||!e?.state?null:{id:String(e.id),title:String(e.title||e.state?.title||O("blankDeckTitle")),updatedAt:Number(e.updatedAt||Date.now()),slideCount:Number(e.slideCount||e.state?.slides?.length||0),reason:String(e.reason||"autosave"),prompt:String(e.prompt||e.state?.brief?.topic||""),state:e.state}}function Jf(){let e=xe("historyList");if(e){if(e.innerHTML="",!ni.length){let t=document.createElement("div");t.className="history-empty",t.textContent=O("historyEmpty"),e.append(t);return}ni.slice(0,12).forEach(t=>{let r=document.createElement("button");r.type="button",r.className=`history-card${t.id===B.sessionId?" is-active":""}`,r.innerHTML=` - ${If(t.title)} - ${O("historyMeta",{count:t.slideCount,time:ib(t.updatedAt)})} - ${t.prompt?`${If(t.prompt)}`:""} - `,r.addEventListener("click",()=>{nb(t.id)}),e.append(r)})}}async function nb(e){let t=ni.find(r=>r.id===e);t&&(Nn+=1,await xc(),B=Un(Xr(t.state)),B.generation.active=!1,Sa(),Mt(),Lt(O("historyRestored")),await is(Bi,{...B,updatedAt:Date.now()}))}function ib(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let r=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),i=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0");return`${r}/${n} ${i}:${a}`}function If(e){return String(e??"").replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function Lt(e){let t=xe("statusLine");t&&(t.textContent=e)}function Ri(e){let t=xe("exportStatus");t&&(t.textContent=e)}function Bn(e,t){En=e,document.querySelector(".ppt-live")?.classList.toggle("is-busy",En),document.querySelectorAll("button, input, select, textarea").forEach(n=>{if(!["closePreview","prevPresent","nextPresent"].includes(n.id)){if(n.id==="cancelGeneration"){n.disabled=!En,n.hidden=!En;return}n.id!=="newDeck"&&(n.disabled=En)}});let r=xe("aiStatusPill");r&&(r.textContent=En?O("statusPillBusy"):O("statusPillReady"),r.classList.toggle("is-busy",En)),t&&Lt(t)}function Ft(e,t,r){B.generation.current=e,B.generation.steps=B.generation.steps.map(n=>({...n,status:n.id===e?t:n.status})),B.generation.active=t==="running"||B.generation.steps.some(n=>n.status==="running"),Lr(B),Br(B),r&&Lt(r)}function Sa(){B.generation.active=!1,B.generation.current="idle",B.generation.draftedCount=0,B.generation.slideTarget=0,B.generation.eventSeq=0,B.generation.steps=B.generation.steps.map(e=>({...e,status:"pending"})),B.generation.events=[],rh(""),Lr(B),Br(B)}function Et(e,t="",r="info"){B.generation=Ra(B.generation||{});let n=typeof e=="string"?{title:e,detail:t,kind:r}:{...e||{}},i=mr(n.title||n.label||n.message||O("processEventUnknown"),160),a=mr(n.detail??t??"",260),o=String(n.kind||r||"info").toLowerCase().replace(/[^a-z0-9-]/g,"")||"info";if(!i&&!a)return;let l=Array.isArray(B.generation.events)?B.generation.events:[],c=l[l.length-1];if(c&&c.title===i&&c.detail===a&&c.kind===o)c.timestamp=Date.now(),B.generation.events=l;else{let s=l.reduce((u,p)=>Math.max(u,Number(p.seq)||0),0),d=Math.max(Number(B.generation.eventSeq)||0,s)+1;B.generation.eventSeq=d,B.generation.events=[...l,{id:yr("generation-event"),seq:d,title:i||O("processEventUnknown"),detail:a,kind:o,timestamp:Date.now()}].slice(-80)}Lr(B),Br(B)}function Mt(){B=Un(B),Yc(B,Jt),Jf()}function cn(e={}){id(B,e),B=Un(B)}function $f(){return xe("topicInput")?.value.trim()||""}function dc(){let e=Bc().join(` -`);return!B.outline.length||B.outline.join(` -`)===e||B.title===O("defaultDeckTitle")||os()}function os(){let e=String(B.title||"").trim();return B.slides.length===1&&B.outline.length===1&&B.outline[0]===O("newSlideTitle")&&(e===O("blankDeckTitle")||e===O("newSlideTitle"))}function In(){return Array.isArray(B.slides)&&B.slides.length>0&&!dc()&&!os()&&!cc(B)}async function ab(){await uc()}async function ob(){await uc()}async function uc(){if(Ho||wa)return;let e=$f();if(!e){Lt(O("promptRequired"));return}Ho=!0;let t=In();B.promptDraft=e,B.lastSubmittedPrompt=e,cn({includeTopic:!t}),t||(B.brief.topic=e);try{await yc("auto",e,{includeTopic:!t});return}catch(r){if(us(r))return;at().log?.warn?.("PPT Live backend generation failed",{error:String(r)}),hc(r),Mt(),await yt(!0)}finally{Ho=!1}}function fc(e=O("deckReady")){B.generation.active=!1,B.generation.draftedCount=B.slides.length,B.generation.slideTarget=0,B.generation.steps=(B.generation.steps||[]).map(t=>({...t,status:t.status==="error"?"error":"done"})),Lt(e),Lr(B),Br(B)}function sb(e=O("backendGenerationFailed"),t=""){B.generation.active=!1,B.generation.steps=(B.generation.steps||[]).map(r=>({...r,status:r.status==="done"?"done":"error"})),Lt(e),Et({title:e,detail:t||O("agentOnlyRetryHint"),kind:"error"}),Bn(!1),Lr(B),Br(B)}function lb(e,t=5){let r=[],n=new Set,i=e;for(let a=0;i&&a({kind:n.kind,title:n.title,url:n.url,text:String(n.text||"").slice(0,6e3)}))}:null);let r=Number(B.brief?.slideTarget)||0;return r>0&&(t.slideTarget=r),t}function dn({includePreset:e=!0}={}){let t=ps(B.style?.stylePreset),r=B.style?.colorMode==="dark"?"dark":"light",n={fontFamily:B.style?.fontFamily==="serif"?"serif":"sans",density:zn(B.style?.density),colorMode:r,theme:r,palette:Cc(t,r)};return e&&(n.stylePreset=B.style?.stylePreset||un),n}function $o(e={}){let t=dn();return{...e.style||{},...t}}function es(e={}){let t=dn();return{...e.design||{},theme:t.colorMode==="dark"?"dark":"light",palette:{...e.design?.palette||{},...t.palette}}}function ts(e={}){let t=dn();return{...e.generationContract||{},userStyle:t}}function cb(e){let t=String(e||"").trim();if(!t)return"";try{let r=new DOMParser().parseFromString(t,"text/html");return r.querySelectorAll("style,script,svg").forEach(n=>n.remove()),mr(r.body?.textContent||r.documentElement?.textContent||"",1800)}catch{return mr(t.replace(/<[^>]+>/g," "),1800)}}function db(e){let t=new Set,r=String(e||""),n=er(B);return/(当前|本页|这一页|此页|current\s+(slide|page)|this\s+(slide|page))/i.test(r)&&t.add(n),[/第\s*(\d{1,2})\s*(页|頁|张|張)/gi,/\b(?:slide|page)\s*(\d{1,2})\b/gi,/\b(\d{1,2})\s*(?:slide|slides|page|pages)\b/gi].forEach(a=>{let o=a.exec(r);for(;o;){let l=Number(o[1])-1;l>=0&&la-o)}function ub(e){let t=db(e),r=er(B),n=new Set(t.length?t:[r]);return{title:B.title,outline:Xr(B.outline||[]),slideCount:B.slides.length,activeSlideIndex:r,activeSlideId:B.slides[r]?.id||"",targetHints:t.map(i=>({slideIndex:i,slideNumber:i+1,slideId:B.slides[i]?.id||"",title:B.slides[i]?.title||""})),slides:B.slides.map((i,a)=>{let o=i.html?cb(i.html):mr((i.elements||[]).flatMap(c=>[c.text,c.label,...Array.isArray(c.items)?c.items:[]]).filter(Boolean).join(` -`),1800),l={slideIndex:a,slideNumber:a+1,id:i.id,title:i.title,kicker:i.kicker,claim:i.claim,proofObject:i.proofObject,supportNote:i.supportNote,sourceNote:i.sourceNote,notes:i.notes,layout:i.layout,visibleText:o,hasHtml:!!i.html};return n.has(a)&&i.html&&(l.html=String(i.html).slice(0,12e3)),l})}}function Mf(e,t){let r=t.getBoundingClientRect(),n=mt((e-r.left)/r.width,0,1);return Math.round(n*2)}function ri(e,{save:t=!0}={}){let r=mt(Math.round(Number(e)),0,2);B.style.density=Rc(r),Oi(B.style.density),Mt(),t&&yt(!0)}var $t=4,ln=8,sn=$t+ln,fb=!1,hb=750;function ss(e){let t=e>$t;return{continuation:t,continuationAttempt:t?e-$t:0}}function Ac(e,t,r,n=[]){let i=ss(t);return i.continuation?{stage:e,attempt:i.continuationAttempt,maxAttempts:ln,previousFailure:gr(r),issues:[...new Set((n||[]).map(String).filter(Boolean))]}:null}function gc(e,t,r=[],n={}){let i=[...new Set(r.map(c=>gr(c)).filter(Boolean))],o=gr(t)||i.at(-1)||"The Agent did not produce the required artifact.",l=new Error(`PPT Live recovery exhausted after ${$t} stage attempts and ${ln} continuation turns. Last verified reason: ${o}`,{cause:t||void 0});return l.pptLiveRecoveryExhausted={stageKey:e,stageVars:n,stepAttempts:$t,continuationAttempts:ln,reasons:i},l}var mc=new Map,eh="";function th(e){let t=String(e||""),r=0;for(let n=0;n({...c,slideNumber:bc(c,s+1),slideId:String(c?.slideId||`slide-${String(s+1).padStart(2,"0")}`)})),n=dn(),i=pc(),a=r.map(c=>({id:c.slideId,title:String(c.title||""),bullets:Array.isArray(c.bullets)?c.bullets.map(String):[],slide_id:c.slideId})),o=Array.isArray(e?.showcaseSlideNumbers)?e.showcaseSlideNumbers.map(Number):[],l=[...new Set(o)].filter(c=>Number.isInteger(c)&&c>=1&&c<=r.length).slice(0,2);if(r.length>=5&&l.length<2){for(let c of[1,Math.min(3,r.length),r.length])if(l.includes(c)||l.push(c),l.length===2)break}return{...e,outline:a,slide_order:a.map(c=>c.slide_id),style:n,design:{...e?.design||{},theme:n.colorMode==="dark"?"dark":"light",palette:{...e?.design?.palette||{},...n.palette}},assumptions:Array.isArray(e?.assumptions)?e.assumptions.map(String):(e?.researchReport?.assumptions||[]).map(String),generationContract:{...e?.generationContract||{},version:1,skillKey:ir,skillName:"ppt-design",requiredReferences:lh(n),deliveryTarget:"editable-pptx",userPrompt:String(t||""),userBrief:i,userStyle:n,hardRules:vb,visualGrammar:{...e?.generationContract?.visualGrammar||{},...e?.design?.renderGuide||{}}},showcaseSlideNumbers:r.length>=5?l:[],slidePlans:r}}async function bb(e,t){let r=at().fs;!e||!r?.writeFile||await r.writeFile(`${e.dir}/project.json`,`${JSON.stringify(t,null,2)} -`)}async function vc(e,t){let r=at().fs;if(!r?.readFile)throw new Error("PPT Live fs API is unavailable");return await r.readFile(`${e.dir}/${t}`)}async function wb(e,t){try{let r=String(await vc(e,t)||"");return r.trim()?ii(r):null}catch{return null}}async function xb(e,t){try{let r=String(await vc(e,t)||"");if(!r.trim())return{status:"empty",value:null,reason:`${t} exists but is empty.`};try{return{status:"valid",value:ii(r),reason:""}}catch(n){return{status:"invalid",value:null,reason:`${t} is not valid JSON: ${gr(n)||"parse failed"}.`}}}catch(r){return{status:"missing",value:null,reason:`${t} was not created or could not be read: ${gr(r)||"file unavailable"}.`}}}async function Sb(e){return await wb(e,"project.json")}async function rs(e,t){try{let r=String(await vc(e,mb(t))||"").trim();return!r||!/<\/html>\s*$/i.test(r)?null:r}catch{return null}}function ic(e){return e?.params&&typeof e.params=="object"?e.params:{}}function Cb(e){let t=String(e||"").trim();return t===ir||t==="ppt-design"}function kb(e){if(!e||String(e.toolName||"").toLowerCase()!=="skill")return!1;let t=e.result||{};return!!(JSON.stringify(t).includes(ir)||t?.success===!0&&String(t?.skill_name||"").toLowerCase()==="ppt-design")}function ch(e,t){let r=(e||[]).filter(s=>s.eventType==="Started"),n=(e||[]).filter(s=>s.eventType==="Completed"),i=new Map(n.filter(s=>s.toolId).map(s=>[s.toolId,s])),a=[],o=r.filter(s=>String(s.toolName||"").toLowerCase()==="skill"&&Cb(ic(s).command)),l=o.some(s=>kb(i.get(s.toolId)));(!o.length||!l)&&a.push(`The exact built-in Skill key ${ir} was not successfully loaded.`);let c=r.filter(s=>String(s.toolName||"").toLowerCase()==="read"&&i.has(s.toolId)).map(s=>{let d=ic(s);return String(d.file_path||d.path||"")});return lh(t).forEach(s=>{c.some(d=>d.endsWith(s))||a.push(`Required reference was not read: ${s}`)}),a}function Pb(e){let t=Array.isArray(e)?e:[],r=t.filter(o=>{if(o.eventType!=="Started")return!1;let l=String(o.toolName||"").toLowerCase(),c=ic(o),s=String(c.file_path||c.path||"");return(l==="write"||l==="filewrite")&&s.endsWith("quality-report.json")});if(!r.length)return["The Agent turn ended without calling Write for quality-report.json."];let n=new Map(t.filter(o=>o.toolId&&["Completed","Failed","Cancelled"].includes(o.eventType)).map(o=>[o.toolId,o]));if(r.some(o=>n.get(o.toolId)?.eventType==="Completed"))return[];let a=r.map(o=>n.get(o.toolId)).find(o=>o?.eventType==="Failed"||o?.eventType==="Cancelled");return a?[`The quality-report.json Write tool did not complete: ${gr(a.error)||a.eventType}.`]:["The quality-report.json Write tool started but no completion event was observed."]}function Fb(e){if(!e)return"";let t=String(e.finishReason||"").trim(),r=String(e.partialRecoveryReason||"").trim();return e.success===!1?`The Agent turn reported success=false${t?` (${t})`:""}.`:r?`The Agent turn ended after partial recovery: ${r}.`:t&&!["complete","completed","final_answer"].includes(t.toLowerCase())?`The Agent turn stopped with finish reason "${t}".`:""}async function dh(e){let t=at().fs;if(!(!t?.readdir||!t?.rm))try{let r=`${at().appDataDir}/decks`,n=await t.readdir(r),i=(Array.isArray(n)?n:[]).map(a=>typeof a=="string"?a:a?.name).filter(a=>typeof a=="string"&&a.startsWith("deck-")&&a!==e);for(let a of i)await t.rm(`${r}/${a}`,{recursive:!0})}catch{}}async function yc(e,t,r={}){if(!at().backend?.call)throw new Error("PPT Live backend is unavailable");if(!wa){wa=!0;try{if(cn({includeTopic:r.includeTopic!==!1}),e==="auto"&&(dc()||os())){await Nb(e,t);return}await Tb(e,t)}finally{wa=!1}}}async function Tb(e,t){let r=null,n=gb()||(ah()?oh():null);n&&!B.agentSession?.workspaceSubdir&&await dh(n.runId);let i={id:B.agentSession?.id||null,project:n};for(let a=1;a<=$t;a+=1)try{await Eb(e,t,a,i);return}catch(o){if(r=o,ds(o)?i.id=null:o?.pptLiveSessionId&&(i.id=o.pptLiveSessionId),!ls(o)||a>=$t)throw o;at().log?.warn?.("PPT Live backend attempt failed, retrying",{attempt:a,maxAttempts:$t,continueInSession:!!i.id,error:String(o)}),Et({title:O("generationRetrying",{attempt:a+1,max:$t}),detail:gr(o),kind:"error"}),Lt(O("generationRetrying",{attempt:a+1,max:$t})),await new Promise(l=>setTimeout(l,cs(o,a)))}if(r)throw r}async function Ca(e,t={},r={}){let n=at(),i=Nn,a=null,o=null,l="",c="",s=!1,d=0,u=null,p=[],f=new Set,h=[],A=zb(),v={lastEventAt:Date.now()};try{let g=await n.backend.call("ppt.generate",e,{entityId:"deck",idempotencyKey:`ppt-live-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,sessionId:r.sessionId||void 0,appDataWorkspace:r.appDataWorkspace||void 0});if(a=g?.sessionId||null,o=g?.turnId||g?.actionRunId||null,!a||!o)throw new Error("PPT Live backend did not return sessionId/turnId");if(_b(a,o),Rn(i))throw new Error("Generation stopped");let b=new Promise((T,G)=>{let V=q=>{if(q.sessionId!==a||q.turnId&&q.turnId!==o)return;v.lastEventAt=Date.now();let y=String(q.sourceEvent||"");if(y.endsWith("dialog-turn-started"))A.note(O("eventTurnStarted"),"","turn");else if(y.endsWith("model-round-started"))t.onToolPhase?.("round"),A.touch();else if(y.endsWith("model-round-completed"))A.touch();else if(y.endsWith("tool-event")){let M=wc(q.toolEvent||{}),ne=M.event_type||M.eventType||"";if(ne==="Started"?h.push({eventType:ne,toolId:M.tool_id||M.toolId||"",toolName:M.tool_name||M.toolName||"",params:M.params||{}}):ne==="Completed"?h.push({eventType:ne,toolId:M.tool_id||M.toolId||"",toolName:M.tool_name||M.toolName||"",result:M.result||{}}):(ne==="Failed"||ne==="Cancelled")&&h.push({eventType:ne,toolId:M.tool_id||M.toolId||"",toolName:M.tool_name||M.toolName||"",error:M.error||M.message||ne}),Mb(M,f)&&(Et(Xb(q)),A.touch()),ne==="EarlyDetected"||ne==="Started")t.onToolPhase?.("detected");else if(ne==="Completed"){let _=String(M.tool_name||M.toolName||"").trim().toLowerCase();t.onToolPhase?.("completed"),_==="skill"?A.note(O("eventToolSkillReady"),ph(M.tool_name||M.toolName),"phase"):(_==="websearch"||_==="webfetch")&&t.onToolPhase?.("research")}}else if(y.endsWith("text-chunk")){let M=String(q.text||"");if(q.contentType==="thinking")c+=M;else{l+=M,A.touch();let _=Date.now();_-d>=500&&(d=_,t.onTextProgress?.(l))}}else if(!y.endsWith("token-usage-updated")){if(y.endsWith("dialog-turn-completed"))s=!0,u={success:q.success,finishReason:q.finishReason||q.finish_reason||"",partialRecoveryReason:q.partialRecoveryReason||q.partial_recovery_reason||""},T({answer:l,thinking:c});else if(y.endsWith("dialog-turn-failed")||y.endsWith("dialog-turn-cancelled")){s=!0,l&&t.onTextProgress?.(l);let M=mr(q.error||q.message||"");Et({title:y.endsWith("dialog-turn-cancelled")?O("eventTurnCancelled"):O("eventTurnFailed"),detail:M,kind:"error"}),G(new Error(M||y))}}};n.backend.onEvent(V),p.push(()=>n.backend.offEvent?.(V));let C=setInterval(()=>{if(s||Date.now()-A.lastProgressLogAt<12e3)return;let y=(B.generation?.steps||[]).find(M=>M.status==="running");A.note(y?.label?`${y.label}\u2026`:O("generationProgressPulse"),y?.detail||"","pulse",0)},12e3);p.push(()=>clearInterval(C))}),x=r.resultKind!=="text",S=await t1(b,a,o,v,{expectJson:x}),F=typeof S=="string"?S:S?.answer||"",N=typeof S=="string"?"":S?.thinking||"";if(Rn(i))throw new Error("Generation stopped");if(!x)return{payload:null,text:F,sessionId:a,toolTrace:h,completion:u};let L=await r1(a,o,F,N);if(Rn(i))throw new Error("Generation stopped");let D=ii(L);if(Rn(i))throw new Error("Generation stopped");return{payload:D,sessionId:a,toolTrace:h,completion:u}}catch(g){if(g&&typeof g=="object"&&a&&(g.pptLiveSessionId=a,g.pptLiveToolTrace=h),!s&&a&&o&&n.backend?.cancel)try{await n.backend.cancel(a,o)}catch(b){at().log?.warn?.("PPT Live backend cancel after failure failed",{sessionId:a,turnId:o,error:String(b)})}throw g}finally{p.forEach(g=>g()),a&&o&&Kb(a,o)}}function uh(e,t){return{operation:e,instruction:t,locale:lr(),brief:pc(),style:dn()}}function Db(e){return{operation:e,locale:lr(),brief:pc({includeEvidence:!1}),style:dn({includePreset:!1})}}async function Eb(e,t,r=1,n={id:null}){let i=Nn;Bn(!0,O("working")),Sa(),Ft("brief","running",O("generationReadingBrief")),Et({title:O("processEventStarted"),detail:O("processEventWaiting"),kind:"start"}),r>1&&Et({title:O("generationRetryAttempt",{attempt:r,max:$t}),detail:"",kind:"start"}),hh(e,t);let a=!1,o={value:""},l={touch:()=>{},note:()=>{},lastProgressLogAt:0};try{let{payload:c,sessionId:s}=await Ca({...uh(e,t),title:B.title,outline:Xr(B.outline),currentSlideIndex:er(B),currentDeck:ub(t),...n?.id?{continueAfterInterruption:!0}:{}},{onToolPhase:d=>{d==="detected"?Ft("brief","running",O("generationReadingBrief")):d==="completed"?(Ft("brief","done"),Ft("spine","running",O("generationWritingClaims"))):d==="research"?Ft("proof","running",O("generationChoosingProof")):d==="round"&&Ft("spine","running",O("generationWritingClaims"))},onTextProgress:d=>Vb(d,l,o)},{sessionId:n?.id||void 0,appDataWorkspace:n?.project?.workspaceSubdir});n.id=s||n.id,B.agentSession={id:n.id||"",workspaceSubdir:n?.project?.workspaceSubdir||"",runId:n?.project?.runId||"",skillKey:ir},Et({title:O("generationParsingDeck"),detail:"",kind:"parsing"}),Lt(O("generationParsingDeck")),_o(c),await as(`agent:${e}`),Et({title:O("processEventDone"),detail:"",kind:"done"}),Ft("spine","done"),Ft("proof","done"),Ft("design","done"),Ft("compile","done",O("generationCompiled")),fc(O("deckReady")),a=!0,Mt(),await yt(!0)}finally{!Rn(i)&&(B.generation.active&&!a&&(B.generation.active=!1),Bn(!1)),Lr(B),Br(B)}}function bc(e,t){let r=Number(e?.slideNumber);return Number.isFinite(r)&&r>0?Math.round(r):t}function fh(e){return Array.isArray(e?.slidePlans)?e.slidePlans.filter(t=>t&&typeof t=="object"):[]}async function Rb(e,t,r=null){let n=null,i=null,a=[],o=[],l=[];for(let c=1;c<=sn;c+=1)try{let s=ss(c);c>1&&(Et({title:s.continuation?O("generationRecoveryContinuing",{stage:O("generationStagePlanning"),attempt:s.continuationAttempt,max:ln}):O("generationPlanRetry",{attempt:c,max:$t}),detail:l.join(" ")||gr(n),kind:"error"}),Lt(s.continuation?O("generationRecoveryContinuing",{stage:O("generationStagePlanning"),attempt:s.continuationAttempt,max:ln}):O("generationPlanRetry",{attempt:c,max:$t})),await new Promise(A=>setTimeout(A,cs(n,c))));let d=Ac("plan",c,n,l),u=await Ca({...uh(e,t),phase:"plan",title:B.title,outline:[],...l.length?{complianceIssues:l}:{},...c>1&&!d&&i?{continueAfterInterruption:!0}:{},...d?{completionRecovery:d}:{}},{onToolPhase:A=>{A==="detected"?Ft("brief","running",O("generationReadingBrief")):A==="completed"||A==="round"?(Ft("brief","done"),Ft("spine","running",O("generationWritingClaims"))):A==="research"&&Ft("proof","running",O("generationChoosingProof"))},onTextProgress:A=>{if(!A.includes('"slidePlans"'))return;let v=(A.match(/"slideNumber"/g)||[]).length;v>0?(Ft("proof","running",O("generationPlanProgress",{count:v})),Lt(O("generationPlanProgress",{count:v}))):Ft("proof","running",O("generationPlanningSlides"))}},{sessionId:i||void 0,appDataWorkspace:r?.workspaceSubdir,resultKind:r?"text":void 0});i=u.sessionId||i,a.push(...u.toolTrace||[]);let p=r?await Sb(r):u.payload;if(r&&!p)throw new Error("PPT Live plan turn finished without a valid project.json");if(l=ch(a,dn()),l.length){let A=new Error(`PPT Live planning compliance failed: ${l.join(" ")}`);throw A.pptLivePlanCompliance=!0,A.pptLiveSessionId=u.sessionId||i||null,A}let f=yb(p,t),h=fh(f);if(!h.length)throw new Error("PPT Live plan phase returned no slidePlans");return await bb(r,f),{payload:f,slidePlans:h,sessionId:u.sessionId||i||null,project:r}}catch(s){if(n=s,o.push(s),Array.isArray(s?.pptLiveToolTrace)&&a.push(...s.pptLiveToolTrace),ds(s)?i=null:s?.pptLiveSessionId&&(i=s.pptLiveSessionId),!ls(s))throw s;if(c>=sn)throw gc("generationStagePlanning",s,o);at().log?.warn?.("PPT Live plan phase failed, retrying",{attempt:c,maxAttempts:sn,continueInSession:!!i,error:String(s)})}throw n}async function ac({operation:e,planContext:t,slidePlan:r,slideNumber:n,session:i,project:a,html:o}){let l=o,c=2;if(ih(n,l))return{html:l,quality:{score:100,issues:[]}};for(let s=0;s<=c;s+=1){let d=await Ad(l);if(d.valid)return pb(n,l),{html:l,quality:{score:100,issues:[]}};if(s>=c)throw new Error(`PPT Live slide ${n} failed editable-PPTX validation: ${d.issues.map(p=>p.message).join(" ")}`);Et({title:O("generationSlideRepair",{slide:n,attempt:s+1,max:c}),detail:mr(d.issues.map(p=>p.message).join(" "),260),kind:"error"});let u=await Ca({operation:e,locale:lr(),phase:"repair",assignedSlide:r,validationIssues:d.issues,generationContract:ts(t),design:es(t),style:$o(t)},{},{sessionId:i?.id||void 0,appDataWorkspace:a?.workspaceSubdir,resultKind:"text"});if(i&&u.sessionId&&(i.id=u.sessionId),l=await rs(a,n),!l)throw new Error(`PPT Live repair turn did not rewrite slide ${n}`)}throw new Error(`PPT Live slide ${n} validation did not finish`)}async function Lb({operation:e,planContext:t,slidePlan:r,slideNumber:n,session:i,project:a}){let o=null,l=[],c=(s,d={score:100,issues:[]})=>({...r,html:s,quality:d,id:`ppt-live-slide-${n}`,slideNumber:n});for(let s=1;s<=sn;s+=1)try{let d=ss(s);if(s>1){if(a){let b=await rs(a,n);if(b){let x=await ac({operation:e,planContext:t,slidePlan:r,slideNumber:n,session:i,project:a,html:b});return c(x.html,x.quality)}}Et({title:d.continuation?O("generationRecoveryContinuing",{stage:O("generationStageSlide",{slide:n}),attempt:d.continuationAttempt,max:ln}):O("generationSlideRetry",{slide:n,attempt:s,max:$t}),detail:gr(o),kind:"error"}),Lt(d.continuation?O("generationRecoveryContinuing",{stage:O("generationStageSlide",{slide:n}),attempt:d.continuationAttempt,max:ln}):O("generationSlideRetry",{slide:n,attempt:s,max:$t})),await new Promise(b=>setTimeout(b,cs(o,s)))}let u=Ac("slides",s,o,o?[gr(o)]:[]),f=!!i?.id?{operation:e,locale:lr(),phase:"slides",inSession:!0,assignedSlides:[r],generationContract:ts(t),design:es(t),style:$o(t),showcaseSlideNumbers:t.showcaseSlideNumbers,...s>1&&!u?{continueAfterInterruption:!0}:{},...u?{completionRecovery:u}:{}}:{...Db(e),phase:"slides",plan:{...t,style:$o(t),design:es(t),generationContract:ts(t)},assignedSlides:[r],...u?{completionRecovery:u}:{}},h=await Ca(f,{},{sessionId:i?.id||void 0,appDataWorkspace:a?.workspaceSubdir,resultKind:a?"text":void 0});i&&h.sessionId&&(i.id=h.sessionId);let{payload:A}=h;if(a){let b=await rs(a,n);if(!b)throw new Error(`PPT Live slide ${n} file is missing or incomplete`);let x=await ac({operation:e,planContext:t,slidePlan:r,slideNumber:n,session:i,project:a,html:b});return c(x.html,x.quality)}let v=Array.isArray(A?.slides)?A.slides:[],g=v.find(b=>bc(b,NaN)===n)||v[0];if(!g||typeof g!="object"||!String(g.html||"").trim())throw new Error(`PPT Live slide ${n} is missing complete HTML`);return{...g,id:g.id||`ppt-live-slide-${n}`,slideNumber:n}}catch(d){if(o=d,l.push(d),i&&ds(d)&&(i.id=null,at().log?.warn?.("PPT Live planning session lost, falling back to standalone render turns",{slide:n})),!ls(d))throw d;if(s>=sn)throw gc("generationStageSlide",d,l,{slide:n});at().log?.warn?.("PPT Live slide render failed, retrying page",{slide:n,attempt:s,maxAttempts:sn,continueInSession:!!i?.id,error:String(d)})}throw o}async function Bb({operation:e,planContext:t,slidePlans:r,session:n,project:i}){let a=!1,o=null,l=null,c=[],s=[];for(let p=1;p<=sn;p+=1)try{let f=ss(p);if(p>1){let S=f.continuation?O("generationRecoveryContinuing",{stage:O("generationStageAudit"),attempt:f.continuationAttempt,max:ln}):O("generationAuditRetry",{attempt:p,max:$t});Et({title:S,detail:c.join(" ")||gr(o),kind:"error"}),Lt(S),await new Promise(F=>setTimeout(F,cs(o,p)))}let h=Ac("audit",p,o,c),A=await Ca({operation:e,locale:lr(),phase:"audit",inSession:!!n?.id,generationContract:ts(t),design:es(t),style:$o(t),slideOrder:t.slideOrder,slidePlans:r,...c.length?{auditIssues:c}:{},...h?{completionRecovery:h}:{}},{},{sessionId:n?.id||void 0,appDataWorkspace:i?.workspaceSubdir,resultKind:"text"});if(n&&A.sessionId&&(n.id=A.sessionId),!n?.id){let S=ch(A.toolTrace,t.style);if(S.length)throw new Error(`PPT Live final audit compliance failed: ${S.join(" ")}`)}let v=await xb(i,"quality-report.json");l=v.value;let g=new Set(Array.isArray(l?.checkedSlides)?l.checkedSlides.map(String):[]),b=(t.slideOrder||[]).map(String).filter(S=>!g.has(S)),x=[];if(v.status!=="valid"?x.push(v.reason):l?.status!=="passed"&&x.push(`quality-report.json status is "${String(l?.status||"missing")}", not "passed".`),b.length&&x.push(`quality-report.json did not confirm these slide ids: ${b.join(", ")}.`),x.length){x.push(...Pb(A.toolTrace));let S=Fb(A.completion);S&&x.push(S);let F=mr(A.text||"",180);F&&x.push(`Agent reply: ${F}`);let N=new Error(`PPT Live final audit verification failed: ${x.join(" ")}`);throw N.pptLiveAuditIssues=x,N}a=!0;break}catch(f){if(o=f,s.push(f),c=Array.isArray(f?.pptLiveAuditIssues)?f.pptLiveAuditIssues:[gr(f)].filter(Boolean),n&&ds(f)&&(n.id=null),!ls(f))throw f;if(p>=sn)throw gc("generationStageAudit",f,s);at().log?.warn?.("PPT Live final deck audit failed, retrying",{attempt:p,maxAttempts:sn,continueInSession:!!n?.id,error:String(f)})}if(!a)throw o||new Error("PPT Live final audit did not finish");let d=new Set(Array.isArray(l?.fixedSlides)?l.fixedSlides.map(String):[]),u=[];for(let p of r){let f=p.slideNumber,h=await rs(i,f);if(!h)throw new Error(`PPT Live final audit lost slide ${f}`);let A=Ab(p,f);if(!d.has(A)&&ih(f,h)){u.push({...p,id:`ppt-live-slide-${f}`,slideNumber:f,html:h,quality:{score:100,issues:[]}});continue}let v=await ac({operation:e,planContext:t,slidePlan:p,slideNumber:f,session:n,project:i,html:h});u.push({...p,id:`ppt-live-slide-${f}`,slideNumber:f,html:v.html,quality:v.quality})}return u}async function Nb(e,t){let r=Nn;Bn(!0,O("working")),Sa(),Ft("brief","running",O("generationReadingBrief")),Et({title:O("processEventStarted"),detail:O("processEventWaiting"),kind:"start"}),Et({title:O("generationPlanPhase"),detail:"",kind:"phase"}),hh(e,t);let n=!1,i=ah()?oh():null;i&&(rh(i.runId),await dh(i.runId));try{let{payload:a,slidePlans:o,sessionId:l}=await Rb(e,t,i);if(Rn(r))throw new Error("Generation stopped");Ft("brief","done"),Ft("spine","done"),Ft("proof","done"),Ft("design","running",O("generationDesigningLayouts")),B.generation.slideTarget=o.length,B.generation.draftedCount=0,Et({title:O("generationPlanReady",{count:o.length}),detail:mr(zf(a).join(" / "),200),kind:"phase"}),a.title&&(B.title=String(a.title),Mt());let c={id:l||null};B.agentSession={id:c.id||"",workspaceSubdir:i?.workspaceSubdir||"",runId:i?.runId||"",skillKey:ir};let s={title:a.title||"",language:a.language||"",outline:a.outline||[],researchReport:a.researchReport||"",design:a.design||{},style:a.style||dn(),generationContract:a.generationContract||{},showcaseSlideNumbers:a.showcaseSlideNumbers||[],slideOrder:a.slide_order||[]},d=o.map((v,g)=>({...v,slideNumber:bc(v,g+1)})),u=new Set(s.showcaseSlideNumbers),p=[...d.filter(v=>u.has(v.slideNumber)),...d.filter(v=>!u.has(v.slideNumber))];Et({title:O("generationSlidesPhase",{count:d.length}),detail:"",kind:"phase"});let f=[];for(let v of p){if(Rn(r))throw new Error("Generation stopped");let g=v.slideNumber;Ft("design","running",O("generationRenderingSlide",{slide:g,total:d.length})),Lt(O("generationRenderingSlide",{slide:g,total:d.length}));try{let x=await Lb({operation:e,planContext:s,slidePlan:v,slideNumber:g,session:c,project:i});f.push(x)}catch(x){if(!f.length)throw x;let S=[...f].sort((D,T)=>D.slideNumber-T.slideNumber);_o({title:a.title,language:a.language,outline:[],researchReport:a.researchReport,design:a.design,slides:S}),B.activeSlideId=B.slides[B.slides.length-1]?.id||B.activeSlideId,B.selectedElementId="",Mt(),await yt(!0);let F=new Set(f.map(D=>D.slideNumber)),N=d.filter(D=>!F.has(D.slideNumber)).map(D=>D.slideNumber),L=new Error(O("generationPartialDeck",{missing:N.join(", ")}));throw L.pptLivePartialDeck=!0,L.cause=x,x?.pptLiveRecoveryExhausted&&(L.pptLiveRecoveryExhausted=x.pptLiveRecoveryExhausted),L}B.generation.draftedCount=f.length,Ft("design","running",O("generationSlideReady",{slide:g,total:d.length})),Et({title:O("generationSlideReady",{slide:g,total:d.length}),detail:"",kind:"slide"});let b=[...f].sort((x,S)=>x.slideNumber-S.slideNumber);_o({title:a.title,language:a.language,outline:b.map(x=>x.title||""),researchReport:a.researchReport,design:a.design,slides:b}),B.activeSlideId=`ppt-live-slide-${g}`,B.selectedElementId="",Mt()}let A=[...f].sort((v,g)=>v.slideNumber-g.slideNumber);fb&&(Et({title:O("generationAuditPhase"),detail:"",kind:"phase"}),Ft("design","running",O("generationAuditPhase")),Lt(O("generationAuditPhase")),A=await Bb({operation:e,planContext:s,slidePlans:d,session:c,project:i})),B.agentSession.id=c.id||B.agentSession.id,Et({title:O("generationParsingDeck"),detail:"",kind:"parsing"}),Lt(O("generationParsingDeck")),_o({title:a.title,language:a.language,outline:zf(a),researchReport:a.researchReport,design:a.design,slides:A}),await as(`agent:${e}`),Et({title:O("processEventDone"),detail:"",kind:"done"}),Ft("design","done"),Ft("compile","done",O("generationCompiled")),fc(O("deckReady")),n=!0,Mt(),await yt(!0)}finally{!Rn(r)&&(B.generation.active&&!n&&(B.generation.active=!1),Bn(!1)),Lr(B),Br(B)}}function hh(e,t){Lt(O("generationAgentWorking")),Et({title:O("generationAgentWorking"),detail:mr(t||""),kind:"start"}),e==="auto"&&(dc()||os())&&(B.title=O("agentWorkingTitle")),Mt()}var Ib=new Set(["ParamsPartial","Queued","Waiting","Progress","Streaming","StreamChunk","Confirmed","Rejected"]);function ph(e){let t=String(e||"").trim();return t?/^skill$/i.test(t)?O("eventToolSkillName"):/^websearch$/i.test(t)?O("eventToolWebSearchName"):/^webfetch$/i.test(t)?O("eventToolWebFetchName"):t:O("eventUnknownTool")}function Mb(e,t){let r=wc(e),n=r.event_type||r.eventType||"";if(Ib.has(n)||n==="Started"||n==="EarlyDetected")return!1;let i=String(r.tool_name||r.toolName||"tool").toLowerCase(),a=r.params&&typeof r.params=="object"?r.params:{},o=String(a.file_path||a.path||a.command||"").trim(),l=o?`${i}:${o}:${n}`:`${i}:${n}`;return t.has(l)?!1:(t.add(l),n==="Completed"||n==="Failed"||n==="Cancelled"||n==="ConfirmationNeeded")}function zb(){let e=0,t="";return{get lastProgressLogAt(){return e},touch(){e=Date.now()},note(r,n="",i="phase",a=0){let o=Date.now(),l=r===t;return a>0&&l&&o-e0&&(B.generation.draftedCount=r),Lr(B),Br(B)}function Vb(e,t,r){let n=Ob(e),i=Ub(n);Ft(n,"running",i),jb(e,n),t.touch()}function Xb(e){let t=wc(e.toolEvent||{}),r=t.event_type||t.eventType||"ToolEvent",n=ph(t.tool_name||t.toolName),i={EarlyDetected:O("eventToolDetected"),ParamsPartial:O("eventToolParams"),Queued:O("eventToolQueued"),Waiting:O("eventToolWaiting"),Started:O("eventToolStarted"),Progress:O("eventToolProgress"),Streaming:O("eventToolStreaming"),StreamChunk:O("eventToolStreamChunk"),ConfirmationNeeded:O("eventToolConfirmation"),Confirmed:O("eventToolConfirmed"),Rejected:O("eventToolRejected"),Completed:O("eventToolCompleted"),Failed:O("eventToolFailed"),Cancelled:O("eventToolCancelled")},a=new Set(["EarlyDetected","Started","Completed","Failed","Cancelled","ConfirmationNeeded"]);return{title:i[r]||O("processEventTool"),detail:a.has(r)?n:Hb(r,t),kind:r==="Failed"||r==="Cancelled"||r==="Rejected"?"error":"tool"}}function Hb(e,t){return e==="Failed"?mr(t.error||O("backendGenerationFailed")):e==="Completed"?"":e==="Progress"?mr(t.message||""):""}function wc(e){if(e.event_type||e.eventType||e.tool_name||e.toolName)return e;let r=["EarlyDetected","ParamsPartial","Queued","Waiting","Started","Progress","Streaming","StreamChunk","ConfirmationNeeded","Confirmed","Rejected","Completed","Failed","Cancelled"].find(i=>e&&Object.prototype.hasOwnProperty.call(e,i));return r?{...e[r]||{},event_type:r}:e||{}}function mr(e,t=180){let r=String(e||"").replace(/\s+/g," ").trim();return r?r.length>t?`${r.slice(0,t-1)}...`:r:""}function _b(e,t){if(!e||!t)return;Ln.some(n=>n.sessionId===e&&n.turnId===t)||Ln.push({sessionId:e,turnId:t})}function Kb(e,t){Ln=Ln.filter(r=>!(r.sessionId===e&&r.turnId===t))}function Rn(e){return e!==Nn}async function xc(){let e=[...Ln];Ln=[],!(!e.length||!at().backend?.cancel)&&await Promise.all(e.map(async t=>{try{await at().backend.cancel(t.sessionId,t.turnId)}catch(r){at().log?.warn?.("PPT Live backend cancel failed",{sessionId:t.sessionId,turnId:t.turnId,error:String(r)})}}))}async function Qb(e=!1,t={}){let r=Ln.length>0;Nn+=1,await xc(),B.generation.active=!1,B.generation.steps=B.generation.steps.map(n=>n.status==="running"?{...n,status:"error"}:n),!t.silent&&r&&(Lt(e?O("generationTimedOut"):O("generationStopped")),Et(e?O("generationTimedOut"):O("generationStopped"))),Bn(!1),Lr(B),Br(B),t.silent||await yt(!0)}async function Zb(e=!1){await Qb(e)}function _o(e){if($b(e)){e.researchReport&&Uf(e.researchReport),e.design?.palette&&typeof e.design.palette=="object"&&(B.deckPalette=e.design.palette);return}let t=e1(e);if(t.length)B.title=String(e.title||B.title||O("blankDeckTitle")),B.slides=t.map((r,n)=>Hr(r,n,{...B,slides:t})),B.outline=B.slides.map(r=>r.title),B.activeSlideId=B.slides[0]?.id||"",B.selectedElementId="";else{if(!Array.isArray(e?.slides)||e.slides.length===0)throw new Error("PPT Live deck payload has no slides");B.title=String(e.title||B.title||O("blankDeckTitle")),B.slides=e.slides.map((r,n)=>Hr({...r,html:r.html||r.sourceHtml||r.slideHtml||""},n,{...B,slides:e.slides})),B.outline=B.slides.map(r=>r.title),B.activeSlideId=B.slides[0]?.id||"",B.selectedElementId=B.slides[0]?.elements[0]?.id||""}Array.isArray(e.outline)&&e.outline.length&&(B.outline=e.outline.map(sh).filter(Boolean)),e.researchReport&&Uf(e.researchReport),e.design?.palette&&typeof e.design.palette=="object"&&(B.deckPalette=e.design.palette)}function Uf(e){B.sources={...B.sources,facts:e.verifiedFacts||B.sources?.facts||[],warnings:e.warnings||B.sources?.warnings||[],summary:e.summary||B.sources?.summary||"",fetchedAt:Date.now()}}function Yb(e){return Array.isArray(e?.deckPatch?.changes)?e.deckPatch.changes:Array.isArray(e?.patch?.changes)?e.patch.changes:Array.isArray(e?.changes)?e.changes:Array.isArray(e?.patches)?e.patches:[]}function Wf(e,t,r=0){let n=String(e?.slideId||e?.id||e?.targetSlideId||e?.targetId||"").trim();if(n){let o=t.findIndex(l=>l.id===n);if(o>=0)return o}let i=Number(e?.slideNumber??e?.pageNumber);if(Number.isFinite(i)&&i>0)return mt(Math.round(i)-1,0,Math.max(0,t.length-1));let a=Number(e?.slideIndex??e?.index??e?.targetSlideIndex);return Number.isFinite(a)?a>=t.length&&a-1>=0&&a-1a.id===r);if(i>=0)return i+1}let n=String(e?.beforeSlideId||"").trim();if(n){let i=t.findIndex(a=>a.id===n);if(i>=0)return i}return e?.afterSlideNumber?mt(Number(e.afterSlideNumber),0,t.length):e?.beforeSlideNumber?mt(Number(e.beforeSlideNumber)-1,0,t.length):e?.slideNumber?mt(Number(e.slideNumber)-1,0,t.length):e?.slideIndex!==void 0?mt(Number(e.slideIndex),0,t.length):Math.min(t.length,er(B)+1)}function Gf(e,t,r,n){let i=e?.slide||e?.replacement||e?.newSlide||e?.payload||e;if(!i||typeof i!="object")return null;let a={...t||{},...i,id:i.id||i.slideId||t?.id||yr("html-slide"),html:i.html||i.sourceHtml||i.slideHtml||t?.html||""};return Hr(a,r,{...B,slides:n})}function $b(e){let t=Yb(e);if(!t.length)return!1;let r=Xr(B.slides||[]),n=[],i=0;if(t.forEach(o=>{let l=String(o?.op||o?.operation||o?.type||"replace_slide").toLowerCase();if(l==="delete_slide"||l==="delete"||l==="remove_slide"||l==="remove"){if(!r.length)return;let u=Wf(o,r,er(B)),[p]=r.splice(u,1);p?.id&&n.push(p.id),i+=1;return}if(l==="insert_slide"||l==="insert"||l==="add_slide"||l==="add"){let u=Jb(o,r),p=Gf(o,null,u,r);if(!p)return;r.splice(u,0,p),n.push(p.id),i+=1;return}let c=Wf(o,r,er(B)),s=r[c],d=Gf(o,s,c,r);d&&(r[c]=d,n.push(d.id),i+=1)}),!i)throw new Error("PPT Live deck patch had no applicable changes");B.title=String(e.deckPatch?.title||e.patch?.title||e.title||B.title||O("blankDeckTitle")),B.slides=r.map((o,l)=>Hr(o,l,{...B,slides:r})),B.outline=Array.isArray(e.outline)&&e.outline.length?e.outline.map(String):B.slides.map(o=>o.title);let a=n.find(o=>B.slides.some(l=>l.id===o));return B.activeSlideId=a||B.slides[Math.min(er(B),B.slides.length-1)]?.id||B.slides[0]?.id||"",B.selectedElementId=_t(B)?.elements?.[0]?.id||"",!0}function e1(e){let t=[];return Array.isArray(e?.htmlSlides)&&t.push(...e.htmlSlides),Array.isArray(e?.slides)&&t.push(...e.slides.filter(r=>r?.html||r?.sourceHtml||r?.slideHtml)),t.map((r,n)=>{let i=String(r?.html||r?.sourceHtml||r?.slideHtml||"").trim();return i?{id:r.id||r.slideId||yr("html-slide"),title:String(r.title||r.label||`${O("newSlideTitle")} ${n+1}`),subtitle:String(r.subtitle||""),kicker:String(r.kicker||""),claim:String(r.claim||r.title||""),proofObject:String(r.proofObject||""),supportNote:String(r.supportNote||""),sourceNote:String(r.sourceNote||""),notes:String(r.notes||""),layout:"html",theme:r.theme||{},html:i,elements:[]}:null}).filter(Boolean)}function qf(...e){for(let t of e){let r=String(t||"").trim();if(r)try{return ii(r),r}catch{}}return String(e.find(t=>String(t||"").trim())||"").trim()}async function t1(e,t,r,n=null,i={}){let a=at(),o=i.expectJson!==!1;if(!t||!r||!a.backend?.turnText)return e;let l=!1,c=Promise.resolve(e).finally(()=>{l=!0}),s=new Promise((d,u)=>{let p=Date.now(),f=300*1e3,h=10*1e3,A=3600*1e3,v=()=>Number(n?.lastEventAt||p);(async()=>{for(;!l&&Date.now()-pf)break;if(bsetTimeout(x,Math.min(1e3,h-b)));continue}try{let x=await a.backend.turnText(t,r),S=String(x?.text||"").trim();if(S){if(!o){d({answer:S,thinking:""});return}try{ii(S),d({answer:S,thinking:""});return}catch{}}}catch{}await new Promise(x=>setTimeout(x,2e3))}l||u(new Error("PPT Live backend did not publish a final deck JSON"))})()});return Promise.race([c,s])}async function r1(e,t,r,n=""){let i=Date.now(),a=25e3,o=String(r||"").trim(),l=String(n||"").trim(),s=qf(o,l,`${o} -${l}`.trim());if(s)try{return ii(s),s}catch{}let d=at();if(!e||!t||!d.backend?.turnText){if(!s)throw new Error("PPT Live backend produced no text");return s}let u=0;for(;Date.now()-i{setTimeout(()=>A(new Error("turnText timeout")),4e3)})]),f=String(p?.text||"").trim();if(s=qf(f,s,l,o),s)return ii(s),s}catch{}await new Promise(p=>setTimeout(p,500))}if(!s)throw new Error("PPT Live backend produced no text");return s}function ii(e){let t=String(e||"").trim();if(!t)throw new Error("PPT Live backend produced no text");try{return JSON.parse(t)}catch{let r=t.match(/```(?:json)?\s*([\s\S]*?)```/i);if(r)return JSON.parse(r[1]);let n=t.indexOf("{"),i=t.lastIndexOf("}");if(n>=0&&i>n)return JSON.parse(t.slice(n,i+1));throw new Error("PPT Live backend returned invalid JSON")}}function n1(e){let t=String(e?.message||e||"");return/ppt_live:\/\/round-budget-exhausted|exhausted its \d+-round tool budget|tool budget before producing deck JSON/i.test(t)}function i1(e){return String(e||"").includes("timed out")}function us(e){let t=String(e||"");return t.includes("dialog-turn-cancelled")||t.includes("Generation stopped")}async function a1(e,t={}){let r=In();t.readBrief!==!1&&cn({includeTopic:!r});let n=[e,$f()].filter(Boolean).join(": ");if(!n){Lt(O("promptRequired"));return}try{await yc("revise_slide",n,{includeTopic:!r})}catch(i){if(us(i))return;at().log?.warn?.("PPT Live backend slide revision failed",{action:e,error:String(i)}),hc(i),await yt(!0)}}async function qr(){if(cn({includeTopic:!In()}),(B.slides||[]).some(e=>String(e?.html||"").trim())){let e=`Restyle the existing deck without changing its facts or narrative. Apply these exact settings to every slide HTML: ${JSON.stringify(dn())}. Preserve each page's informationIntent and visualStrategy while making the deck visually coherent.`;try{await yc("revise_deck",e,{includeTopic:!1});return}catch(t){if(us(t))return;at().log?.warn?.("PPT Live Agent restyle failed",{error:String(t)}),hc(t),await yt(!0);return}}B.slides=B.slides.map((e,t)=>Hr({...e,theme:void 0},t,B)),Lt(O("deckRestyled")),Mt(),await yt(!0)}function oc(){cn({includeTopic:!In()});let e=new Map(B.slides.map(t=>[t.title,t]));B.slides=B.outline.map((t,r)=>{let n=e.get(t);return n?Hr(n,r,B):xs(t,r,B.outline.length,B)}),B.activeSlideId=B.slides[0]?.id||"",B.selectedElementId=B.slides[0]?.elements[0]?.id||"",Mt(),yt(!0)}async function o1(){Nn+=1,await as("before-new"),await xc(),B.generation.active=!1,Bn(!1),B=s1(),Sa(),Mt(),Lt(O("blankDeckReady")),await yt(!0)}function s1(){return Un(On())}function l1(e){if(!ys.includes(e))return;let t=_t(B);if(!t)return;let r=Ss({...La(e),x:10+t.elements.length%5*4,y:14+t.elements.length%5*4});t.elements.push(r),B.selectedElementId=r.id,Mt(),yt(!0)}function c1(){let e=_t(B);!e||!B.selectedElementId||(e.elements=e.elements.filter(t=>t.id!==B.selectedElementId),B.selectedElementId=e.elements[0]?.id||"",Mt(),yt(!0))}function jf(e){let t=e.elements.find(r=>r.type==="text"&&r.text);t&&(e.title=t.text.slice(0,90),B.outline[er(B)]=e.title,er(B)===0&&(B.title=e.title))}function Vf(){B.presentIndex=er(B),Ah(),xe("previewDialog")?.showModal()}function Ah(){let e=B.slides[B.presentIndex]||B.slides[0];xe("presentSlide")&&(xe("presentSlide").innerHTML=e?pn(e):""),xe("presentCounter")&&(xe("presentCounter").textContent=`${Math.max(1,B.presentIndex+1)} / ${Math.max(1,B.slides.length)}`),Gn()}function Xo(e){B.presentIndex=mt(B.presentIndex+e,0,B.slides.length-1),Ah()}function d1(){if(!(B.slides||[]).length)return Ri(O("exportDeckEmpty")),null;cn({includeTopic:!In()});let e=Yl(B);return Ri(O("exportSavedTo",{path:e})),e}function u1(){return cn({includeTopic:!In()}),(B.slides||[]).length?!0:(Ri(O("exportDeckEmpty")),!1)}function gh(e){return{html:{working:O("exportHtmlWorking"),done:O("exportHtmlDone"),failed:O("exportHtmlFailed")},pptx:{working:O("exportPptxWorking"),done:O("exportPptxDone"),failed:O("exportPptxFailed")},pdf:{working:O("exportPdfWorking"),done:O("exportPdfDone"),failed:O("exportPdfFailed")},png:{working:O("exportPngWorking"),done:O("exportPngDone"),failed:O("exportPngFailed")}}[e]||null}function sc(e,t,r){let n=gh(r==="pptx"?"pptx":r);if(!n||t<=0)return;let i=Math.min(t,Math.max(1,e+1));Qo("loading",`${n.working} (${i}/${t})`)}async function Xf(e,t){let r=at();if(!r?.deck?.renderPage)throw new Error("Host WebView export is unavailable in this runtime.");let n=[],i=e.length;for(let[a,o]of e.entries()){sc(a,i,t);let l=await r.deck.renderPage({html:zs(o),format:t,width:tr.width,height:tr.height});if(!l)throw new Error(`Host WebView returned empty ${t} for slide ${a+1}`);n.push({index:a,base64:String(l).replace(/^data:.*;base64,/,"")})}return n}async function f1(e){if(e==="html"){cn({includeTopic:!In()});let o=Yl(B);if(!o)throw new Error(O("exportDeckEmpty"));return{filename:o}}let t=B.slides||[];if(!t.length)throw new Error(O("exportDeckEmpty"));let r,n=Xr(B);if(e==="pptx")if(t.some(o=>o?.html)){let o=at(),l=typeof o?.deck?.renderPage=="function"?async(s,d)=>{sc(d,t.length,"pptx");let u=await o.deck.renderPage({html:s,format:"png",width:tr.width,height:tr.height});return String(u||"").replace(/^data:.*;base64,/,"")}:null,c=await gd(t,{renderRaster:l,onRasterProgress:s=>sc(s,t.length,"pptx")});r=await Kl(n,c)}else r=await _l(n);else if(e==="pdf"){let o=await Xf(t,"pdf");r=await Ql(n,o.map(l=>l.base64))}else if(e==="png"){let o=await Xf(t,"png");r=await Zl(n,o)}else throw new Error(O("exportFormatUnavailable"));let i=typeof r?.base64=="string"?r.base64.replace(/^data:.*;base64,/,""):"";if(!i)throw new Error(`export${e} returned no data`);let a=r.filename||`${Jl(B.title||"ppt-live")}`;return Df(i,a,r.mimeType||"application/octet-stream"),{filename:a}}var Ko=!1,Jt={updateOutline(e,t){B.outline[e]=t,B.slides[e]&&(B.slides[e].title=t),Mt(),yt(!0)},moveOutline(e,t){let r=e+t;r<0||r>=B.outline.length||([B.outline[e],B.outline[r]]=[B.outline[r],B.outline[e]],oc())},removeOutline(e){B.outline.length<=1||(B.outline.splice(e,1),oc())},selectSlide(e){B.activeSlideId=e,B.selectedElementId=_t(B)?.elements[0]?.id||"",Mt(),yt(!0)},selectElement(e){B.selectedElementId=e,hn(B,Jt),qa(B,Jt),yt(!0)},updateElementTextDirect(e,t){let r=_t(B),n=r?.elements.find(i=>i.id===e);n&&(n.text=String(t||"").trim(),jf(r),qn(B,Jt),renderOutline(B,Jt),yt(!1))},updateElementListItemDirect(e,t,r){let i=_t(B)?.elements.find(a=>a.id===e);!i||!Array.isArray(i.items)||(i.items[t]=String(r||"").trim(),i.items=i.items.filter(Boolean),hn(B,Jt),qn(B,Jt),yt(!1))},updateSlideHtmlDirect(e,t){let r=B.slides.find(i=>i.id===e);if(!r)return;let n=String(t||"");r.html!==n&&(r.html=n,qn(B,Jt),yt(!1))},updateSlideNotes(e){let t=_t(B);t&&(t.notes=e),yt(!0)},updateSlideMethodology(){let e=_t(B);e&&(e.kicker=xe("slideKickerInput")?.value||e.kicker,e.claim=xe("slideClaimInput")?.value||e.claim,e.proofObject=xe("slideProofInput")?.value||e.proofObject,e.supportNote=xe("slideSupportInput")?.value||e.supportNote,e.sourceNote=xe("slideSourceInput")?.value||e.sourceNote,hn(B,Jt),qn(B,Jt),yt(!0))},updateElementFromInspector(){let e=_t(B),t=Wn(B);!e||!t||(t.text=xe("elementTextInput")?.value||"",t.items=(xe("elementItemsInput")?.value||"").split(` -`).map(r=>r.trim()).filter(Boolean),t.data=p1(xe("elementDataInput")?.value||""),t.x=mt(Number(xe("elementXInput")?.value??t.x),0,100),t.y=mt(Number(xe("elementYInput")?.value??t.y),0,100),t.w=mt(Number(xe("elementWInput")?.value??t.w),3,100),t.h=mt(Number(xe("elementHInput")?.value??t.h),3,100),t.style.fontSize=mt(Number(xe("elementFontInput")?.value??t.style.fontSize),8,88),t.style.fontWeight=mt(Number(xe("elementWeightInput")?.value??t.style.fontWeight),100,900),t.style.color=xe("elementColorInput")?.value||t.style.color,t.style.background=xe("elementBgInput")?.value||t.style.background,Jt.updateSlideMethodology(),e.notes=xe("slideNotesInput")?.value||e.notes,jf(e),hn(B,Jt),yt(!0))},beginDrag(e,t){if(e.button!==0)return;let n=_t(B)?.elements.find(a=>a.id===t);if(!n)return;B.selectedElementId=n.id;let i=xe("slideCanvas").getBoundingClientRect();Rr={resizing:e.target.classList.contains("resize-handle"),startX:e.clientX,startY:e.clientY,rect:i,start:{x:n.x,y:n.y,w:n.w,h:n.h}},e.currentTarget.setPointerCapture?.(e.pointerId),window.addEventListener("pointermove",mh),window.addEventListener("pointerup",h1,{once:!0})}};function mh(e){if(!Rr)return;let t=Wn(B);if(!t)return;let r=(e.clientX-Rr.startX)/Rr.rect.width*100,n=(e.clientY-Rr.startY)/Rr.rect.height*100;Rr.resizing?(t.w=mt(Rr.start.w+r,3,100-t.x),t.h=mt(Rr.start.h+n,3,100-t.y)):(t.x=mt(Rr.start.x+r,0,100-t.w),t.y=mt(Rr.start.y+n,0,100-t.h)),hn(B,Jt),qa(B,Jt)}function h1(){Rr=null,window.removeEventListener("pointermove",mh),yt(!0)}function p1(e){return e.split(` -`).map((t,r)=>{let[n,i]=t.split(":");return{label:(n||`Item ${r+1}`).trim(),value:Number(i||0)}}).filter(t=>t.label)}function A1(){let e=document.querySelector(".studio-shell");if(!e)return;let t=document.documentElement,r=Number(rc("pptLiveFilmstripWidth")||0),n=Number(rc("pptLiveAgentWidth")||0);r>=128&&r<=360&&t.style.setProperty("--filmstrip-width",`${r}px`),n>=240&&n<=460&&t.style.setProperty("--agent-width",`${n}px`);let i=(a,o)=>{let l=e.getBoundingClientRect(),c=128,s=Math.min(360,l.width*.34),d=240,u=Math.min(460,l.width*.42),p=360,f=A=>{if(a==="filmstrip"){let v=Math.max(c,Math.min(s,A.clientX-l.left));if(l.width-v-parseFloat(getComputedStyle(t).getPropertyValue("--agent-width"))-12{e.classList.remove("is-resizing"),document.querySelectorAll(".panel-resizer.is-dragging").forEach(A=>A.classList.remove("is-dragging")),window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h),nc("pptLiveFilmstripWidth",String(parseFloat(getComputedStyle(t).getPropertyValue("--filmstrip-width"))||"")),nc("pptLiveAgentWidth",String(parseFloat(getComputedStyle(t).getPropertyValue("--agent-width"))||"")),Gn()};e.classList.add("is-resizing"),window.addEventListener("pointermove",f),window.addEventListener("pointerup",h,{once:!0}),window.addEventListener("pointercancel",h,{once:!0}),f({clientX:o})};xe("filmstripResizer")?.addEventListener("pointerdown",a=>{a.button===0&&(a.preventDefault(),a.currentTarget.classList.add("is-dragging"),i("filmstrip",a.clientX))}),xe("agentResizer")?.addEventListener("pointerdown",a=>{a.button===0&&(a.preventDefault(),a.currentTarget.classList.add("is-dragging"),i("agent",a.clientX))})}function g1(){let e=null,t=()=>{e&&clearTimeout(e),e=setTimeout(()=>{Gn()},60)};window.addEventListener("resize",t),xe("toggleHistory")?.addEventListener("click",()=>{let r=xe("historyDrawer");r&&(r.hidden=!r.hidden)}),xe("closeHistory")?.addEventListener("click",()=>{let r=xe("historyDrawer");r&&(r.hidden=!0)}),document.querySelectorAll("[data-sidebar-tab]").forEach(r=>{r.addEventListener("click",()=>{let n=r.dataset.sidebarTab;document.querySelectorAll("[data-sidebar-tab]").forEach(i=>{i.classList.toggle("is-active",i.dataset.sidebarTab===n)}),document.querySelectorAll("[data-sidebar-panel]").forEach(i=>{i.classList.toggle("is-active",i.dataset.sidebarPanel===n)})})}),xe("topicInput")?.addEventListener("input",()=>{if(In()){B.promptDraft=xe("topicInput")?.value||"",yt(!0);return}cn({includeTopic:!0}),yt(!0)}),xe("newDeck")?.addEventListener("click",()=>{o1()}),xe("cancelGeneration")?.addEventListener("click",()=>{Zb(!1)}),xe("sendPrompt")?.addEventListener("click",()=>{uc()}),xe("generateOutline")?.addEventListener("click",()=>{ab()}),xe("generateDeck")?.addEventListener("click",()=>{ob()}),xe("addOutlineItem")?.addEventListener("click",()=>{B.outline.push(O("newSlideTitle")),Mt(),yt(!0)}),xe("syncSlidesFromOutline")?.addEventListener("click",oc),xe("deleteElement")?.addEventListener("click",c1),xe("previewDeck")?.addEventListener("click",Vf),xe("closePreview")?.addEventListener("click",()=>xe("previewDialog")?.close()),xe("prevPresent")?.addEventListener("click",()=>Xo(-1)),xe("nextPresent")?.addEventListener("click",()=>Xo(1)),xe("exportHtml")?.addEventListener("click",d1),xe("restyleDeck")?.addEventListener("click",qr),document.querySelectorAll("[data-add-element]").forEach(r=>{r.addEventListener("click",()=>l1(r.dataset.addElement))}),document.querySelectorAll(".ai-action").forEach(r=>{r.addEventListener("click",()=>{a1(r.dataset.action)})}),document.querySelectorAll(".segment").forEach(r=>{r.addEventListener("click",()=>{B.mode=r.dataset.mode,B.mode==="present"&&Vf(),Mt(),yt(!0)})}),document.addEventListener("keydown",r=>{xe("previewDialog")?.open&&((r.key==="ArrowRight"||r.key==="PageDown")&&Xo(1),(r.key==="ArrowLeft"||r.key==="PageUp")&&Xo(-1),r.key==="Escape"&&xe("previewDialog")?.close())});try{A1()}catch(r){at().log?.warn?.("Failed to bind PPT Live panel resizers",{error:String(r)})}if(typeof ResizeObserver<"u"){let r=[document.querySelector(".ppt-live"),document.querySelector(".studio-shell"),document.querySelector(".stage-shell"),document.querySelector(".canvas-area")].filter(Boolean),n=new ResizeObserver(t);r.forEach(i=>n.observe(i))}y1(),b1(),w1(),P1(),T1()}var an=1,Ei=.25,m1=.25,v1=2;function ba(e){an=mt(e,m1,v1);let t=document.querySelector(".canvas-stage");t&&(t.style.transform=an===1?"":`scale(${an})`);let r=xe("zoomValue"),n=xe("statusZoomValue"),i=Math.round(an*100)+"%";r&&(r.textContent=i),n&&(n.textContent=i)}function y1(){xe("zoomIn")?.addEventListener("click",()=>ba(an+Ei)),xe("zoomOut")?.addEventListener("click",()=>ba(an-Ei)),xe("statusZoomIn")?.addEventListener("click",()=>ba(an+Ei)),xe("statusZoomOut")?.addEventListener("click",()=>ba(an-Ei)),document.querySelector(".canvas-area")?.addEventListener("wheel",e=>{if(e.ctrlKey||e.metaKey){e.preventDefault();let t=e.deltaY>0?-Ei:Ei;ba(an+t)}},{passive:!1})}function b1(){xe("floatingToolbar")&&document.querySelectorAll(".floating-toolbar-btn").forEach(t=>{t.addEventListener("click",()=>{let r=t.dataset.tool;if(!r)return;let n=_t(B),i=Wn(B);if(!(!n||!i)){switch(r){case"bold":i.fontWeight=i.fontWeight==="700"?"400":"700";break;case"italic":i.fontStyle=i.fontStyle==="italic"?"normal":"italic";break;case"underline":i.textDecoration=i.textDecoration==="underline"?"none":"underline";break;case"align-left":i.align="left";break;case"align-center":i.align="center";break;case"align-right":i.align="right";break;case"duplicate":n.elements.push({...Xr(i),id:yr("el"),x:i.x+5,y:i.y+5});break;case"delete":n.elements=n.elements.filter(a=>a.id!==i.id),B.selectedElementId=null;break}hn(B,Jt),qn(B,Jt),yt(!0)}})})}function w1(){document.querySelectorAll(".property-section__header").forEach(n=>{let i=n.closest(".property-section");if(!i)return;let a=()=>{i.classList.toggle("is-collapsed");let o=!i.classList.contains("is-collapsed");n.setAttribute("aria-expanded",String(o))};n.addEventListener("click",a),n.addEventListener("keydown",o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),a())})});let e=xe("densitySlider"),t=e?.querySelector(".density-slider__track");e&&t&&(t.addEventListener("pointerdown",n=>{n.preventDefault(),ri(Mf(n.clientX,t),{save:!1}),t.setPointerCapture(n.pointerId)}),t.addEventListener("pointermove",n=>{t.hasPointerCapture(n.pointerId)&&ri(Mf(n.clientX,t),{save:!1})}),t.addEventListener("pointerup",n=>{t.hasPointerCapture(n.pointerId)&&(t.releasePointerCapture(n.pointerId),qr())}),t.addEventListener("pointercancel",n=>{t.hasPointerCapture(n.pointerId)&&(t.releasePointerCapture(n.pointerId),yt(!0))}),e.querySelectorAll("[data-density-index]").forEach(n=>{n.addEventListener("click",i=>{i.stopPropagation(),ri(n.dataset.densityIndex),qr()})}),e.addEventListener("keydown",n=>{let i=Ea(B.style.density);n.key==="ArrowLeft"||n.key==="ArrowDown"?(n.preventDefault(),ri(i-1),qr()):n.key==="ArrowRight"||n.key==="ArrowUp"?(n.preventDefault(),ri(i+1),qr()):n.key==="Home"?(n.preventDefault(),ri(0),qr()):n.key==="End"&&(n.preventDefault(),ri(2),qr())})),document.querySelectorAll("[data-font-family]").forEach(n=>{n.addEventListener("click",()=>{B.style.fontFamily=n.dataset.fontFamily==="serif"?"serif":"sans",document.querySelectorAll("[data-font-family]").forEach(i=>{let a=i===n;i.classList.toggle("is-active",a),i.setAttribute("aria-pressed",a?"true":"false")}),qr(),yt(!0)})}),document.querySelectorAll("[data-color-mode]").forEach(n=>{n.addEventListener("click",()=>{B.style.colorMode=n.dataset.colorMode==="dark"?"dark":"light",document.querySelectorAll("[data-color-mode]").forEach(i=>{let a=i===n;i.classList.toggle("is-active",a),i.setAttribute("aria-pressed",a?"true":"false")}),qr()})});let r=xe("stylePresetSelect");r&&(wh(),qc(r),r.value=B.style?.stylePreset||un,Ni(r),r.addEventListener("change",()=>{let n=r.value;if(n){B.style.stylePreset=n;let i=ps(n);i&&(B.style.colorMode=i.colorMode||"light",B.style.fontFamily=i.fontFamily||"sans",B.style.density=i.density||"standard",document.querySelectorAll("[data-color-mode]").forEach(a=>{let o=a.dataset.colorMode===B.style.colorMode;a.classList.toggle("is-active",o),a.setAttribute("aria-pressed",o?"true":"false")}),document.querySelectorAll("[data-font-family]").forEach(a=>{let o=a.dataset.fontFamily===B.style.fontFamily;a.classList.toggle("is-active",o),a.setAttribute("aria-pressed",o?"true":"false")}),Oi(B.style.density)),qr(),yt(!0)}}))}var on=0;function vh(){return xe("formatGrid")?.querySelector(".format-card.is-selected")?.dataset.format||"pptx"}function x1(){let e=xe("exportOverlay");e&&(yh(),on=Math.max(0,er(B)),e.classList.add("is-visible"),e.setAttribute("aria-hidden","false"),S1(),ns(),requestAnimationFrame(()=>Li()))}function Li(){nd(xe("exportPreviewFrame"))}function yh(){let e=xe("exportModalFeedback"),t=xe("exportModalFeedbackText"),r=xe("exportModalSpinner");xe("exportOverlay")?.classList.remove("is-exporting"),e&&(e.hidden=!0,e.classList.remove("is-success","is-error")),t&&(t.textContent=""),r&&(r.hidden=!1),lc(!1)}function lc(e){["exportCancel","exportConfirm","closeExport"].forEach(t=>{let r=xe(t);r&&(r.disabled=e)}),xe("formatGrid")?.querySelectorAll(".format-card").forEach(t=>{t.tabIndex=e?-1:0,t.style.pointerEvents=e?"none":""}),["exportPreviewPrev","exportPreviewNext"].forEach(t=>{let r=xe(t);r&&(r.disabled=e)})}function Qo(e,t){let r=xe("exportModalFeedback"),n=xe("exportModalFeedbackText"),i=xe("exportModalSpinner");!r||!n||(r.hidden=!1,r.classList.toggle("is-success",e==="success"),r.classList.toggle("is-error",e==="error"),i&&(i.hidden=e!=="loading"),n.textContent=t)}function Zo(){let e=xe("exportOverlay");e&&(e.classList.remove("is-visible"),e.setAttribute("aria-hidden","true"),yh())}function S1(){let e=xe("formatGrid");if(!e)return;let t=[{id:"pptx",name:"PPTX",desc:"Editable PowerPoint"},{id:"pdf",name:"PDF",desc:"Universal format"},{id:"html",name:"HTML",desc:"Interactive web deck"},{id:"png",name:"PNG",desc:"Image sequence"}];e.innerHTML=t.map((r,n)=>` +${qo(e)} +\`\`\``+Dy(e)+jo(e)}function zy(e){let t;return e?.phase==="plan"?t=Ly(e):e?.phase==="slides"?t=e?.inSession?Ny(e):Iy(e):t=My(e),e?.completionRecovery?t=Ry(e.completionRecovery)+t:e?.continueAfterInterruption&&(t=Ey+t),t}function Oy(e){let t=!1,r=()=>{t||(t=!0,e.agent.onEvent(n=>{!n||typeof n!="object"||Py(n)}))};e.backend={protocol:"files",async call(n,a,i={}){if(n!=="ppt.generate")throw new Error(`Unsupported PPT Live action: ${n}`);r();let o=zy(a),l=await e.agent.run(o,{runId:i.idempotencyKey,sessionName:"PPT Live",sessionId:i.sessionId,appDataWorkspace:i.appDataWorkspace});if(!l?.sessionId||!l?.turnId)throw new Error("PPT Live agent backend did not return sessionId/turnId");return{sessionId:l.sessionId,turnId:l.turnId,actionRunId:l.actionRunId||l.turnId}},onEvent(n){ql.add(n)},offEvent(n){ql.delete(n)},async cancel(n,a){await e.agent.cancel(n,a)},async turnText(n,a){return{text:(await e.agent.turnText(n,a))?.text||""}},async cancelStaleRuns(){await e.agent.cancelStaleRuns()}}}function vf(e=window.app){!e||e.backend?.call||e.agent?.run&&Oy(e)}var L=Mn(),Pn=!1,Tr=null,Tn=[],Bn=0,Xo=!1,vi=!1,Jn=[],jl=0,xe=e=>document.getElementById(e),it=()=>window.app||{};vf(it());var zf=2500,Yo=new Map;function Vl(e){try{return localStorage.getItem(e)}catch{return Yo.has(e)?Yo.get(e):null}}function Xl(e,t){try{localStorage.setItem(e,t)}catch{Yo.set(e,t)}}var yi={get:async e=>JSON.parse(Vl(e)||"null"),set:async(e,t)=>Xl(e,JSON.stringify(t))};function Of(){let e=it();return e.storage?e.storage:yi}async function Uf(e){let t=Of();if(t===yi||!it().storage)return t.get(e);try{return await Promise.race([t.get(e),new Promise((r,n)=>setTimeout(()=>n(new Error("storage-timeout")),zf))])}catch(r){return it().log?.warn?.("Host storage read timed out, using local fallback",{key:e,error:String(r)}),yi.get(e)}}async function $o(e,t){let r=Of();if(r===yi||!it().storage){await r.set(e,t);return}try{await Promise.race([r.set(e,t),new Promise((n,a)=>setTimeout(()=>a(new Error("storage-timeout")),zf))])}catch(n){it().log?.warn?.("Host storage write timed out, using local fallback",{key:e,error:String(n)}),await yi.set(e,t)}}async function Uy(){try{Jn=await Wy();let e=await Uf(Ea);if(e){L=zn(e),Ql(L)&&(L=Mn(),await $o(Ea,{...L,updatedAt:Date.now()}));return}L=Mn(),await yt(!0)}catch(e){it().log?.warn?.("Failed to load PPT Live state",{error:String(e)}),L=Mn()}}async function yt(e=!1){L=zn(L),await $o(Ea,{...L,updatedAt:Date.now()}),await es(e?"autosave":"manual"),e||Mt(U("saved"))}async function Wy(){try{let e=await Uf(cs);return Array.isArray(e)?e.map(Wf).filter(Boolean).slice(0,40):[]}catch(e){return it().log?.warn?.("Failed to load PPT Live history",{error:String(e)}),[]}}async function es(e="autosave"){if(!L?.slides?.length||Ql(L))return;let t=Date.now();if(e==="autosave"&&jl&&t-jl<15e3)return;jl=t;let r=Wf({id:L.sessionId||gr("deck"),title:L.title||U("blankDeckTitle"),updatedAt:t,slideCount:L.slides.length,reason:e,prompt:L.promptDraft||L.brief?.topic||"",state:Vr({...L,generation:{...L.generation,active:!1}})});r&&(Jn=[r,...Jn.filter(n=>n.id!==r.id)].slice(0,40),await $o(cs,Jn),Gf())}function Ql(e){let t=Array.isArray(e?.slides)?e.slides:[];return t.length===1&&!t[0]?.html&&String(t[0]?.id||"").startsWith("agent-working-slide")&&String(e?.title||"")===U("agentWorkingTitle")&&!e?.generation?.active}function Wf(e){return!e?.id||!e?.state?null:{id:String(e.id),title:String(e.title||e.state?.title||U("blankDeckTitle")),updatedAt:Number(e.updatedAt||Date.now()),slideCount:Number(e.slideCount||e.state?.slides?.length||0),reason:String(e.reason||"autosave"),prompt:String(e.prompt||e.state?.brief?.topic||""),state:e.state}}function Gf(){let e=xe("historyList");if(e){if(e.innerHTML="",!Jn.length){let t=document.createElement("div");t.className="history-empty",t.textContent=U("historyEmpty"),e.append(t);return}Jn.slice(0,12).forEach(t=>{let r=document.createElement("button");r.type="button",r.className=`history-card${t.id===L.sessionId?" is-active":""}`,r.innerHTML=` + ${yf(t.title)} + ${U("historyMeta",{count:t.slideCount,time:qy(t.updatedAt)})} + ${t.prompt?`${yf(t.prompt)}`:""} + `,r.addEventListener("click",()=>{Gy(t.id)}),e.append(r)})}}async function Gy(e){let t=Jn.find(r=>r.id===e);t&&(Bn+=1,await cc(),L=zn(Vr(t.state)),L.generation.active=!1,bi(),It(),Mt(U("historyRestored")),await $o(Ea,{...L,updatedAt:Date.now()}))}function qy(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let r=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),a=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0");return`${r}/${n} ${a}:${i}`}function yf(e){return String(e??"").replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function Mt(e){let t=xe("statusLine");t&&(t.textContent=e)}function Pa(e){let t=xe("exportStatus");t&&(t.textContent=e)}function Dn(e,t){Pn=e,document.querySelector(".ppt-live")?.classList.toggle("is-busy",Pn),document.querySelectorAll("button, input, select, textarea").forEach(n=>{if(!["closePreview","prevPresent","nextPresent"].includes(n.id)){if(n.id==="cancelGeneration"){n.disabled=!Pn,n.hidden=!Pn;return}n.id!=="newDeck"&&(n.disabled=Pn)}});let r=xe("aiStatusPill");r&&(r.textContent=Pn?U("statusPillBusy"):U("statusPillReady"),r.classList.toggle("is-busy",Pn)),t&&Mt(t)}function Ft(e,t,r){L.generation.current=e,L.generation.steps=L.generation.steps.map(n=>({...n,status:n.id===e?t:n.status})),L.generation.active=t==="running"||L.generation.steps.some(n=>n.status==="running"),Er(L),Rr(L),r&&Mt(r)}function bi(){L.generation.active=!1,L.generation.current="idle",L.generation.draftedCount=0,L.generation.slideTarget=0,L.generation.eventSeq=0,L.generation.steps=L.generation.steps.map(e=>({...e,status:"pending"})),L.generation.events=[],Er(L),Rr(L)}function Nt(e,t="",r="info"){L.generation=Fi(L.generation||{});let n=typeof e=="string"?{title:e,detail:t,kind:r}:{...e||{}},a=Mr(n.title||n.label||n.message||U("processEventUnknown"),160),i=Mr(n.detail??t??"",260),o=String(n.kind||r||"info").toLowerCase().replace(/[^a-z0-9-]/g,"")||"info";if(!a&&!i)return;let l=Array.isArray(L.generation.events)?L.generation.events:[],c=l[l.length-1];if(c&&c.title===a&&c.detail===i&&c.kind===o)c.timestamp=Date.now(),L.generation.events=l;else{let s=l.reduce((u,h)=>Math.max(u,Number(h.seq)||0),0),d=Math.max(Number(L.generation.eventSeq)||0,s)+1;L.generation.eventSeq=d,L.generation.events=[...l,{id:gr("generation-event"),seq:d,title:a||U("processEventUnknown"),detail:i,kind:o,timestamp:Date.now()}].slice(-80)}Er(L),Rr(L)}function It(){L=zn(L),Oc(L,Jt),Gf()}function on(e={}){Xc(L,e),L=zn(L)}function qf(){return xe("topicInput")?.value.trim()||""}function Zl(){let e=bc().join(` +`);return!L.outline.length||L.outline.join(` +`)===e||L.title===U("defaultDeckTitle")||ts()}function ts(){let e=String(L.title||"").trim();return L.slides.length===1&&L.outline.length===1&&L.outline[0]===U("newSlideTitle")&&(e===U("blankDeckTitle")||e===U("newSlideTitle"))}function Ln(){return Array.isArray(L.slides)&&L.slides.length>0&&!Zl()&&!ts()&&!Ql(L)}async function jy(){await Yl()}async function Vy(){await Yl()}async function Yl(){if(Xo||vi)return;let e=qf();if(!e){Mt(U("promptRequired"));return}Xo=!0;let t=Ln();L.promptDraft=e,L.lastSubmittedPrompt=e,on({includeTopic:!t}),t||(L.brief.topic=e);try{await ic("auto",e,{includeTopic:!t});return}catch(r){if(rs(r))return;it().log?.warn?.("PPT Live backend generation failed",{error:String(r)}),$l(r),It(),await yt(!0)}finally{Xo=!1}}function Jl(e=U("deckReady")){L.generation.active=!1,L.generation.draftedCount=L.slides.length,L.generation.slideTarget=0,L.generation.steps=(L.generation.steps||[]).map(t=>({...t,status:t.status==="error"?"error":"done"})),Mt(e),Er(L),Rr(L)}function Xy(e=U("backendGenerationFailed"),t=""){L.generation.active=!1,L.generation.steps=(L.generation.steps||[]).map(r=>({...r,status:r.status==="done"?"done":"error"})),Mt(e),Nt({title:e,detail:t||U("agentOnlyRetryHint"),kind:"error"}),Dn(!1),Er(L),Rr(L)}function Hy(e,t=5){let r=[],n=new Set,a=e;for(let i=0;a&&i({kind:n.kind,title:n.title,url:n.url,text:String(n.text||"").slice(0,6e3)}))}:null);let r=Number(L.brief?.slideTarget)||0;return r>0&&(t.slideTarget=r),t}function sn({includePreset:e=!0}={}){let t=is(L.style?.stylePreset),r=L.style?.colorMode==="dark"?"dark":"light",n={fontFamily:L.style?.fontFamily==="serif"?"serif":"sans",density:In(L.style?.density),colorMode:r,theme:r,palette:uc(t,r)};return e&&(n.stylePreset=L.style?.stylePreset||ln),n}function bf(e={}){let t=sn();return{...e.style||{},...t}}function wf(e={}){let t=sn();return{...e.design||{},theme:t.colorMode==="dark"?"dark":"light",palette:{...e.design?.palette||{},...t.palette}}}function xf(e={}){let t=sn();return{...e.generationContract||{},userStyle:t}}function _y(e){let t=String(e||"").trim();if(!t)return"";try{let r=new DOMParser().parseFromString(t,"text/html");return r.querySelectorAll("style,script,svg").forEach(n=>n.remove()),Mr(r.body?.textContent||r.documentElement?.textContent||"",1800)}catch{return Mr(t.replace(/<[^>]+>/g," "),1800)}}function Ky(e){let t=new Set,r=String(e||""),n=$t(L);return/(当前|本页|这一页|此页|current\s+(slide|page)|this\s+(slide|page))/i.test(r)&&t.add(n),[/第\s*(\d{1,2})\s*(页|頁|张|張)/gi,/\b(?:slide|page)\s*(\d{1,2})\b/gi,/\b(\d{1,2})\s*(?:slide|slides|page|pages)\b/gi].forEach(i=>{let o=i.exec(r);for(;o;){let l=Number(o[1])-1;l>=0&&li-o)}function Qy(e){let t=Ky(e),r=$t(L),n=new Set(t.length?t:[r]);return{title:L.title,outline:Vr(L.outline||[]),slideCount:L.slides.length,activeSlideIndex:r,activeSlideId:L.slides[r]?.id||"",targetHints:t.map(a=>({slideIndex:a,slideNumber:a+1,slideId:L.slides[a]?.id||"",title:L.slides[a]?.title||""})),slides:L.slides.map((a,i)=>{let o=a.html?_y(a.html):Mr((a.elements||[]).flatMap(c=>[c.text,c.label,...Array.isArray(c.items)?c.items:[]]).filter(Boolean).join(` +`),1800),l={slideIndex:i,slideNumber:i+1,id:a.id,title:a.title,kicker:a.kicker,claim:a.claim,proofObject:a.proofObject,supportNote:a.supportNote,sourceNote:a.sourceNote,notes:a.notes,layout:a.layout,visibleText:o,hasHtml:!!a.html};return n.has(i)&&a.html&&(l.html=String(a.html).slice(0,12e3)),l})}}function Sf(e,t){let r=t.getBoundingClientRect(),n=mt((e-r.left)/r.width,0,1);return Math.round(n*2)}function Yn(e,{save:t=!0}={}){let r=mt(Math.round(Number(e)),0,2);L.style.density=vc(r),Ia(L.style.density),It(),t&&yt(!0)}var rr=4,Rn=8,Fa=rr+Rn,Zy=750;function tc(e){let t=e>rr;return{continuation:t,continuationAttempt:t?e-rr:0}}function jf(e,t,r,n=[]){let a=tc(t);return a.continuation?{stage:e,attempt:a.continuationAttempt,maxAttempts:Rn,previousFailure:En(r),issues:[...new Set((n||[]).map(String).filter(Boolean))]}:null}function Vf(e,t,r=[],n={}){let a=[...new Set(r.map(c=>En(c)).filter(Boolean))],o=En(t)||a.at(-1)||"The Agent did not produce the required artifact.",l=new Error(`PPT Live recovery exhausted after ${rr} stage attempts and ${Rn} continuation turns. Last verified reason: ${o}`,{cause:t||void 0});return l.pptLiveRecoveryExhausted={stageKey:e,stageVars:n,stepAttempts:rr,continuationAttempts:Rn,reasons:a},l}function rc(e){let t=String(e?.message||e||"");return!(rs(e)||/Generation stopped/i.test(t)||/backend is unavailable|did not return sessionId/i.test(t)||/permission|workspacePath is required|unsupported PPT Live action/i.test(t))}function nc(e,t){let r=String(e?.message||e||"");return/rate limit|network|timed? out|connection|temporar|overload|service unavailable|502|503|504/i.test(r)?Math.min(15e3,1e3*2**Math.min(Math.max(0,t-1),4)):Zy}function ac(e){return/Unknown MiniApp agent session|session workspace does not match/i.test(String(e?.message||e||""))}function Xf(){let e=it();return e.backend?.protocol==="files"&&!!e.appDataDir&&!!e.fs?.readFile}function Hf(){let e=`deck-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return{runId:e,workspaceSubdir:`decks/${e}`,dir:`${it().appDataDir}/decks/${e}`}}function Yy(){let e=String(L.agentSession?.workspaceSubdir||"");return!e||!it().appDataDir?null:{runId:String(L.agentSession?.runId||e.split("/").pop()||""),workspaceSubdir:e,dir:`${it().appDataDir}/${e}`}}function Jy(e){return`slides/slide-${String(e).padStart(2,"0")}.html`}var $y=["All visible text must be inside p, h1-h6, or li; DIV cannot contain direct text and span is inline-only.","CSS gradients are forbidden; use solid fills and discrete shapes.","Backgrounds, borders, and shadows belong on DIV shapes, never on text or inline elements.","DIV background-image is forbidden; use img. Inline text elements cannot carry box spacing or decorative fills.","Use a complete self-contained 960pt x 540pt document with no remote assets and no canvas overflow.","Text larger than 12px must keep at least a 36pt bottom safety margin."];function _f(e){return typeof e=="string"?e:String(e?.title||"")}function Cf(e){return Array.isArray(e?.outline)?e.outline.map(_f).filter(Boolean):[]}function Kf(e){let t=[...Ca];return e?.stylePreset&&t.push(`references/style-presets/${e.stylePreset}.md`),t}function eb(e,t){let r=Jf(e).map((c,s)=>({...c,slideNumber:sc(c,s+1),slideId:String(c?.slideId||`slide-${String(s+1).padStart(2,"0")}`)})),n=sn(),a=ec(),i=r.map(c=>({id:c.slideId,title:String(c.title||""),bullets:Array.isArray(c.bullets)?c.bullets.map(String):[],slide_id:c.slideId})),o=Array.isArray(e?.showcaseSlideNumbers)?e.showcaseSlideNumbers.map(Number):[],l=[...new Set(o)].filter(c=>Number.isInteger(c)&&c>=1&&c<=r.length).slice(0,2);if(r.length>=5&&l.length<2){for(let c of[1,Math.min(3,r.length),r.length])if(l.includes(c)||l.push(c),l.length===2)break}return{...e,outline:i,slide_order:i.map(c=>c.slide_id),style:n,design:{...e?.design||{},theme:n.colorMode==="dark"?"dark":"light",palette:{...e?.design?.palette||{},...n.palette}},assumptions:Array.isArray(e?.assumptions)?e.assumptions.map(String):(e?.researchReport?.assumptions||[]).map(String),generationContract:{...e?.generationContract||{},version:1,skillKey:pr,skillName:"ppt-design",requiredReferences:Kf(n),deliveryTarget:"editable-pptx",userPrompt:String(t||""),userBrief:a,userStyle:n,hardRules:$y,visualGrammar:{...e?.generationContract?.visualGrammar||{},...e?.design?.renderGuide||{}}},showcaseSlideNumbers:r.length>=5?l:[],slidePlans:r}}async function tb(e,t){let r=it().fs;!e||!r?.writeFile||await r.writeFile(`${e.dir}/project.json`,`${JSON.stringify(t,null,2)} +`)}async function Qf(e,t){let r=it().fs;if(!r?.readFile)throw new Error("PPT Live fs API is unavailable");return await r.readFile(`${e.dir}/${t}`)}async function rb(e,t){try{let r=String(await Qf(e,t)||"");return r.trim()?Da(r):null}catch{return null}}async function nb(e){return await rb(e,"project.json")}async function kf(e,t){try{let r=String(await Qf(e,Jy(t))||"").trim();return!r||!/<\/html>\s*$/i.test(r)?null:r}catch{return null}}function Pf(e){return e?.params&&typeof e.params=="object"?e.params:{}}function ab(e){let t=String(e||"").trim();return t===pr||t==="ppt-design"}function ib(e){if(!e||String(e.toolName||"").toLowerCase()!=="skill")return!1;let t=e.result||{};return!!(JSON.stringify(t).includes(pr)||t?.success===!0&&String(t?.skill_name||"").toLowerCase()==="ppt-design")}function ob(e,t){let r=(e||[]).filter(s=>s.eventType==="Started"),n=(e||[]).filter(s=>s.eventType==="Completed"),a=new Map(n.filter(s=>s.toolId).map(s=>[s.toolId,s])),i=[],o=r.filter(s=>String(s.toolName||"").toLowerCase()==="skill"&&ab(Pf(s).command)),l=o.some(s=>ib(a.get(s.toolId)));(!o.length||!l)&&i.push(`The exact built-in Skill key ${pr} was not successfully loaded.`);let c=r.filter(s=>String(s.toolName||"").toLowerCase()==="read"&&a.has(s.toolId)).map(s=>{let d=Pf(s);return String(d.file_path||d.path||"")});return Kf(t).forEach(s=>{c.some(d=>d.endsWith(s))||i.push(`Required reference was not read: ${s}`)}),i}async function Zf(e){let t=it().fs;if(!(!t?.readdir||!t?.rm))try{let r=`${it().appDataDir}/decks`,n=await t.readdir(r),a=(Array.isArray(n)?n:[]).map(i=>typeof i=="string"?i:i?.name).filter(i=>typeof i=="string"&&i.startsWith("deck-")&&i!==e);for(let i of a)await t.rm(`${r}/${i}`,{recursive:!0})}catch{}}async function ic(e,t,r={}){if(!it().backend?.call)throw new Error("PPT Live backend is unavailable");if(!vi){vi=!0;try{if(on({includeTopic:r.includeTopic!==!1}),e==="auto"&&(Zl()||ts())){await fb(e,t);return}await sb(e,t)}finally{vi=!1}}}async function sb(e,t){let r=null,n=Yy()||(Xf()?Hf():null);n&&!L.agentSession?.workspaceSubdir&&await Zf(n.runId);let a={id:L.agentSession?.id||null,project:n};for(let i=1;i<=rr;i+=1)try{await cb(e,t,i,a);return}catch(o){if(r=o,ac(o)?a.id=null:o?.pptLiveSessionId&&(a.id=o.pptLiveSessionId),!rc(o)||i>=rr)throw o;it().log?.warn?.("PPT Live backend attempt failed, retrying",{attempt:i,maxAttempts:rr,continueInSession:!!a.id,error:String(o)}),Nt({title:U("generationRetrying",{attempt:i+1,max:rr}),detail:En(o),kind:"error"}),Mt(U("generationRetrying",{attempt:i+1,max:rr})),await new Promise(l=>setTimeout(l,nc(o,i)))}if(r)throw r}async function oc(e,t={},r={}){let n=it(),a=Bn,i=null,o=null,l="",c="",s=!1,d=0,u=null,h=[],f=new Set,p=[],A=Ab(),y={lastEventAt:Date.now()};try{let g=await n.backend.call("ppt.generate",e,{entityId:"deck",idempotencyKey:`ppt-live-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,sessionId:r.sessionId||void 0,appDataWorkspace:r.appDataWorkspace||void 0});if(i=g?.sessionId||null,o=g?.turnId||g?.actionRunId||null,!i||!o)throw new Error("PPT Live backend did not return sessionId/turnId");if(kb(i,o),Fn(a))throw new Error("Generation stopped");let b=new Promise((T,G)=>{let V=q=>{if(q.sessionId!==i||q.turnId&&q.turnId!==o)return;y.lastEventAt=Date.now();let v=String(q.sourceEvent||"");if(v.endsWith("dialog-turn-started"))A.note(U("eventTurnStarted"),"","turn");else if(v.endsWith("model-round-started"))t.onToolPhase?.("round"),A.touch();else if(v.endsWith("model-round-completed"))A.touch();else if(v.endsWith("tool-event")){let M=lc(q.toolEvent||{}),ne=M.event_type||M.eventType||"";if(ne==="Started"?p.push({eventType:ne,toolId:M.tool_id||M.toolId||"",toolName:M.tool_name||M.toolName||"",params:M.params||{}}):ne==="Completed"?p.push({eventType:ne,toolId:M.tool_id||M.toolId||"",toolName:M.tool_name||M.toolName||"",result:M.result||{}}):(ne==="Failed"||ne==="Cancelled")&&p.push({eventType:ne,toolId:M.tool_id||M.toolId||"",toolName:M.tool_name||M.toolName||"",error:M.error||M.message||ne}),pb(M,f)&&(Nt(Sb(q)),A.touch()),ne==="EarlyDetected"||ne==="Started")t.onToolPhase?.("detected");else if(ne==="Completed"){let _=String(M.tool_name||M.toolName||"").trim().toLowerCase();t.onToolPhase?.("completed"),_==="skill"?A.note(U("eventToolSkillReady"),eh(M.tool_name||M.toolName),"phase"):(_==="websearch"||_==="webfetch")&&t.onToolPhase?.("research")}}else if(v.endsWith("text-chunk")){let M=String(q.text||"");if(q.contentType==="thinking")c+=M;else{l+=M,A.touch();let _=Date.now();_-d>=500&&(d=_,t.onTextProgress?.(l))}}else if(!v.endsWith("token-usage-updated")){if(v.endsWith("dialog-turn-completed"))s=!0,u={success:q.success,finishReason:q.finishReason||q.finish_reason||"",partialRecoveryReason:q.partialRecoveryReason||q.partial_recovery_reason||""},T({answer:l,thinking:c});else if(v.endsWith("dialog-turn-failed")||v.endsWith("dialog-turn-cancelled")){s=!0,l&&t.onTextProgress?.(l);let M=Mr(q.error||q.message||"");Nt({title:v.endsWith("dialog-turn-cancelled")?U("eventTurnCancelled"):U("eventTurnFailed"),detail:M,kind:"error"}),G(new Error(M||v))}}};n.backend.onEvent(V),h.push(()=>n.backend.offEvent?.(V));let C=setInterval(()=>{if(s||Date.now()-A.lastProgressLogAt<12e3)return;let v=(L.generation?.steps||[]).find(M=>M.status==="running");A.note(v?.label?`${v.label}\u2026`:U("generationProgressPulse"),v?.detail||"","pulse",0)},12e3);h.push(()=>clearInterval(C))}),x=r.resultKind!=="text",S=await Lb(b,i,o,y,{expectJson:x}),F=typeof S=="string"?S:S?.answer||"",I=typeof S=="string"?"":S?.thinking||"";if(Fn(a))throw new Error("Generation stopped");if(!x)return{payload:null,text:F,sessionId:i,toolTrace:p,completion:u};let B=await Nb(i,o,F,I);if(Fn(a))throw new Error("Generation stopped");let D=Da(B);if(Fn(a))throw new Error("Generation stopped");return{payload:D,sessionId:i,toolTrace:p,completion:u}}catch(g){if(g&&typeof g=="object"&&i&&(g.pptLiveSessionId=i,g.pptLiveToolTrace=p),!s&&i&&o&&n.backend?.cancel)try{await n.backend.cancel(i,o)}catch(b){it().log?.warn?.("PPT Live backend cancel after failure failed",{sessionId:i,turnId:o,error:String(b)})}throw g}finally{h.forEach(g=>g()),i&&o&&Pb(i,o)}}function Yf(e,t){return{operation:e,instruction:t,locale:Dr(),brief:ec(),style:sn()}}function lb(e){return{operation:e,locale:Dr(),brief:ec({includeEvidence:!1}),style:sn({includePreset:!1})}}async function cb(e,t,r=1,n={id:null}){let a=Bn;Dn(!0,U("working")),bi(),Ft("brief","running",U("generationReadingBrief")),Nt({title:U("processEventStarted"),detail:U("processEventWaiting"),kind:"start"}),r>1&&Nt({title:U("generationRetryAttempt",{attempt:r,max:rr}),detail:"",kind:"start"}),$f(e,t);let i=!1,o={value:""},l={touch:()=>{},note:()=>{},lastProgressLogAt:0};try{let{payload:c,sessionId:s}=await oc({...Yf(e,t),title:L.title,outline:Vr(L.outline),currentSlideIndex:$t(L),currentDeck:Qy(t),...n?.id?{continueAfterInterruption:!0}:{}},{onToolPhase:d=>{d==="detected"?Ft("brief","running",U("generationReadingBrief")):d==="completed"?(Ft("brief","done"),Ft("spine","running",U("generationWritingClaims"))):d==="research"?Ft("proof","running",U("generationChoosingProof")):d==="round"&&Ft("spine","running",U("generationWritingClaims"))},onTextProgress:d=>xb(d,l,o)},{sessionId:n?.id||void 0,appDataWorkspace:n?.project?.workspaceSubdir});n.id=s||n.id,L.agentSession={id:n.id||"",workspaceSubdir:n?.project?.workspaceSubdir||"",runId:n?.project?.runId||"",skillKey:pr},Nt({title:U("generationParsingDeck"),detail:"",kind:"parsing"}),Mt(U("generationParsingDeck")),Ho(c),await es(`agent:${e}`),Nt({title:U("processEventDone"),detail:"",kind:"done"}),Ft("spine","done"),Ft("proof","done"),Ft("design","done"),Ft("compile","done",U("generationCompiled")),Jl(U("deckReady")),i=!0,It(),await yt(!0)}finally{!Fn(a)&&(L.generation.active&&!i&&(L.generation.active=!1),Dn(!1)),Er(L),Rr(L)}}function sc(e,t){let r=Number(e?.slideNumber);return Number.isFinite(r)&&r>0?Math.round(r):t}function Jf(e){return Array.isArray(e?.slidePlans)?e.slidePlans.filter(t=>t&&typeof t=="object"):[]}async function db(e,t,r=null){let n=null,a=null,i=[],o=[],l=[];for(let c=1;c<=Fa;c+=1)try{let s=tc(c);c>1&&(Nt({title:s.continuation?U("generationRecoveryContinuing",{stage:U("generationStagePlanning"),attempt:s.continuationAttempt,max:Rn}):U("generationPlanRetry",{attempt:c,max:rr}),detail:l.join(" ")||En(n),kind:"error"}),Mt(s.continuation?U("generationRecoveryContinuing",{stage:U("generationStagePlanning"),attempt:s.continuationAttempt,max:Rn}):U("generationPlanRetry",{attempt:c,max:rr})),await new Promise(A=>setTimeout(A,nc(n,c))));let d=jf("plan",c,n,l),u=await oc({...Yf(e,t),phase:"plan",title:L.title,outline:[],...l.length?{complianceIssues:l}:{},...c>1&&!d&&a?{continueAfterInterruption:!0}:{},...d?{completionRecovery:d}:{}},{onToolPhase:A=>{A==="detected"?Ft("brief","running",U("generationReadingBrief")):A==="completed"||A==="round"?(Ft("brief","done"),Ft("spine","running",U("generationWritingClaims"))):A==="research"&&Ft("proof","running",U("generationChoosingProof"))},onTextProgress:A=>{if(!A.includes('"slidePlans"'))return;let y=(A.match(/"slideNumber"/g)||[]).length;y>0?(Ft("proof","running",U("generationPlanProgress",{count:y})),Mt(U("generationPlanProgress",{count:y}))):Ft("proof","running",U("generationPlanningSlides"))}},{sessionId:a||void 0,appDataWorkspace:r?.workspaceSubdir,resultKind:r?"text":void 0});a=u.sessionId||a,i.push(...u.toolTrace||[]);let h=r?await nb(r):u.payload;if(r&&!h)throw new Error("PPT Live plan turn finished without a valid project.json");if(l=ob(i,sn()),l.length){let A=new Error(`PPT Live planning compliance failed: ${l.join(" ")}`);throw A.pptLivePlanCompliance=!0,A.pptLiveSessionId=u.sessionId||a||null,A}let f=eb(h,t),p=Jf(f);if(!p.length)throw new Error("PPT Live plan phase returned no slidePlans");return await tb(r,f),{payload:f,slidePlans:p,sessionId:u.sessionId||a||null,project:r}}catch(s){if(n=s,o.push(s),Array.isArray(s?.pptLiveToolTrace)&&i.push(...s.pptLiveToolTrace),ac(s)?a=null:s?.pptLiveSessionId&&(a=s.pptLiveSessionId),!rc(s))throw s;if(c>=Fa)throw Vf("generationStagePlanning",s,o);it().log?.warn?.("PPT Live plan phase failed, retrying",{attempt:c,maxAttempts:Fa,continueInSession:!!a,error:String(s)})}throw n}async function ub({operation:e,planContext:t,slidePlan:r,slideNumber:n,session:a,project:i}){let o=null,l=[],c=(s,d={score:100,issues:[]})=>({...r,html:s,quality:d,id:`ppt-live-slide-${n}`,slideNumber:n});for(let s=1;s<=Fa;s+=1)try{let d=tc(s);if(s>1){if(i){let b=await kf(i,n);if(b)return c(b)}Nt({title:d.continuation?U("generationRecoveryContinuing",{stage:U("generationStageSlide",{slide:n}),attempt:d.continuationAttempt,max:Rn}):U("generationSlideRetry",{slide:n,attempt:s,max:rr}),detail:En(o),kind:"error"}),Mt(d.continuation?U("generationRecoveryContinuing",{stage:U("generationStageSlide",{slide:n}),attempt:d.continuationAttempt,max:Rn}):U("generationSlideRetry",{slide:n,attempt:s,max:rr})),await new Promise(b=>setTimeout(b,nc(o,s)))}let u=jf("slides",s,o,o?[En(o)]:[]),f=!!a?.id?{operation:e,locale:Dr(),phase:"slides",inSession:!0,assignedSlides:[r],generationContract:xf(t),design:wf(t),style:bf(t),showcaseSlideNumbers:t.showcaseSlideNumbers,...s>1&&!u?{continueAfterInterruption:!0}:{},...u?{completionRecovery:u}:{}}:{...lb(e),phase:"slides",plan:{...t,style:bf(t),design:wf(t),generationContract:xf(t)},assignedSlides:[r],...u?{completionRecovery:u}:{}},p=await oc(f,{},{sessionId:a?.id||void 0,appDataWorkspace:i?.workspaceSubdir,resultKind:i?"text":void 0});a&&p.sessionId&&(a.id=p.sessionId);let{payload:A}=p;if(i){let b=await kf(i,n);if(!b)throw new Error(`PPT Live slide ${n} file is missing or incomplete`);return c(b)}let y=Array.isArray(A?.slides)?A.slides:[],g=y.find(b=>sc(b,NaN)===n)||y[0];if(!g||typeof g!="object"||!String(g.html||"").trim())throw new Error(`PPT Live slide ${n} is missing complete HTML`);return{...g,id:g.id||`ppt-live-slide-${n}`,slideNumber:n}}catch(d){if(o=d,l.push(d),a&&ac(d)&&(a.id=null,it().log?.warn?.("PPT Live planning session lost, falling back to standalone render turns",{slide:n})),!rc(d))throw d;if(s>=Fa)throw Vf("generationStageSlide",d,l,{slide:n});it().log?.warn?.("PPT Live slide render failed, retrying page",{slide:n,attempt:s,maxAttempts:Fa,continueInSession:!!a?.id,error:String(d)})}throw o}async function fb(e,t){let r=Bn;Dn(!0,U("working")),bi(),Ft("brief","running",U("generationReadingBrief")),Nt({title:U("processEventStarted"),detail:U("processEventWaiting"),kind:"start"}),Nt({title:U("generationPlanPhase"),detail:"",kind:"phase"}),$f(e,t);let n=!1,a=Xf()?Hf():null;a&&await Zf(a.runId);try{let{payload:i,slidePlans:o,sessionId:l}=await db(e,t,a);if(Fn(r))throw new Error("Generation stopped");Ft("brief","done"),Ft("spine","done"),Ft("proof","done"),Ft("design","running",U("generationDesigningLayouts")),L.generation.slideTarget=o.length,L.generation.draftedCount=0,Nt({title:U("generationPlanReady",{count:o.length}),detail:Mr(Cf(i).join(" / "),200),kind:"phase"}),i.title&&(L.title=String(i.title),It());let c={id:l||null};L.agentSession={id:c.id||"",workspaceSubdir:a?.workspaceSubdir||"",runId:a?.runId||"",skillKey:pr};let s={title:i.title||"",language:i.language||"",outline:i.outline||[],researchReport:i.researchReport||"",design:i.design||{},style:i.style||sn(),generationContract:i.generationContract||{},showcaseSlideNumbers:i.showcaseSlideNumbers||[],slideOrder:i.slide_order||[]},d=o.map((y,g)=>({...y,slideNumber:sc(y,g+1)})),u=new Set(s.showcaseSlideNumbers),h=[...d.filter(y=>u.has(y.slideNumber)),...d.filter(y=>!u.has(y.slideNumber))];Nt({title:U("generationSlidesPhase",{count:d.length}),detail:"",kind:"phase"});let f=[];for(let y of h){if(Fn(r))throw new Error("Generation stopped");let g=y.slideNumber;Ft("design","running",U("generationRenderingSlide",{slide:g,total:d.length})),Mt(U("generationRenderingSlide",{slide:g,total:d.length}));try{let x=await ub({operation:e,planContext:s,slidePlan:y,slideNumber:g,session:c,project:a});f.push(x)}catch(x){if(!f.length)throw x;let S=[...f].sort((D,T)=>D.slideNumber-T.slideNumber);Ho({title:i.title,language:i.language,outline:[],researchReport:i.researchReport,design:i.design,slides:S}),L.activeSlideId=L.slides[L.slides.length-1]?.id||L.activeSlideId,L.selectedElementId="",It(),await yt(!0);let F=new Set(f.map(D=>D.slideNumber)),I=d.filter(D=>!F.has(D.slideNumber)).map(D=>D.slideNumber),B=new Error(U("generationPartialDeck",{missing:I.join(", ")}));throw B.pptLivePartialDeck=!0,B.cause=x,x?.pptLiveRecoveryExhausted&&(B.pptLiveRecoveryExhausted=x.pptLiveRecoveryExhausted),B}L.generation.draftedCount=f.length,Ft("design","running",U("generationSlideReady",{slide:g,total:d.length})),Nt({title:U("generationSlideReady",{slide:g,total:d.length}),detail:"",kind:"slide"});let b=[...f].sort((x,S)=>x.slideNumber-S.slideNumber);Ho({title:i.title,language:i.language,outline:b.map(x=>x.title||""),researchReport:i.researchReport,design:i.design,slides:b}),L.activeSlideId=`ppt-live-slide-${g}`,L.selectedElementId="",It()}let A=[...f].sort((y,g)=>y.slideNumber-g.slideNumber);L.agentSession.id=c.id||L.agentSession.id,Nt({title:U("generationParsingDeck"),detail:"",kind:"parsing"}),Mt(U("generationParsingDeck")),Ho({title:i.title,language:i.language,outline:Cf(i),researchReport:i.researchReport,design:i.design,slides:A}),await es(`agent:${e}`),Nt({title:U("processEventDone"),detail:"",kind:"done"}),Ft("design","done"),Ft("compile","done",U("generationCompiled")),Jl(U("deckReady")),n=!0,It(),await yt(!0)}finally{!Fn(r)&&(L.generation.active&&!n&&(L.generation.active=!1),Dn(!1)),Er(L),Rr(L)}}function $f(e,t){Mt(U("generationAgentWorking")),Nt({title:U("generationAgentWorking"),detail:Mr(t||""),kind:"start"}),e==="auto"&&(Zl()||ts())&&(L.title=U("agentWorkingTitle")),It()}var hb=new Set(["ParamsPartial","Queued","Waiting","Progress","Streaming","StreamChunk","Confirmed","Rejected"]);function eh(e){let t=String(e||"").trim();return t?/^skill$/i.test(t)?U("eventToolSkillName"):/^websearch$/i.test(t)?U("eventToolWebSearchName"):/^webfetch$/i.test(t)?U("eventToolWebFetchName"):t:U("eventUnknownTool")}function pb(e,t){let r=lc(e),n=r.event_type||r.eventType||"";if(hb.has(n)||n==="Started"||n==="EarlyDetected")return!1;let a=String(r.tool_name||r.toolName||"tool").toLowerCase(),i=r.params&&typeof r.params=="object"?r.params:{},o=String(i.file_path||i.path||i.command||"").trim(),l=o?`${a}:${o}:${n}`:`${a}:${n}`;return t.has(l)?!1:(t.add(l),n==="Completed"||n==="Failed"||n==="Cancelled"||n==="ConfirmationNeeded")}function Ab(){let e=0,t="";return{get lastProgressLogAt(){return e},touch(){e=Date.now()},note(r,n="",a="phase",i=0){let o=Date.now(),l=r===t;return i>0&&l&&o-e0&&(L.generation.draftedCount=r),Er(L),Rr(L)}function xb(e,t,r){let n=gb(e),a=mb(n);Ft(n,"running",a),wb(e,n),t.touch()}function Sb(e){let t=lc(e.toolEvent||{}),r=t.event_type||t.eventType||"ToolEvent",n=eh(t.tool_name||t.toolName),a={EarlyDetected:U("eventToolDetected"),ParamsPartial:U("eventToolParams"),Queued:U("eventToolQueued"),Waiting:U("eventToolWaiting"),Started:U("eventToolStarted"),Progress:U("eventToolProgress"),Streaming:U("eventToolStreaming"),StreamChunk:U("eventToolStreamChunk"),ConfirmationNeeded:U("eventToolConfirmation"),Confirmed:U("eventToolConfirmed"),Rejected:U("eventToolRejected"),Completed:U("eventToolCompleted"),Failed:U("eventToolFailed"),Cancelled:U("eventToolCancelled")},i=new Set(["EarlyDetected","Started","Completed","Failed","Cancelled","ConfirmationNeeded"]);return{title:a[r]||U("processEventTool"),detail:i.has(r)?n:Cb(r,t),kind:r==="Failed"||r==="Cancelled"||r==="Rejected"?"error":"tool"}}function Cb(e,t){return e==="Failed"?Mr(t.error||U("backendGenerationFailed")):e==="Completed"?"":e==="Progress"?Mr(t.message||""):""}function lc(e){if(e.event_type||e.eventType||e.tool_name||e.toolName)return e;let r=["EarlyDetected","ParamsPartial","Queued","Waiting","Started","Progress","Streaming","StreamChunk","ConfirmationNeeded","Confirmed","Rejected","Completed","Failed","Cancelled"].find(a=>e&&Object.prototype.hasOwnProperty.call(e,a));return r?{...e[r]||{},event_type:r}:e||{}}function Mr(e,t=180){let r=String(e||"").replace(/\s+/g," ").trim();return r?r.length>t?`${r.slice(0,t-1)}...`:r:""}function kb(e,t){if(!e||!t)return;Tn.some(n=>n.sessionId===e&&n.turnId===t)||Tn.push({sessionId:e,turnId:t})}function Pb(e,t){Tn=Tn.filter(r=>!(r.sessionId===e&&r.turnId===t))}function Fn(e){return e!==Bn}async function cc(){let e=[...Tn];Tn=[],!(!e.length||!it().backend?.cancel)&&await Promise.all(e.map(async t=>{try{await it().backend.cancel(t.sessionId,t.turnId)}catch(r){it().log?.warn?.("PPT Live backend cancel failed",{sessionId:t.sessionId,turnId:t.turnId,error:String(r)})}}))}async function Fb(e=!1,t={}){let r=Tn.length>0;Bn+=1,await cc(),L.generation.active=!1,L.generation.steps=L.generation.steps.map(n=>n.status==="running"?{...n,status:"error"}:n),!t.silent&&r&&(Mt(e?U("generationTimedOut"):U("generationStopped")),Nt(e?U("generationTimedOut"):U("generationStopped"))),Dn(!1),Er(L),Rr(L),t.silent||await yt(!0)}async function Tb(e=!1){await Fb(e)}function Ho(e){if(Rb(e)){e.researchReport&&Tf(e.researchReport),e.design?.palette&&typeof e.design.palette=="object"&&(L.deckPalette=e.design.palette);return}let t=Bb(e);if(t.length)L.title=String(e.title||L.title||U("blankDeckTitle")),L.slides=t.map((r,n)=>Xr(r,n,{...L,slides:t})),L.outline=L.slides.map(r=>r.title),L.activeSlideId=L.slides[0]?.id||"",L.selectedElementId="";else{if(!Array.isArray(e?.slides)||e.slides.length===0)throw new Error("PPT Live deck payload has no slides");L.title=String(e.title||L.title||U("blankDeckTitle")),L.slides=e.slides.map((r,n)=>Xr({...r,html:r.html||r.sourceHtml||r.slideHtml||""},n,{...L,slides:e.slides})),L.outline=L.slides.map(r=>r.title),L.activeSlideId=L.slides[0]?.id||"",L.selectedElementId=L.slides[0]?.elements[0]?.id||""}Array.isArray(e.outline)&&e.outline.length&&(L.outline=e.outline.map(_f).filter(Boolean)),e.researchReport&&Tf(e.researchReport),e.design?.palette&&typeof e.design.palette=="object"&&(L.deckPalette=e.design.palette)}function Tf(e){L.sources={...L.sources,facts:e.verifiedFacts||L.sources?.facts||[],warnings:e.warnings||L.sources?.warnings||[],summary:e.summary||L.sources?.summary||"",fetchedAt:Date.now()}}function Db(e){return Array.isArray(e?.deckPatch?.changes)?e.deckPatch.changes:Array.isArray(e?.patch?.changes)?e.patch.changes:Array.isArray(e?.changes)?e.changes:Array.isArray(e?.patches)?e.patches:[]}function Df(e,t,r=0){let n=String(e?.slideId||e?.id||e?.targetSlideId||e?.targetId||"").trim();if(n){let o=t.findIndex(l=>l.id===n);if(o>=0)return o}let a=Number(e?.slideNumber??e?.pageNumber);if(Number.isFinite(a)&&a>0)return mt(Math.round(a)-1,0,Math.max(0,t.length-1));let i=Number(e?.slideIndex??e?.index??e?.targetSlideIndex);return Number.isFinite(i)?i>=t.length&&i-1>=0&&i-1i.id===r);if(a>=0)return a+1}let n=String(e?.beforeSlideId||"").trim();if(n){let a=t.findIndex(i=>i.id===n);if(a>=0)return a}return e?.afterSlideNumber?mt(Number(e.afterSlideNumber),0,t.length):e?.beforeSlideNumber?mt(Number(e.beforeSlideNumber)-1,0,t.length):e?.slideNumber?mt(Number(e.slideNumber)-1,0,t.length):e?.slideIndex!==void 0?mt(Number(e.slideIndex),0,t.length):Math.min(t.length,$t(L)+1)}function Ef(e,t,r,n){let a=e?.slide||e?.replacement||e?.newSlide||e?.payload||e;if(!a||typeof a!="object")return null;let i={...t||{},...a,id:a.id||a.slideId||t?.id||gr("html-slide"),html:a.html||a.sourceHtml||a.slideHtml||t?.html||""};return Xr(i,r,{...L,slides:n})}function Rb(e){let t=Db(e);if(!t.length)return!1;let r=Vr(L.slides||[]),n=[],a=0;if(t.forEach(o=>{let l=String(o?.op||o?.operation||o?.type||"replace_slide").toLowerCase();if(l==="delete_slide"||l==="delete"||l==="remove_slide"||l==="remove"){if(!r.length)return;let u=Df(o,r,$t(L)),[h]=r.splice(u,1);h?.id&&n.push(h.id),a+=1;return}if(l==="insert_slide"||l==="insert"||l==="add_slide"||l==="add"){let u=Eb(o,r),h=Ef(o,null,u,r);if(!h)return;r.splice(u,0,h),n.push(h.id),a+=1;return}let c=Df(o,r,$t(L)),s=r[c],d=Ef(o,s,c,r);d&&(r[c]=d,n.push(d.id),a+=1)}),!a)throw new Error("PPT Live deck patch had no applicable changes");L.title=String(e.deckPatch?.title||e.patch?.title||e.title||L.title||U("blankDeckTitle")),L.slides=r.map((o,l)=>Xr(o,l,{...L,slides:r})),L.outline=Array.isArray(e.outline)&&e.outline.length?e.outline.map(String):L.slides.map(o=>o.title);let i=n.find(o=>L.slides.some(l=>l.id===o));return L.activeSlideId=i||L.slides[Math.min($t(L),L.slides.length-1)]?.id||L.slides[0]?.id||"",L.selectedElementId=_t(L)?.elements?.[0]?.id||"",!0}function Bb(e){let t=[];return Array.isArray(e?.htmlSlides)&&t.push(...e.htmlSlides),Array.isArray(e?.slides)&&t.push(...e.slides.filter(r=>r?.html||r?.sourceHtml||r?.slideHtml)),t.map((r,n)=>{let a=String(r?.html||r?.sourceHtml||r?.slideHtml||"").trim();return a?{id:r.id||r.slideId||gr("html-slide"),title:String(r.title||r.label||`${U("newSlideTitle")} ${n+1}`),subtitle:String(r.subtitle||""),kicker:String(r.kicker||""),claim:String(r.claim||r.title||""),proofObject:String(r.proofObject||""),supportNote:String(r.supportNote||""),sourceNote:String(r.sourceNote||""),notes:String(r.notes||""),layout:"html",theme:r.theme||{},html:a,elements:[]}:null}).filter(Boolean)}function Rf(...e){for(let t of e){let r=String(t||"").trim();if(r)try{return Da(r),r}catch{}}return String(e.find(t=>String(t||"").trim())||"").trim()}async function Lb(e,t,r,n=null,a={}){let i=it(),o=a.expectJson!==!1;if(!t||!r||!i.backend?.turnText)return e;let l=!1,c=Promise.resolve(e).finally(()=>{l=!0}),s=new Promise((d,u)=>{let h=Date.now(),f=300*1e3,p=10*1e3,A=3600*1e3,y=()=>Number(n?.lastEventAt||h);(async()=>{for(;!l&&Date.now()-hf)break;if(bsetTimeout(x,Math.min(1e3,p-b)));continue}try{let x=await i.backend.turnText(t,r),S=String(x?.text||"").trim();if(S){if(!o){d({answer:S,thinking:""});return}try{Da(S),d({answer:S,thinking:""});return}catch{}}}catch{}await new Promise(x=>setTimeout(x,2e3))}l||u(new Error("PPT Live backend did not publish a final deck JSON"))})()});return Promise.race([c,s])}async function Nb(e,t,r,n=""){let a=Date.now(),i=25e3,o=String(r||"").trim(),l=String(n||"").trim(),s=Rf(o,l,`${o} +${l}`.trim());if(s)try{return Da(s),s}catch{}let d=it();if(!e||!t||!d.backend?.turnText){if(!s)throw new Error("PPT Live backend produced no text");return s}let u=0;for(;Date.now()-a{setTimeout(()=>A(new Error("turnText timeout")),4e3)})]),f=String(h?.text||"").trim();if(s=Rf(f,s,l,o),s)return Da(s),s}catch{}await new Promise(h=>setTimeout(h,500))}if(!s)throw new Error("PPT Live backend produced no text");return s}function Da(e){let t=String(e||"").trim();if(!t)throw new Error("PPT Live backend produced no text");try{return JSON.parse(t)}catch{let r=t.match(/```(?:json)?\s*([\s\S]*?)```/i);if(r)return JSON.parse(r[1]);let n=t.indexOf("{"),a=t.lastIndexOf("}");if(n>=0&&a>n)return JSON.parse(t.slice(n,a+1));throw new Error("PPT Live backend returned invalid JSON")}}function Ib(e){let t=String(e?.message||e||"");return/ppt_live:\/\/round-budget-exhausted|exhausted its \d+-round tool budget|tool budget before producing deck JSON/i.test(t)}function Mb(e){return String(e||"").includes("timed out")}function rs(e){let t=String(e||"");return t.includes("dialog-turn-cancelled")||t.includes("Generation stopped")}async function zb(e,t={}){let r=Ln();t.readBrief!==!1&&on({includeTopic:!r});let n=[e,qf()].filter(Boolean).join(": ");if(!n){Mt(U("promptRequired"));return}try{await ic("revise_slide",n,{includeTopic:!r})}catch(a){if(rs(a))return;it().log?.warn?.("PPT Live backend slide revision failed",{action:e,error:String(a)}),$l(a),await yt(!0)}}async function Gr(){if(on({includeTopic:!Ln()}),(L.slides||[]).some(e=>String(e?.html||"").trim())){let e=`Restyle the existing deck without changing its facts or narrative. Apply these exact settings to every slide HTML: ${JSON.stringify(sn())}. Preserve each page's informationIntent and visualStrategy while making the deck visually coherent.`;try{await ic("revise_deck",e,{includeTopic:!1});return}catch(t){if(rs(t))return;it().log?.warn?.("PPT Live Agent restyle failed",{error:String(t)}),$l(t),await yt(!0);return}}L.slides=L.slides.map((e,t)=>Xr({...e,theme:void 0},t,L)),Mt(U("deckRestyled")),It(),await yt(!0)}function Hl(){on({includeTopic:!Ln()});let e=new Map(L.slides.map(t=>[t.title,t]));L.slides=L.outline.map((t,r)=>{let n=e.get(t);return n?Xr(n,r,L):hs(t,r,L.outline.length,L)}),L.activeSlideId=L.slides[0]?.id||"",L.selectedElementId=L.slides[0]?.elements[0]?.id||"",It(),yt(!0)}async function Ob(){Bn+=1,await es("before-new"),await cc(),L.generation.active=!1,Dn(!1),L=Ub(),bi(),It(),Mt(U("blankDeckReady")),await yt(!0)}function Ub(){return zn(Mn())}function Wb(e){if(!ds.includes(e))return;let t=_t(L);if(!t)return;let r=ps({...Ti(e),x:10+t.elements.length%5*4,y:14+t.elements.length%5*4});t.elements.push(r),L.selectedElementId=r.id,It(),yt(!0)}function Gb(){let e=_t(L);!e||!L.selectedElementId||(e.elements=e.elements.filter(t=>t.id!==L.selectedElementId),L.selectedElementId=e.elements[0]?.id||"",It(),yt(!0))}function Bf(e){let t=e.elements.find(r=>r.type==="text"&&r.text);t&&(e.title=t.text.slice(0,90),L.outline[$t(L)]=e.title,$t(L)===0&&(L.title=e.title))}function Lf(){L.presentIndex=$t(L),th(),xe("previewDialog")?.showModal()}function th(){let e=L.slides[L.presentIndex]||L.slides[0];xe("presentSlide")&&(xe("presentSlide").innerHTML=e?un(e):""),xe("presentCounter")&&(xe("presentCounter").textContent=`${Math.max(1,L.presentIndex+1)} / ${Math.max(1,L.slides.length)}`),Un()}function Vo(e){L.presentIndex=mt(L.presentIndex+e,0,L.slides.length-1),th()}function qb(){if(!(L.slides||[]).length)return Pa(U("exportDeckEmpty")),null;on({includeTopic:!Ln()});let e=Wl(L);return Pa(U("exportSavedTo",{path:e})),e}function jb(){return on({includeTopic:!Ln()}),(L.slides||[]).length?!0:(Pa(U("exportDeckEmpty")),!1)}function rh(e){return{html:{working:U("exportHtmlWorking"),done:U("exportHtmlDone"),failed:U("exportHtmlFailed")},pptx:{working:U("exportPptxWorking"),done:U("exportPptxDone"),failed:U("exportPptxFailed")},pdf:{working:U("exportPdfWorking"),done:U("exportPdfDone"),failed:U("exportPdfFailed")},png:{working:U("exportPngWorking"),done:U("exportPngDone"),failed:U("exportPngFailed")}}[e]||null}function _l(e,t,r){let n=rh(r==="pptx"?"pptx":r);if(!n||t<=0)return;let a=Math.min(t,Math.max(1,e+1));Ko("loading",`${n.working} (${a}/${t})`)}async function Nf(e,t){let r=it();if(!r?.deck?.renderPage)throw new Error("Host WebView export is unavailable in this runtime.");let n=[],a=e.length;for(let[i,o]of e.entries()){_l(i,a,t);let l=await r.deck.renderPage({html:Ps(o),format:t,width:or.width,height:or.height});if(!l)throw new Error(`Host WebView returned empty ${t} for slide ${i+1}`);n.push({index:i,base64:String(l).replace(/^data:.*;base64,/,"")})}return n}async function Vb(e){if(e==="html"){on({includeTopic:!Ln()});let o=Wl(L);if(!o)throw new Error(U("exportDeckEmpty"));return{filename:o}}let t=L.slides||[];if(!t.length)throw new Error(U("exportDeckEmpty"));let r,n=Vr(L);if(e==="pptx")if(t.some(o=>o?.html)){let o=it(),l=typeof o?.deck?.renderPage=="function"?async(s,d)=>{_l(d,t.length,"pptx");let u=await o.deck.renderPage({html:s,format:"png",width:or.width,height:or.height});return String(u||"").replace(/^data:.*;base64,/,"")}:null,c=await ed(t,{renderRaster:l,onRasterProgress:s=>_l(s,t.length,"pptx")});r=await zl(n,c)}else r=await Ml(n);else if(e==="pdf"){let o=await Nf(t,"pdf");r=await Ol(n,o.map(l=>l.base64))}else if(e==="png"){let o=await Nf(t,"png");r=await Ul(n,o)}else throw new Error(U("exportFormatUnavailable"));let a=typeof r?.base64=="string"?r.base64.replace(/^data:.*;base64,/,""):"";if(!a)throw new Error(`export${e} returned no data`);let i=r.filename||`${Gl(L.title||"ppt-live")}`;return hf(a,i,r.mimeType||"application/octet-stream"),{filename:i}}var _o=!1,Jt={updateOutline(e,t){L.outline[e]=t,L.slides[e]&&(L.slides[e].title=t),It(),yt(!0)},moveOutline(e,t){let r=e+t;r<0||r>=L.outline.length||([L.outline[e],L.outline[r]]=[L.outline[r],L.outline[e]],Hl())},removeOutline(e){L.outline.length<=1||(L.outline.splice(e,1),Hl())},selectSlide(e){L.activeSlideId=e,L.selectedElementId=_t(L)?.elements[0]?.id||"",It(),yt(!0)},selectElement(e){L.selectedElementId=e,dn(L,Jt),Oi(L,Jt),yt(!0)},updateElementTextDirect(e,t){let r=_t(L),n=r?.elements.find(a=>a.id===e);n&&(n.text=String(t||"").trim(),Bf(r),Wn(L,Jt),renderOutline(L,Jt),yt(!1))},updateElementListItemDirect(e,t,r){let a=_t(L)?.elements.find(i=>i.id===e);!a||!Array.isArray(a.items)||(a.items[t]=String(r||"").trim(),a.items=a.items.filter(Boolean),dn(L,Jt),Wn(L,Jt),yt(!1))},updateSlideHtmlDirect(e,t){let r=L.slides.find(a=>a.id===e);if(!r)return;let n=String(t||"");r.html!==n&&(r.html=n,Wn(L,Jt),yt(!1))},updateSlideNotes(e){let t=_t(L);t&&(t.notes=e),yt(!0)},updateSlideMethodology(){let e=_t(L);e&&(e.kicker=xe("slideKickerInput")?.value||e.kicker,e.claim=xe("slideClaimInput")?.value||e.claim,e.proofObject=xe("slideProofInput")?.value||e.proofObject,e.supportNote=xe("slideSupportInput")?.value||e.supportNote,e.sourceNote=xe("slideSourceInput")?.value||e.sourceNote,dn(L,Jt),Wn(L,Jt),yt(!0))},updateElementFromInspector(){let e=_t(L),t=On(L);!e||!t||(t.text=xe("elementTextInput")?.value||"",t.items=(xe("elementItemsInput")?.value||"").split(` +`).map(r=>r.trim()).filter(Boolean),t.data=Hb(xe("elementDataInput")?.value||""),t.x=mt(Number(xe("elementXInput")?.value??t.x),0,100),t.y=mt(Number(xe("elementYInput")?.value??t.y),0,100),t.w=mt(Number(xe("elementWInput")?.value??t.w),3,100),t.h=mt(Number(xe("elementHInput")?.value??t.h),3,100),t.style.fontSize=mt(Number(xe("elementFontInput")?.value??t.style.fontSize),8,88),t.style.fontWeight=mt(Number(xe("elementWeightInput")?.value??t.style.fontWeight),100,900),t.style.color=xe("elementColorInput")?.value||t.style.color,t.style.background=xe("elementBgInput")?.value||t.style.background,Jt.updateSlideMethodology(),e.notes=xe("slideNotesInput")?.value||e.notes,Bf(e),dn(L,Jt),yt(!0))},beginDrag(e,t){if(e.button!==0)return;let n=_t(L)?.elements.find(i=>i.id===t);if(!n)return;L.selectedElementId=n.id;let a=xe("slideCanvas").getBoundingClientRect();Tr={resizing:e.target.classList.contains("resize-handle"),startX:e.clientX,startY:e.clientY,rect:a,start:{x:n.x,y:n.y,w:n.w,h:n.h}},e.currentTarget.setPointerCapture?.(e.pointerId),window.addEventListener("pointermove",nh),window.addEventListener("pointerup",Xb,{once:!0})}};function nh(e){if(!Tr)return;let t=On(L);if(!t)return;let r=(e.clientX-Tr.startX)/Tr.rect.width*100,n=(e.clientY-Tr.startY)/Tr.rect.height*100;Tr.resizing?(t.w=mt(Tr.start.w+r,3,100-t.x),t.h=mt(Tr.start.h+n,3,100-t.y)):(t.x=mt(Tr.start.x+r,0,100-t.w),t.y=mt(Tr.start.y+n,0,100-t.h)),dn(L,Jt),Oi(L,Jt)}function Xb(){Tr=null,window.removeEventListener("pointermove",nh),yt(!0)}function Hb(e){return e.split(` +`).map((t,r)=>{let[n,a]=t.split(":");return{label:(n||`Item ${r+1}`).trim(),value:Number(a||0)}}).filter(t=>t.label)}function _b(){let e=document.querySelector(".studio-shell");if(!e)return;let t=document.documentElement,r=Number(Vl("pptLiveFilmstripWidth")||0),n=Number(Vl("pptLiveAgentWidth")||0);r>=128&&r<=360&&t.style.setProperty("--filmstrip-width",`${r}px`),n>=240&&n<=460&&t.style.setProperty("--agent-width",`${n}px`);let a=(i,o)=>{let l=e.getBoundingClientRect(),c=128,s=Math.min(360,l.width*.34),d=240,u=Math.min(460,l.width*.42),h=360,f=A=>{if(i==="filmstrip"){let y=Math.max(c,Math.min(s,A.clientX-l.left));if(l.width-y-parseFloat(getComputedStyle(t).getPropertyValue("--agent-width"))-12{e.classList.remove("is-resizing"),document.querySelectorAll(".panel-resizer.is-dragging").forEach(A=>A.classList.remove("is-dragging")),window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),Xl("pptLiveFilmstripWidth",String(parseFloat(getComputedStyle(t).getPropertyValue("--filmstrip-width"))||"")),Xl("pptLiveAgentWidth",String(parseFloat(getComputedStyle(t).getPropertyValue("--agent-width"))||"")),Un()};e.classList.add("is-resizing"),window.addEventListener("pointermove",f),window.addEventListener("pointerup",p,{once:!0}),window.addEventListener("pointercancel",p,{once:!0}),f({clientX:o})};xe("filmstripResizer")?.addEventListener("pointerdown",i=>{i.button===0&&(i.preventDefault(),i.currentTarget.classList.add("is-dragging"),a("filmstrip",i.clientX))}),xe("agentResizer")?.addEventListener("pointerdown",i=>{i.button===0&&(i.preventDefault(),i.currentTarget.classList.add("is-dragging"),a("agent",i.clientX))})}function Kb(){let e=null,t=()=>{e&&clearTimeout(e),e=setTimeout(()=>{Un()},60)};window.addEventListener("resize",t),xe("toggleHistory")?.addEventListener("click",()=>{let r=xe("historyDrawer");r&&(r.hidden=!r.hidden)}),xe("closeHistory")?.addEventListener("click",()=>{let r=xe("historyDrawer");r&&(r.hidden=!0)}),document.querySelectorAll("[data-sidebar-tab]").forEach(r=>{r.addEventListener("click",()=>{let n=r.dataset.sidebarTab;document.querySelectorAll("[data-sidebar-tab]").forEach(a=>{a.classList.toggle("is-active",a.dataset.sidebarTab===n)}),document.querySelectorAll("[data-sidebar-panel]").forEach(a=>{a.classList.toggle("is-active",a.dataset.sidebarPanel===n)})})}),xe("topicInput")?.addEventListener("input",()=>{if(Ln()){L.promptDraft=xe("topicInput")?.value||"",yt(!0);return}on({includeTopic:!0}),yt(!0)}),xe("newDeck")?.addEventListener("click",()=>{Ob()}),xe("cancelGeneration")?.addEventListener("click",()=>{Tb(!1)}),xe("sendPrompt")?.addEventListener("click",()=>{Yl()}),xe("generateOutline")?.addEventListener("click",()=>{jy()}),xe("generateDeck")?.addEventListener("click",()=>{Vy()}),xe("addOutlineItem")?.addEventListener("click",()=>{L.outline.push(U("newSlideTitle")),It(),yt(!0)}),xe("syncSlidesFromOutline")?.addEventListener("click",Hl),xe("deleteElement")?.addEventListener("click",Gb),xe("previewDeck")?.addEventListener("click",Lf),xe("closePreview")?.addEventListener("click",()=>xe("previewDialog")?.close()),xe("prevPresent")?.addEventListener("click",()=>Vo(-1)),xe("nextPresent")?.addEventListener("click",()=>Vo(1)),xe("exportHtml")?.addEventListener("click",qb),xe("restyleDeck")?.addEventListener("click",Gr),document.querySelectorAll("[data-add-element]").forEach(r=>{r.addEventListener("click",()=>Wb(r.dataset.addElement))}),document.querySelectorAll(".ai-action").forEach(r=>{r.addEventListener("click",()=>{zb(r.dataset.action)})}),document.querySelectorAll(".segment").forEach(r=>{r.addEventListener("click",()=>{L.mode=r.dataset.mode,L.mode==="present"&&Lf(),It(),yt(!0)})}),document.addEventListener("keydown",r=>{xe("previewDialog")?.open&&((r.key==="ArrowRight"||r.key==="PageDown")&&Vo(1),(r.key==="ArrowLeft"||r.key==="PageUp")&&Vo(-1),r.key==="Escape"&&xe("previewDialog")?.close())});try{_b()}catch(r){it().log?.warn?.("Failed to bind PPT Live panel resizers",{error:String(r)})}if(typeof ResizeObserver<"u"){let r=[document.querySelector(".ppt-live"),document.querySelector(".studio-shell"),document.querySelector(".stage-shell"),document.querySelector(".canvas-area")].filter(Boolean),n=new ResizeObserver(t);r.forEach(a=>n.observe(a))}Yb(),Jb(),$b(),a1(),o1()}var nn=1,ka=.25,Qb=.25,Zb=2;function mi(e){nn=mt(e,Qb,Zb);let t=document.querySelector(".canvas-stage");t&&(t.style.transform=nn===1?"":`scale(${nn})`);let r=xe("zoomValue"),n=xe("statusZoomValue"),a=Math.round(nn*100)+"%";r&&(r.textContent=a),n&&(n.textContent=a)}function Yb(){xe("zoomIn")?.addEventListener("click",()=>mi(nn+ka)),xe("zoomOut")?.addEventListener("click",()=>mi(nn-ka)),xe("statusZoomIn")?.addEventListener("click",()=>mi(nn+ka)),xe("statusZoomOut")?.addEventListener("click",()=>mi(nn-ka)),document.querySelector(".canvas-area")?.addEventListener("wheel",e=>{if(e.ctrlKey||e.metaKey){e.preventDefault();let t=e.deltaY>0?-ka:ka;mi(nn+t)}},{passive:!1})}function Jb(){xe("floatingToolbar")&&document.querySelectorAll(".floating-toolbar-btn").forEach(t=>{t.addEventListener("click",()=>{let r=t.dataset.tool;if(!r)return;let n=_t(L),a=On(L);if(!(!n||!a)){switch(r){case"bold":a.fontWeight=a.fontWeight==="700"?"400":"700";break;case"italic":a.fontStyle=a.fontStyle==="italic"?"normal":"italic";break;case"underline":a.textDecoration=a.textDecoration==="underline"?"none":"underline";break;case"align-left":a.align="left";break;case"align-center":a.align="center";break;case"align-right":a.align="right";break;case"duplicate":n.elements.push({...Vr(a),id:gr("el"),x:a.x+5,y:a.y+5});break;case"delete":n.elements=n.elements.filter(i=>i.id!==a.id),L.selectedElementId=null;break}dn(L,Jt),Wn(L,Jt),yt(!0)}})})}function $b(){document.querySelectorAll(".property-section__header").forEach(n=>{let a=n.closest(".property-section");if(!a)return;let i=()=>{a.classList.toggle("is-collapsed");let o=!a.classList.contains("is-collapsed");n.setAttribute("aria-expanded",String(o))};n.addEventListener("click",i),n.addEventListener("keydown",o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),i())})});let e=xe("densitySlider"),t=e?.querySelector(".density-slider__track");e&&t&&(t.addEventListener("pointerdown",n=>{n.preventDefault(),Yn(Sf(n.clientX,t),{save:!1}),t.setPointerCapture(n.pointerId)}),t.addEventListener("pointermove",n=>{t.hasPointerCapture(n.pointerId)&&Yn(Sf(n.clientX,t),{save:!1})}),t.addEventListener("pointerup",n=>{t.hasPointerCapture(n.pointerId)&&(t.releasePointerCapture(n.pointerId),Gr())}),t.addEventListener("pointercancel",n=>{t.hasPointerCapture(n.pointerId)&&(t.releasePointerCapture(n.pointerId),yt(!0))}),e.querySelectorAll("[data-density-index]").forEach(n=>{n.addEventListener("click",a=>{a.stopPropagation(),Yn(n.dataset.densityIndex),Gr()})}),e.addEventListener("keydown",n=>{let a=Pi(L.style.density);n.key==="ArrowLeft"||n.key==="ArrowDown"?(n.preventDefault(),Yn(a-1),Gr()):n.key==="ArrowRight"||n.key==="ArrowUp"?(n.preventDefault(),Yn(a+1),Gr()):n.key==="Home"?(n.preventDefault(),Yn(0),Gr()):n.key==="End"&&(n.preventDefault(),Yn(2),Gr())})),document.querySelectorAll("[data-font-family]").forEach(n=>{n.addEventListener("click",()=>{L.style.fontFamily=n.dataset.fontFamily==="serif"?"serif":"sans",document.querySelectorAll("[data-font-family]").forEach(a=>{let i=a===n;a.classList.toggle("is-active",i),a.setAttribute("aria-pressed",i?"true":"false")}),Gr(),yt(!0)})}),document.querySelectorAll("[data-color-mode]").forEach(n=>{n.addEventListener("click",()=>{L.style.colorMode=n.dataset.colorMode==="dark"?"dark":"light",document.querySelectorAll("[data-color-mode]").forEach(a=>{let i=a===n;a.classList.toggle("is-active",i),a.setAttribute("aria-pressed",i?"true":"false")}),Gr()})});let r=xe("stylePresetSelect");r&&(sh(),Dc(r),r.value=L.style?.stylePreset||ln,Ra(r),r.addEventListener("change",()=>{let n=r.value;if(n){L.style.stylePreset=n;let a=is(n);a&&(L.style.colorMode=a.colorMode||"light",L.style.fontFamily=a.fontFamily||"sans",L.style.density=a.density||"standard",document.querySelectorAll("[data-color-mode]").forEach(i=>{let o=i.dataset.colorMode===L.style.colorMode;i.classList.toggle("is-active",o),i.setAttribute("aria-pressed",o?"true":"false")}),document.querySelectorAll("[data-font-family]").forEach(i=>{let o=i.dataset.fontFamily===L.style.fontFamily;i.classList.toggle("is-active",o),i.setAttribute("aria-pressed",o?"true":"false")}),Ia(L.style.density)),Gr(),yt(!0)}}))}var an=0;function ah(){return xe("formatGrid")?.querySelector(".format-card.is-selected")?.dataset.format||"pptx"}function e1(){let e=xe("exportOverlay");e&&(ih(),an=Math.max(0,$t(L)),e.classList.add("is-visible"),e.setAttribute("aria-hidden","false"),t1(),Jo(),requestAnimationFrame(()=>Ta()))}function Ta(){Vc(xe("exportPreviewFrame"))}function ih(){let e=xe("exportModalFeedback"),t=xe("exportModalFeedbackText"),r=xe("exportModalSpinner");xe("exportOverlay")?.classList.remove("is-exporting"),e&&(e.hidden=!0,e.classList.remove("is-success","is-error")),t&&(t.textContent=""),r&&(r.hidden=!1),Kl(!1)}function Kl(e){["exportCancel","exportConfirm","closeExport"].forEach(t=>{let r=xe(t);r&&(r.disabled=e)}),xe("formatGrid")?.querySelectorAll(".format-card").forEach(t=>{t.tabIndex=e?-1:0,t.style.pointerEvents=e?"none":""}),["exportPreviewPrev","exportPreviewNext"].forEach(t=>{let r=xe(t);r&&(r.disabled=e)})}function Ko(e,t){let r=xe("exportModalFeedback"),n=xe("exportModalFeedbackText"),a=xe("exportModalSpinner");!r||!n||(r.hidden=!1,r.classList.toggle("is-success",e==="success"),r.classList.toggle("is-error",e==="error"),a&&(a.hidden=e!=="loading"),n.textContent=t)}function Qo(){let e=xe("exportOverlay");e&&(e.classList.remove("is-visible"),e.setAttribute("aria-hidden","true"),ih())}function t1(){let e=xe("formatGrid");if(!e)return;let t=[{id:"pptx",name:"PPTX",desc:"Editable PowerPoint"},{id:"pdf",name:"PDF",desc:"Universal format"},{id:"html",name:"HTML",desc:"Interactive web deck"},{id:"png",name:"PNG",desc:"Image sequence"}];e.innerHTML=t.map((r,n)=>`
                  -
                  ${Rf(r.id)}
                  +
                  ${Af(r.id)}
                  ${r.name} ${r.desc}
                  - `).join(""),e.querySelectorAll(".format-card").forEach(r=>{let n=()=>{e.querySelectorAll(".format-card").forEach(i=>i.classList.remove("is-selected")),r.classList.add("is-selected"),ns()};r.addEventListener("click",n),r.addEventListener("keydown",i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),n())})})}function C1(e,t){if(!e||!t)return;e.innerHTML="";let r=document.createElement("div");r.className="export-preview__viewport";let n=document.createElement("div");if(n.className="export-preview__scale",t.html)n.appendChild(rd(t.html));else{let i=document.createElement("div");i.className="export-preview__element-stage",i.innerHTML=pn(t),n.append(i)}r.append(n),e.append(r),requestAnimationFrame(()=>{Li(),requestAnimationFrame(()=>Li())})}function ns(){let e=xe("exportPreviewInfo"),t=xe("exportPreviewCounter"),r=xe("exportPreviewFrame"),n=B.slides||[],i=vh().toUpperCase(),a=Math.max(1,n.length);if(on=mt(on,0,Math.max(0,n.length-1)),e&&(e.textContent=`${i} \xB7 ${n.length} slides`),t&&(t.textContent=`${on+1} / ${a}`),!r)return;let o=n[on];if(!o){r.innerHTML=`
                  ${Be(O("slidesEmptyHint"))}
                  `;return}C1(r,o)}async function k1(){if(Ko||!u1())return;let e=vh(),t=gh(e);if(!t){Ri(O("exportFormatUnavailable"));return}Ko=!0,xe("exportOverlay")?.classList.add("is-exporting"),lc(!0),Qo("loading",t.working);let r=xe("exportPreviewFrame"),n=r?.innerHTML||"";try{let{filename:i}=await f1(e),a=O("exportSavedTo",{path:i});xe("exportOverlay")?.classList.remove("is-exporting"),Qo("success",a),Ri(a),await new Promise(o=>setTimeout(o,1600)),Zo()}catch(i){let a=i instanceof Error?i.message:String(i);at().log?.error?.(`PPT Live ${e} export failed`,{error:a}),xe("exportOverlay")?.classList.remove("is-exporting"),Qo("error",`${t.failed} ${a}`),Ri(`${t.failed} ${a}`)}finally{r&&n&&(r.innerHTML=n),lc(!1),Ko=!1}}function P1(){if(xe("exportPptx")?.addEventListener("click",()=>x1()),xe("closeExport")?.addEventListener("click",Zo),xe("exportCancel")?.addEventListener("click",Zo),xe("exportConfirm")?.addEventListener("click",()=>{k1()}),xe("exportOverlay")?.addEventListener("click",e=>{e.target===xe("exportOverlay")&&!Ko&&Zo()}),xe("exportPreviewPrev")?.addEventListener("click",()=>{on=Math.max(0,on-1),ns(),requestAnimationFrame(()=>Li())}),xe("exportPreviewNext")?.addEventListener("click",()=>{let e=(B.slides||[]).length-1;on=Math.min(e,on+1),ns(),requestAnimationFrame(()=>Li())}),typeof ResizeObserver<"u"){let e=xe("exportPreviewFrame");e&&new ResizeObserver(()=>{xe("exportOverlay")?.classList.contains("is-visible")&&Li()}).observe(e)}}var Hf="pptLiveTheme";function bh(e){return e==="dark"||e==="light"?e:window.matchMedia?.("(prefers-color-scheme: dark)")?.matches?"dark":"light"}function F1(){let e=document.documentElement.getAttribute("data-theme-type")||document.documentElement.getAttribute("data-theme");if(e==="dark"||e==="light")return e;let t=at().theme;return t==="dark"||t==="light"?t:bh()}function _f(e){let t=bh(e),r=document.documentElement;r.setAttribute("data-theme",t),r.setAttribute("data-theme-type",t),r.style.colorScheme=t,Gn(),Mt()}function T1(){try{localStorage.removeItem(Hf)}catch{Jo.delete(Hf)}_f(F1()),at().onThemeChange?.(e=>{let t=e?.type==="dark"?"dark":"light";_f(t)})}async function D1(){Nn+=1,Ln=[],wa=!1,Ho=!1,(B.generation?.active||B.generation?.steps?.some(t=>t.status==="running"))&&(fc(O("generationStopped")),Sa()),Bn(!1);let e=at();e.backend?.cancelStaleRuns&&e.backend.cancelStaleRuns().catch(t=>{at().log?.warn?.("Failed to cancel stale PPT Live backend runs",{error:String(t)})})}function wh(){let e=xe("stylePresetSelect");if(!e)return;let t=e.value||B.style?.stylePreset||un;e.textContent="",kc(lr()).forEach(({key:r,displayName:n,description:i})=>{let a=document.createElement("option");a.value=r,a.textContent=n,i&&(a.title=i),e.append(a)}),e.value=t,e.selectedIndex<0&&(e.value=un),Ni(e)}function Yo(){B.generation=Ra(B.generation),Zc(),wh(),Oi(B.style?.density);let e=xe("aiStatusPill");e&&(e.textContent=En?O("statusPillBusy"):O("statusPillReady")),Mt()}async function E1(){Yo();try{await tb(),await D1(),Yo(),await yt(!0)}catch(e){at().log?.error?.("PPT Live init failed",{error:String(e)}),Lt(O("ready")),Yo()}finally{Gn()}}g1();Ga();at().onLocaleChange?.(()=>Yo());E1(); + `).join(""),e.querySelectorAll(".format-card").forEach(r=>{let n=()=>{e.querySelectorAll(".format-card").forEach(a=>a.classList.remove("is-selected")),r.classList.add("is-selected"),Jo()};r.addEventListener("click",n),r.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),n())})})}function r1(e,t){if(!e||!t)return;e.innerHTML="";let r=document.createElement("div");r.className="export-preview__viewport";let n=document.createElement("div");if(n.className="export-preview__scale",t.html)n.appendChild(jc(t.html));else{let a=document.createElement("div");a.className="export-preview__element-stage",a.innerHTML=un(t),n.append(a)}r.append(n),e.append(r),requestAnimationFrame(()=>{Ta(),requestAnimationFrame(()=>Ta())})}function Jo(){let e=xe("exportPreviewInfo"),t=xe("exportPreviewCounter"),r=xe("exportPreviewFrame"),n=L.slides||[],a=ah().toUpperCase(),i=Math.max(1,n.length);if(an=mt(an,0,Math.max(0,n.length-1)),e&&(e.textContent=`${a} \xB7 ${n.length} slides`),t&&(t.textContent=`${an+1} / ${i}`),!r)return;let o=n[an];if(!o){r.innerHTML=`
                  ${Le(U("slidesEmptyHint"))}
                  `;return}r1(r,o)}async function n1(){if(_o||!jb())return;let e=ah(),t=rh(e);if(!t){Pa(U("exportFormatUnavailable"));return}_o=!0,xe("exportOverlay")?.classList.add("is-exporting"),Kl(!0),Ko("loading",t.working);let r=xe("exportPreviewFrame"),n=r?.innerHTML||"";try{let{filename:a}=await Vb(e),i=U("exportSavedTo",{path:a});xe("exportOverlay")?.classList.remove("is-exporting"),Ko("success",i),Pa(i),await new Promise(o=>setTimeout(o,1600)),Qo()}catch(a){let i=a instanceof Error?a.message:String(a);it().log?.error?.(`PPT Live ${e} export failed`,{error:i}),xe("exportOverlay")?.classList.remove("is-exporting"),Ko("error",`${t.failed} ${i}`),Pa(`${t.failed} ${i}`)}finally{r&&n&&(r.innerHTML=n),Kl(!1),_o=!1}}function a1(){if(xe("exportPptx")?.addEventListener("click",()=>e1()),xe("closeExport")?.addEventListener("click",Qo),xe("exportCancel")?.addEventListener("click",Qo),xe("exportConfirm")?.addEventListener("click",()=>{n1()}),xe("exportOverlay")?.addEventListener("click",e=>{e.target===xe("exportOverlay")&&!_o&&Qo()}),xe("exportPreviewPrev")?.addEventListener("click",()=>{an=Math.max(0,an-1),Jo(),requestAnimationFrame(()=>Ta())}),xe("exportPreviewNext")?.addEventListener("click",()=>{let e=(L.slides||[]).length-1;an=Math.min(e,an+1),Jo(),requestAnimationFrame(()=>Ta())}),typeof ResizeObserver<"u"){let e=xe("exportPreviewFrame");e&&new ResizeObserver(()=>{xe("exportOverlay")?.classList.contains("is-visible")&&Ta()}).observe(e)}}var If="pptLiveTheme";function oh(e){return e==="dark"||e==="light"?e:window.matchMedia?.("(prefers-color-scheme: dark)")?.matches?"dark":"light"}function i1(){let e=document.documentElement.getAttribute("data-theme-type")||document.documentElement.getAttribute("data-theme");if(e==="dark"||e==="light")return e;let t=it().theme;return t==="dark"||t==="light"?t:oh()}function Mf(e){let t=oh(e),r=document.documentElement;r.setAttribute("data-theme",t),r.setAttribute("data-theme-type",t),r.style.colorScheme=t,Un(),It()}function o1(){try{localStorage.removeItem(If)}catch{Yo.delete(If)}Mf(i1()),it().onThemeChange?.(e=>{let t=e?.type==="dark"?"dark":"light";Mf(t)})}async function s1(){Bn+=1,Tn=[],vi=!1,Xo=!1,(L.generation?.active||L.generation?.steps?.some(t=>t.status==="running"))&&(Jl(U("generationStopped")),bi()),Dn(!1);let e=it();e.backend?.cancelStaleRuns&&e.backend.cancelStaleRuns().catch(t=>{it().log?.warn?.("Failed to cancel stale PPT Live backend runs",{error:String(t)})})}function sh(){let e=xe("stylePresetSelect");if(!e)return;let t=e.value||L.style?.stylePreset||ln;e.textContent="",fc(Dr()).forEach(({key:r,displayName:n,description:a})=>{let i=document.createElement("option");i.value=r,i.textContent=n,a&&(i.title=a),e.append(i)}),e.value=t,e.selectedIndex<0&&(e.value=ln),Ra(e)}function Zo(){L.generation=Fi(L.generation),zc(),sh(),Ia(L.style?.density);let e=xe("aiStatusPill");e&&(e.textContent=Pn?U("statusPillBusy"):U("statusPillReady")),It()}async function l1(){Zo();try{await Uy(),await s1(),Zo(),await yt(!0)}catch(e){it().log?.error?.("PPT Live init failed",{error:String(e)}),Mt(U("ready")),Zo()}finally{Un()}}Kb();zi();it().onLocaleChange?.(()=>Zo());l1(); diff --git a/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/meta.json b/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/meta.json index 980ff93aa..6dff54240 100644 --- a/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/meta.json +++ b/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/meta.json @@ -10,7 +10,7 @@ "ppt", "ai" ], - "version": 167, + "version": 169, "created_at": 0, "updated_at": 0, "permissions": { diff --git a/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/src/bitfun-backend-adapter.js b/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/src/bitfun-backend-adapter.js index 9d719bed5..0f9fd82c3 100644 --- a/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/src/bitfun-backend-adapter.js +++ b/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/src/bitfun-backend-adapter.js @@ -2,8 +2,8 @@ // // The MiniApp agent bridge (`app.agent.*`) is the only generation path. The // planning turn loads BitFun's pinned built-in `ppt-design` skill, reads the -// required references, and writes a durable generation contract. Serial render, -// repair, audit, and edit turns reuse the deck session and project directory. +// required references, and writes a durable generation contract. Serial render +// and edit turns reuse the deck session and project directory. const EVENT_LISTENERS = new Set(); export const PPT_DESIGN_SKILL_KEY = 'user::bitfun-system::ppt-design'; @@ -215,19 +215,6 @@ ${previousFailure ? `- Previous verified failure: ${previousFailure}\n` : ''}${ `; } -function buildAuditVerificationFeedback(input) { - const issues = Array.isArray(input?.auditIssues) - ? input.auditIssues.map(String).filter(Boolean) - : []; - if (!issues.length) return ''; - return `The host rejected the previous audit turn because the audit artifact was not complete: -- ${issues.join('\n- ')} - -Resolve every issue above in this turn. In particular, use the Write tool to create or completely rewrite \`quality-report.json\`; do not answer "DECK AUDIT PASSED" unless that file has been successfully written and covers every slide id. - -`; -} - function schemaPaletteBlock(input) { const palette = input?.style?.palette || {}; return JSON.stringify(palette, null, 2) @@ -435,103 +422,6 @@ ${serializeInput(input)} return body + buildStyleAppendix(input); } -function buildRepairPrompt(input) { - const slidePlan = input?.assignedSlide || (input?.assignedSlides || [])[0] || {}; - const assigned = slidePlan?.slideNumber ?? '?'; - const file = slideFileName(slidePlan?.slideNumber || 0); - return `Repair PPT Live slide ${assigned} in the existing deck Agent Session. - -The host validated \`${file}\` and rejected it for editable-PPTX export. Fix the slide on disk. Do not regenerate the deck, re-research, or replace the page with a generic template. - -You choose how to repair: -1. \`Read\` \`project.json\` and \`${file}\` first. -2. Treat the validator findings below as the acceptance checklist. Keep the planned content, claim, evidence, visual identity, and layout unless a finding requires a structural change. -3. Make the smallest change that clears every finding. Prefer targeted \`Edit\` on \`${file}\` when a finding points at a specific element or block (for example move background/border/shadow from a text tag onto an enclosing DIV, fix one rule, adjust one section). Use \`Write\` for the whole file only when localized edits are impractical or would leave the file inconsistent. -4. Do not call Skill again, do not re-read reference markdown, and do not modify other slides. -5. When \`${file}\` satisfies every finding, end with "SLIDE ${assigned} REPAIRED". - -Editable-PPTX rules the validator enforces: -${EDITABLE_PPTX_HARD_RULES} -${buildStyleAppendix(input)} - -Validator findings: -\`\`\`json -${serializeInput(input?.validationIssues || [])} -\`\`\` - -Assigned slide and contract: -\`\`\`json -${serializeInput({ - generationContract: input?.generationContract || {}, - design: input?.design || {}, - style: input?.style || {}, - assignedSlide: slidePlan, - })} -\`\`\``; -} - -/** - * In-session audit: skill, references, and generationContract were loaded during - * planning. Re-read only project artifacts; avoid redundant Skill/reference turns. - */ -function buildSessionAuditPrompt(input) { - return `Perform the FINAL whole-deck audit for this PPT Live project in the SAME deck Agent Session where planning and rendering already loaded Skill('${PPT_DESIGN_SKILL_KEY}') and distilled rules into \`project.json\`. - -Do NOT call Skill again and do NOT re-read reference markdown unless you must verify one specific rule. Treat \`generationContract.hardRules\`, \`visualGrammar\`, and \`design.renderGuide\` as authoritative. - -${buildAuditVerificationFeedback(input)} -1. \`Read\` \`project.json\` and every \`slides/slide-XX.html\` listed in \`slide_order\`. -2. Check every page against the generation contract, user prompt/style, narrative role, evidence, editable PPTX constraints, and taste guardrails already captured in the contract. -3. Check deck-level quality using a thumbnail/contact-sheet pass: visual thesis, signature move discipline, distinct adjacent silhouettes, deliberate density curve, one dominant element per page, no SaaS card-template repetition, no filler labels or fake UI, no missed high-value visual explanation, accurate sources, readable density, and consistent typography/palette/object styles. -4. Rewrite only slide files that need improvement. Preserve correct content and never invent facts. -5. Write \`quality-report.json\` containing \`{"status":"passed","checkedSlides":["every slide_id from slide_order"],"fixedSlides":["only slide_ids you rewrote"],"notes":["specific deck-level findings and fixes, or a concise reason no fixes were needed"]}\`. \`checkedSlides\` must cover every slide id; \`fixedSlides\` must list only pages you changed. -6. End with "DECK AUDIT PASSED". - -Editable PPTX rules: -${EDITABLE_PPTX_HARD_RULES} -${buildStyleAppendix(input)} - -Deck audit contract: -\`\`\`json -${serializeInput({ - generationContract: input?.generationContract || {}, - design: input?.design || {}, - style: input?.style || {}, - slideOrder: input?.slideOrder || [], - slidePlans: input?.slidePlans || [], - })} -\`\`\``; -} - -function buildAuditPrompt(input) { - return `Perform the FINAL whole-deck audit for this PPT Live project in the SAME Agent Session. - -${buildAuditVerificationFeedback(input)} -1. Call \`Skill('${PPT_DESIGN_SKILL_KEY}')\` and verify the returned stable key is exact. -2. \`Read\` mandatory references \`${PPT_DESIGN_REQUIRED_REFERENCES.join('`, `')}\`, then \`Read\` every additional style reference listed in \`generationContract.requiredReferences\`. -3. \`Read\` \`project.json\` and every file named by \`slide_order\`. -4. Check every page against \`generationContract\`, the pinned ppt-design skill, the selected style preset, user Prompt, user style/layout settings, narrative role, evidence, and editable PPTX constraints. -5. Check deck-level quality using a thumbnail/contact-sheet pass: visual thesis, signature move discipline, distinct adjacent silhouettes, deliberate density curve, one dominant element per page, no SaaS card-template repetition, no filler labels or fake UI, no missed high-value visual explanation, accurate sources, readable density, and consistent typography/palette/object styles. -6. Rewrite only slide files that need improvement. Preserve correct content and never invent facts. -7. Write \`quality-report.json\` containing \`{"status":"passed","checkedSlides":["every slide_id from slide_order"],"fixedSlides":["only slide_ids you rewrote"],"notes":["specific deck-level findings and fixes, or a concise reason no fixes were needed"]}\`. The report is required and \`checkedSlides\` must cover every slide id. -8. End with "DECK AUDIT PASSED". - -Editable PPTX rules: -${EDITABLE_PPTX_HARD_RULES} -${buildStyleAppendix(input)} - -Deck audit contract: -\`\`\`json -${serializeInput({ - generationContract: input?.generationContract || {}, - design: input?.design || {}, - style: input?.style || {}, - slideOrder: input?.slideOrder || [], - slidePlans: input?.slidePlans || [], - })} -\`\`\``; -} - function buildLegacyPrompt(input) { const body = `Generate or revise a PPT Live deck. The user only sees the PPT Live app UI. @@ -586,8 +476,6 @@ ${serializeInput(input)} * - "slides": render the assigned slide. With `input.inSession` the turn runs * inside the planning session and relies on its context; otherwise it gets a * self-contained prompt that reloads the skill and reads the plan JSON. - * - "repair": rewrite one validator-failing slide in the deck session. - * - "audit": inspect and improve the completed deck before acceptance. * - absent: legacy single-shot protocol (full deck or incremental patch). * `input.continueAfterInterruption` marks reruns of an interrupted turn. * `input.completionRecovery` is a stronger host-verified continuation after @@ -598,11 +486,7 @@ function buildAgentPrompt(input) { if (input?.phase === 'plan') prompt = buildPlanPrompt(input); else if (input?.phase === 'slides') { prompt = input?.inSession ? buildSessionSlidePrompt(input) : buildSlidesPrompt(input); - } else if (input?.phase === 'repair') prompt = buildRepairPrompt(input); - else if (input?.phase === 'audit') { - prompt = input?.inSession ? buildSessionAuditPrompt(input) : buildAuditPrompt(input); - } - else prompt = buildLegacyPrompt(input); + } else prompt = buildLegacyPrompt(input); if (input?.completionRecovery) { prompt = buildCompletionRecoveryPrefix(input.completionRecovery) + prompt; } else if (input?.continueAfterInterruption) { diff --git a/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/ui.js b/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/ui.js index c40bce7e4..3abc059f2 100644 --- a/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/ui.js +++ b/src/crates/contracts/product-domains/src/miniapp/builtin/assets/ppt-live/ui.js @@ -29,7 +29,6 @@ import { prepareSlidesForPptxExport, slideExportHtml, EXPORT_VIEWPORT, - validateSlideForPptxGeneration, } from './src/export-slide-browser.js'; import { exportPdfFromBase64Pages, @@ -310,7 +309,6 @@ function resetGeneration() { state.generation.eventSeq = 0; state.generation.steps = state.generation.steps.map((step) => ({ ...step, status: 'pending' })); state.generation.events = []; - resetSlideValidationCache(''); renderGeneration(state); renderGenerationOverlay(state); } @@ -680,8 +678,6 @@ const PPT_BACKEND_MAX_ATTEMPTS = 4; const PPT_BACKEND_CONTINUATION_MAX_ATTEMPTS = 8; const PPT_BACKEND_TOTAL_STAGE_ATTEMPTS = PPT_BACKEND_MAX_ATTEMPTS + PPT_BACKEND_CONTINUATION_MAX_ATTEMPTS; -// Whole-deck Agent audit is slow; skip phase 3 until the audit path is fast enough. -const PPT_LIVE_FINAL_AUDIT_ENABLED = false; const PPT_RETRY_DELAY_MS = 750; function stageAttemptInfo(attempt) { @@ -727,40 +723,6 @@ function recoveryExhaustedError(stageKey, lastError, failures = [], stageVars = return error; } -/** Per-run cache: validated slide html fingerprints keyed by runId:slideNumber. */ -const slideValidationCache = new Map(); -let slideValidationRunId = ''; - -function slideHtmlFingerprint(html) { - const raw = String(html || ''); - let hash = 0; - for (let i = 0; i < raw.length; i += 1) { - hash = ((hash << 5) - hash + raw.charCodeAt(i)) | 0; - } - return String(hash); -} - -function resetSlideValidationCache(runId = '') { - slideValidationCache.clear(); - slideValidationRunId = runId || ''; -} - -function slideValidationCacheKey(slideNumber) { - return `${slideValidationRunId}:${slideNumber}`; -} - -function rememberValidatedSlide(slideNumber, html) { - slideValidationCache.set(slideValidationCacheKey(slideNumber), slideHtmlFingerprint(html)); -} - -function slideAlreadyValidated(slideNumber, html) { - return slideValidationCache.get(slideValidationCacheKey(slideNumber)) === slideHtmlFingerprint(html); -} - -function slidePlanId(slidePlan, slideNumber) { - return String(slidePlan?.slideId || slidePlan?.id || `slide-${String(slideNumber).padStart(2, '0')}`); -} - function isRetryableBackendError(error) { const raw = String(error?.message || error || ''); if (isStoppedBackendError(error)) return false; @@ -938,32 +900,6 @@ async function tryReadDeckJsonFile(project, relPath) { } } -async function inspectDeckJsonFile(project, relPath) { - try { - const raw = String(await readDeckProjectFile(project, relPath) || ''); - if (!raw.trim()) { - return { status: 'empty', value: null, reason: `${relPath} exists but is empty.` }; - } - try { - return { status: 'valid', value: extractBackendJson(raw), reason: '' }; - } catch (error) { - return { - status: 'invalid', - value: null, - reason: `${relPath} is not valid JSON: ${backendErrorDetail(error) || 'parse failed'}.`, - }; - } - } catch (error) { - return { - status: 'missing', - value: null, - reason: `${relPath} was not created or could not be read: ${ - backendErrorDetail(error) || 'file unavailable' - }.`, - }; - } -} - /** Parsed `project.json`, or null when missing or not yet valid JSON. */ async function tryReadDeckPlanFile(project) { return await tryReadDeckJsonFile(project, 'project.json'); @@ -1035,54 +971,6 @@ function planningEvidenceIssues(toolTrace, style) { return issues; } -function auditWriteEvidenceIssues(toolTrace) { - const trace = Array.isArray(toolTrace) ? toolTrace : []; - const writeStarts = trace.filter((entry) => { - if (entry.eventType !== 'Started') return false; - const name = String(entry.toolName || '').toLowerCase(); - const params = toolTraceParams(entry); - const path = String(params.file_path || params.path || ''); - return (name === 'write' || name === 'filewrite') && path.endsWith('quality-report.json'); - }); - if (!writeStarts.length) { - return ['The Agent turn ended without calling Write for quality-report.json.']; - } - const terminalById = new Map( - trace - .filter((entry) => entry.toolId && ['Completed', 'Failed', 'Cancelled'].includes(entry.eventType)) - .map((entry) => [entry.toolId, entry]), - ); - const completed = writeStarts.some((entry) => terminalById.get(entry.toolId)?.eventType === 'Completed'); - if (completed) return []; - const failed = writeStarts - .map((entry) => terminalById.get(entry.toolId)) - .find((entry) => entry?.eventType === 'Failed' || entry?.eventType === 'Cancelled'); - if (failed) { - return [ - `The quality-report.json Write tool did not complete: ${ - backendErrorDetail(failed.error) || failed.eventType - }.`, - ]; - } - return ['The quality-report.json Write tool started but no completion event was observed.']; -} - -function auditTurnCompletionIssue(completion) { - if (!completion) return ''; - const finishReason = String(completion.finishReason || '').trim(); - const partialReason = String(completion.partialRecoveryReason || '').trim(); - if (completion.success === false) { - return `The Agent turn reported success=false${finishReason ? ` (${finishReason})` : ''}.`; - } - if (partialReason) { - return `The Agent turn ended after partial recovery: ${partialReason}.`; - } - if (finishReason && !['complete', 'completed', 'final_answer'].includes(finishReason.toLowerCase())) { - return `The Agent turn stopped with finish reason "${finishReason}".`; - } - return ''; -} - /** Best-effort: drop old deck project dirs so appdata storage stays bounded. */ async function pruneOldDeckProjects(currentRunId) { const fs = runtime().fs; @@ -1582,77 +1470,10 @@ async function runStagedPlanPhase(operation, instruction, project = null) { throw lastError; } -async function validateAndRepairSlide({ - operation, - planContext, - slidePlan, - slideNumber, - session, - project, - html, -}) { - let currentHtml = html; - const maxRepairAttempts = 2; - if (slideAlreadyValidated(slideNumber, currentHtml)) { - return { - html: currentHtml, - quality: { score: 100, issues: [] }, - }; - } - for (let repairAttempt = 0; repairAttempt <= maxRepairAttempts; repairAttempt += 1) { - const validation = await validateSlideForPptxGeneration(currentHtml); - if (validation.valid) { - rememberValidatedSlide(slideNumber, currentHtml); - return { - html: currentHtml, - quality: { score: 100, issues: [] }, - }; - } - if (repairAttempt >= maxRepairAttempts) { - throw new Error( - `PPT Live slide ${slideNumber} failed editable-PPTX validation: ${ - validation.issues.map((issue) => issue.message).join(' ') - }`, - ); - } - - addGenerationEvent({ - title: t('generationSlideRepair', { - slide: slideNumber, - attempt: repairAttempt + 1, - max: maxRepairAttempts, - }), - detail: compactText(validation.issues.map((issue) => issue.message).join(' '), 260), - kind: 'error', - }); - const repairTurn = await executeBackendTurn({ - operation, - locale: getLocale(), - phase: 'repair', - assignedSlide: slidePlan, - validationIssues: validation.issues, - generationContract: liveGenerationContract(planContext), - design: livePlanContextDesign(planContext), - style: livePlanContextStyle(planContext), - }, {}, { - sessionId: session?.id || undefined, - appDataWorkspace: project?.workspaceSubdir, - resultKind: 'text', - }); - if (session && repairTurn.sessionId) session.id = repairTurn.sessionId; - currentHtml = await tryReadDeckSlideFile(project, slideNumber); - if (!currentHtml) { - throw new Error(`PPT Live repair turn did not rewrite slide ${slideNumber}`); - } - } - throw new Error(`PPT Live slide ${slideNumber} validation did not finish`); -} - /** * Render one slide. The normal path submits a lightweight turn INTO the * planning session (`session.id`), where the ppt-design skill, style preset, - * research, and plan already live. The final audit reuses the pinned - * skill-derived project contract before accepting the deck. + * research, and plan already live. * With the file protocol (`project` set) the agent writes * `slides/slide-NN.html` in the deck project directory and ui.js reads it * back; a file that landed on disk before a failure is recovered without @@ -1678,16 +1499,7 @@ async function runStagedSlide({ operation, planContext, slidePlan, slideNumber, // The failed turn may have written the slide file before dying. const recovered = await tryReadDeckSlideFile(project, slideNumber); if (recovered) { - const repaired = await validateAndRepairSlide({ - operation, - planContext, - slidePlan, - slideNumber, - session, - project, - html: recovered, - }); - return slideFromHtml(repaired.html, repaired.quality); + return slideFromHtml(recovered); } } addGenerationEvent({ @@ -1763,16 +1575,7 @@ async function runStagedSlide({ operation, planContext, slidePlan, slideNumber, if (!html) { throw new Error(`PPT Live slide ${slideNumber} file is missing or incomplete`); } - const repaired = await validateAndRepairSlide({ - operation, - planContext, - slidePlan, - slideNumber, - session, - project, - html, - }); - return slideFromHtml(repaired.html, repaired.quality); + return slideFromHtml(html); } const slides = Array.isArray(payload?.slides) ? payload.slides : []; const slide = slides.find((candidate) => slidePlanNumber(candidate, NaN) === slideNumber) || slides[0]; @@ -1815,165 +1618,6 @@ async function runStagedSlide({ operation, planContext, slidePlan, slideNumber, throw lastError; } -async function runFinalDeckAudit({ - operation, - planContext, - slidePlans, - session, - project, -}) { - let auditComplete = false; - let lastAuditError = null; - let auditReport = null; - let auditIssues = []; - const failures = []; - for (let attempt = 1; attempt <= PPT_BACKEND_TOTAL_STAGE_ATTEMPTS; attempt += 1) { - try { - const attemptInfo = stageAttemptInfo(attempt); - if (attempt > 1) { - const status = attemptInfo.continuation - ? t('generationRecoveryContinuing', { - stage: t('generationStageAudit'), - attempt: attemptInfo.continuationAttempt, - max: PPT_BACKEND_CONTINUATION_MAX_ATTEMPTS, - }) - : t('generationAuditRetry', { - attempt, - max: PPT_BACKEND_MAX_ATTEMPTS, - }); - addGenerationEvent({ - title: status, - detail: auditIssues.join(' ') || backendErrorDetail(lastAuditError), - kind: 'error', - }); - setStatus(status); - await new Promise((resolve) => setTimeout(resolve, retryDelayMs(lastAuditError, attempt))); - } - const completionRecovery = completionRecoveryInput( - 'audit', - attempt, - lastAuditError, - auditIssues, - ); - const auditTurn = await executeBackendTurn({ - operation, - locale: getLocale(), - phase: 'audit', - inSession: Boolean(session?.id), - generationContract: liveGenerationContract(planContext), - design: livePlanContextDesign(planContext), - style: livePlanContextStyle(planContext), - slideOrder: planContext.slideOrder, - slidePlans, - ...(auditIssues.length ? { auditIssues } : {}), - ...(completionRecovery ? { completionRecovery } : {}), - }, {}, { - sessionId: session?.id || undefined, - appDataWorkspace: project?.workspaceSubdir, - resultKind: 'text', - }); - if (session && auditTurn.sessionId) session.id = auditTurn.sessionId; - - if (!session?.id) { - const evidenceIssues = planningEvidenceIssues(auditTurn.toolTrace, planContext.style); - if (evidenceIssues.length) { - throw new Error(`PPT Live final audit compliance failed: ${evidenceIssues.join(' ')}`); - } - } - const reportInspection = await inspectDeckJsonFile(project, 'quality-report.json'); - auditReport = reportInspection.value; - const checkedSlides = new Set( - Array.isArray(auditReport?.checkedSlides) ? auditReport.checkedSlides.map(String) : [], - ); - const missingSlides = (planContext.slideOrder || []) - .map(String) - .filter((slideId) => !checkedSlides.has(slideId)); - const verificationIssues = []; - if (reportInspection.status !== 'valid') { - verificationIssues.push(reportInspection.reason); - } else if (auditReport?.status !== 'passed') { - verificationIssues.push( - `quality-report.json status is "${String(auditReport?.status || 'missing')}", not "passed".`, - ); - } - if (missingSlides.length) { - verificationIssues.push( - `quality-report.json did not confirm these slide ids: ${missingSlides.join(', ')}.`, - ); - } - if (verificationIssues.length) { - verificationIssues.push(...auditWriteEvidenceIssues(auditTurn.toolTrace)); - const completionIssue = auditTurnCompletionIssue(auditTurn.completion); - if (completionIssue) verificationIssues.push(completionIssue); - const reply = compactText(auditTurn.text || '', 180); - if (reply) verificationIssues.push(`Agent reply: ${reply}`); - const verificationError = new Error( - `PPT Live final audit verification failed: ${verificationIssues.join(' ')}`, - ); - verificationError.pptLiveAuditIssues = verificationIssues; - throw verificationError; - } - auditComplete = true; - break; - } catch (error) { - lastAuditError = error; - failures.push(error); - auditIssues = Array.isArray(error?.pptLiveAuditIssues) - ? error.pptLiveAuditIssues - : [backendErrorDetail(error)].filter(Boolean); - if (session && isUnknownSessionBackendError(error)) session.id = null; - if (!isRetryableBackendError(error)) throw error; - if (attempt >= PPT_BACKEND_TOTAL_STAGE_ATTEMPTS) { - throw recoveryExhaustedError('generationStageAudit', error, failures); - } - runtime().log?.warn?.('PPT Live final deck audit failed, retrying', { - attempt, - maxAttempts: PPT_BACKEND_TOTAL_STAGE_ATTEMPTS, - continueInSession: Boolean(session?.id), - error: String(error), - }); - } - } - if (!auditComplete) throw lastAuditError || new Error('PPT Live final audit did not finish'); - - const fixedSlideIds = new Set( - Array.isArray(auditReport?.fixedSlides) ? auditReport.fixedSlides.map(String) : [], - ); - const auditedSlides = []; - for (const slidePlan of slidePlans) { - const slideNumber = slidePlan.slideNumber; - const html = await tryReadDeckSlideFile(project, slideNumber); - if (!html) throw new Error(`PPT Live final audit lost slide ${slideNumber}`); - const slideId = slidePlanId(slidePlan, slideNumber); - if (!fixedSlideIds.has(slideId) && slideAlreadyValidated(slideNumber, html)) { - auditedSlides.push({ - ...slidePlan, - id: `ppt-live-slide-${slideNumber}`, - slideNumber, - html, - quality: { score: 100, issues: [] }, - }); - continue; - } - const repaired = await validateAndRepairSlide({ - operation, - planContext, - slidePlan, - slideNumber, - session, - project, - html, - }); - auditedSlides.push({ - ...slidePlan, - id: `ppt-live-slide-${slideNumber}`, - slideNumber, - html: repaired.html, - quality: repaired.quality, - }); - } - return auditedSlides; -} async function runStagedDeckGeneration(operation, instruction) { const runEpoch = deckEpoch; @@ -1990,7 +1634,6 @@ async function runStagedDeckGeneration(operation, instruction) { // ppt-design skill's native `project.json` + `slides/slide-NN.html` layout. const project = backendUsesFileProtocol() ? newDeckProject() : null; if (project) { - resetSlideValidationCache(project.runId); await pruneOldDeckProjects(project.runId); } @@ -2127,22 +1770,7 @@ async function runStagedDeckGeneration(operation, instruction) { } const orderedReadySlides = [...readySlides].sort((a, b) => a.slideNumber - b.slideNumber); - - // Phase 3 (optional): whole-deck skill/style audit, followed by deterministic - // editable-PPTX validation of every possibly rewritten page. - let finalSlides = orderedReadySlides; - if (PPT_LIVE_FINAL_AUDIT_ENABLED) { - addGenerationEvent({ title: t('generationAuditPhase'), detail: '', kind: 'phase' }); - setGenerationStep('design', 'running', t('generationAuditPhase')); - setStatus(t('generationAuditPhase')); - finalSlides = await runFinalDeckAudit({ - operation, - planContext, - slidePlans: normalizedPlans, - session, - project, - }); - } + const finalSlides = orderedReadySlides; state.agentSession.id = session.id || state.agentSession.id; // Phase 4: finalize the complete deck and persist once.