import { readFileSync, writeFileSync } from 'node:fs' import { join, dirname } from 'node:path' import { fileURLToPath } from 'node:url' const root = join(dirname(fileURLToPath(import.meta.url)), '..') const pages = [ { file: 'pages/patient-guide/china-healthcare-a-foreigners-definitive-guide.vue', bundle: 'chinaHealthcareForeignerContentBundle', module: 'china-healthcare-foreigner-content', heroField: 'foreignerHealthcareHero.title', zhMarker: '国际患者', keys: [ 'foreignerHealthcareHero', 'triageIntro', 'triageCategories', 'section1Banner', 'hospitalSelectionIntro', 'hospitalTypeTable', 'hospitalRegistryNote', 'section2Banner', 'section3Banner', 'appointmentAccess', 'section4Banner', 'clinicalPreparation', 'section5Banner', 'clinicalWorkflow', 'section6Banner', 'financialAdmin', 'section7Banner', 'postTreatment', 'section8Banner', 'logisticalGuidelines', 'conciergeSection', 'foreignerHealthcareFaq', 'foreignerHealthcareClosing' ], head: { zhTitle: '国际患者中国医疗旅游指南 | UMedGlobal', enTitle: "China Healthcare: A Foreigner's Definitive Guide | UMedGlobal", zhDesc: '外籍人士使用中国医疗体系的完整指南:分诊、选院、预约、临床流程、支付、随访及医疗礼宾支持。', enDesc: "Definitive guide for foreigners navigating China's healthcare system: triage, hospital selection, appointments, clinical workflow, payments, follow-up, and concierge support for medical tourism." } }, { file: 'pages/patient-guide/china-medical-tourism-visa-guide.vue', bundle: 'visaGuideContentBundle', module: 'visa-guide-content', heroField: 'visaGuideHero.title', zhMarker: '中国医疗旅游', keys: [ 'visaGuideHero', 'visaGuideBanner', 'visaClassification', 'visaByComplexity', 'visaGuideCrossLinks', 'visaFreeOverview', 'visaFreePriority', 'keyConsiderations', 'visaAdminBody', 'adminSupportBanner', 'visaGuidelinesTable', 'visaFreeCompareTable', 'visaGuideReferences', 'visaGuideFaq', 'visaGuideClosing' ], head: { zhTitle: '中国医疗旅游签证指南 | UMedGlobal', enTitle: 'China Medical Tourism Visa Guide | UMedGlobal', zhDesc: '中国医疗旅游签证指南:L、S2、S1 签证类别、免签入境政策及国际患者行政支持。', enDesc: 'Guide to China medical tourism visas: L, S2, and S1 visa categories, visa-free entry policies, and administrative support for international patients seeking treatment in China.' } }, { file: 'pages/patient-guide/how-to-get-china-medical-s1-s2-visa.vue', bundle: 's1s2VisaContentBundle', module: 's1-s2-visa-content', heroField: 's1s2Hero.title', zhMarker: '中国医疗签证', keys: [ 's1s2Hero', 's1s2ClassificationBanner', 's1s2Classification', 's1s2Overview', 's1Visa', 's2Visa', 's1s2Extension', 's1s2CompareTable', 's1s2MedicalCert', 's1s2ApplicationGuide', 's1s2AdminSpecs', 's1s2SubmissionGuidelines', 's1s2Summary', 's1s2Faq', 's1s2Closing' ], head: { zhTitle: '如何申请中国医疗 S1/S2 签证 | UMedGlobal', enTitle: 'How To Get China Medical S1/S2 Visa | UMedGlobal', zhDesc: '中国 S1/S2 医疗签证分步指南:资格、材料、申请流程、延期及 UMedGlobal 礼宾支持。', enDesc: 'Step-by-step guide to China S1 and S2 medical visas: eligibility, documentation, application procedures, extensions, and UMedGlobal concierge support for international patients.' } }, { file: 'pages/patient-guide/explore-china-visa-free.vue', bundle: 'exploreChinaVisaFreeContentBundle', module: 'explore-china-visa-free-content', heroField: 'visaFreeHero.title', zhMarker: '免签入境', keys: [ 'visaFreeHero', 'visaFreeAccessBanner', 'visaFreeAccessIntro', 'whyChinaMedical', 'visaFreeEligibility', 'adminGuidelines', 'policyBackground', 'umedFacilitation', 'medicalServicesAccessible', 'medicalServicesCta', 'countriesTableBanner', 'countriesTable', 'mutualExemptionNote', 'visaFreeReferences', 'visaFreeFaq', 'visaFreeClosing' ], head: { zhTitle: '探索中国免签:医疗出行门户 | UMedGlobal', enTitle: 'Explore China Visa-Free: Your Gateway to Medical Care | UMedGlobal', zhDesc: '中国 30 天免签入境政策指南:各国资格、入境要求、可及治疗及 UMedGlobal 礼宾支持。', enDesc: "Guide to China's 30-day visa-free entry policy for international medical patients: eligibility by country, entry requirements, accessible treatments, and UMedGlobal concierge support." } }, { file: 'pages/patient-guide/how-to-set-up-use-alipay-for-medical-tourism.vue', bundle: 'alipayPayContentBundle', module: 'alipay-pay-content', heroField: 'alipayPayHero.pageTitle', zhMarker: '支付宝', keys: [ 'alipayPayHero', 'alipayPayRoleBanner', 'alipayPayRole', 'alipayPayRegistrationBanner', 'alipayPayRegistration', 'alipayPayFinancialBanner', 'alipayPayFinancial', 'alipayPayUsageBanner', 'alipayPayUsage', 'alipayPayConstraintsBanner', 'alipayPayConstraints', 'alipayPayChallengesBanner', 'alipayPayChallenges', 'alipayPayConcierge', 'alipayPayRegulatoryBanner', 'alipayPayRegulatory', 'alipayPayFaq', 'alipayPayClosing' ], head: { zhTitle: '支付宝设置与使用指南(医疗旅游)| UMedGlobal', enTitle: 'How to Set Up & Use Alipay for Medical Tourism | UMedGlobal', zhDesc: '医疗旅游支付宝指南:注册、实名认证、绑定国际卡、TourCard、扫码支付、限额及礼宾支持。', enDesc: 'Guide to setting up and using Alipay for medical tourism in China: registration, KYC, international card linking, TourCard, QR payments, limits, and UMedGlobal concierge support.' } }, { file: 'pages/patient-guide/secure-convenient-wechat-pay-for-medical-tourism.vue', bundle: 'wechatPayContentBundle', module: 'wechat-pay-content', heroField: 'wechatPayHero.pageTitle', zhMarker: '微信支付', keys: [ 'wechatPayHero', 'wechatPayRoleBanner', 'wechatPayRole', 'wechatPayLogisticalBanner', 'wechatPayLogistical', 'wechatPayImplementationBanner', 'wechatPaySection1', 'wechatPaySection2', 'wechatPaySection3', 'wechatPaySection4', 'wechatPaySection5', 'wechatPaySection6', 'wechatPaySection7', 'wechatPaySection8', 'wechatPaySection9', 'wechatPaySection10', 'wechatPaySupportBanner', 'wechatPaySupport', 'wechatPayFaq', 'wechatPayClosing' ], head: { zhTitle: '微信支付指南(医疗旅游)| UMedGlobal', enTitle: 'Secure & Convenient WeChat Pay for Medical Tourism | UMedGlobal', zhDesc: '医疗旅游微信支付指南:绑卡、交易限额、TourCard、费用、安全及 UMedGlobal 礼宾支持。', enDesc: 'Guide to setting up and using WeChat Pay for medical tourism in China: card linking, transaction limits, TourCard, fees, security, and UMedGlobal concierge support.' } } ] function buildScript(page) { const { bundle, module, heroField, zhMarker, head } = page return `` } function prefixKeys(template, keys) { let result = template const sorted = [...keys].sort((a, b) => b.length - a.length) for (const key of sorted) { result = result.replace(new RegExp(`(?') if (endScript === -1) throw new Error(`No script in ${page.file}`) const templateAndStyle = raw.slice(endScript + ''.length) const wired = buildScript(page) + prefixKeys(templateAndStyle, page.keys) writeFileSync(path, wired, 'utf8') console.log('Updated', page.file) }