privateuserh commited on
Commit
6302863
·
verified ·
1 Parent(s): ff3d24d

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +950 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Privfin Vbeta1 04
3
- emoji: 🔥
4
- colorFrom: yellow
5
- colorTo: blue
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: privfin-vbeta1-04
3
+ emoji: 🐳
4
+ colorFrom: green
5
+ colorTo: green
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,950 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Global Trade Fin. Calculator</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ .floating-btn {
11
+ position: fixed;
12
+ bottom: 30px;
13
+ right: 30px;
14
+ width: 60px;
15
+ height: 60px;
16
+ border-radius: 50%;
17
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
18
+ transition: all 0.3s ease;
19
+ z-index: 1000;
20
+ }
21
+ .floating-btn:hover {
22
+ transform: translateY(-5px) scale(1.05);
23
+ box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
24
+ }
25
+ .floating-btn-secondary {
26
+ position: fixed;
27
+ bottom: 100px;
28
+ right: 30px;
29
+ width: 60px;
30
+ height: 60px;
31
+ border-radius: 50%;
32
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
33
+ transition: all 0.3s ease;
34
+ z-index: 1000;
35
+ }
36
+ .floating-btn-secondary:hover {
37
+ transform: translateY(-5px) scale(1.05);
38
+ box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
39
+ }
40
+ .floating-btn-tertiary {
41
+ position: fixed;
42
+ bottom: 170px;
43
+ right: 30px;
44
+ width: 60px;
45
+ height: 60px;
46
+ border-radius: 50%;
47
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
48
+ transition: all 0.3s ease;
49
+ z-index: 1000;
50
+ }
51
+ .floating-btn-tertiary:hover {
52
+ transform: translateY(-5px) scale(1.05);
53
+ box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
54
+ }
55
+ .floating-btn-quaternary {
56
+ position: fixed;
57
+ bottom: 240px;
58
+ right: 30px;
59
+ width: 60px;
60
+ height: 60px;
61
+ border-radius: 50%;
62
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
63
+ transition: all 0.3s ease;
64
+ z-index: 1000;
65
+ }
66
+ .floating-btn-quaternary:hover {
67
+ transform: translateY(-5px) scale(1.05);
68
+ box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
69
+ }
70
+ .modal {
71
+ transition: all 0.3s ease;
72
+ opacity: 0;
73
+ visibility: hidden;
74
+ }
75
+ .modal.active {
76
+ opacity: 1;
77
+ visibility: visible;
78
+ }
79
+ .tariff-slider::-webkit-slider-thumb {
80
+ -webkit-appearance: none;
81
+ width: 20px;
82
+ height: 20px;
83
+ border-radius: 50%;
84
+ background: #3B82F6;
85
+ cursor: pointer;
86
+ }
87
+ .animate-pulse {
88
+ animation: pulse 2s infinite;
89
+ }
90
+ @keyframes pulse {
91
+ 0% { transform: scale(1); }
92
+ 50% { transform: scale(1.05); }
93
+ 100% { transform: scale(1); }
94
+ }
95
+ .market-share-gauge {
96
+ width: 100%;
97
+ height: 20px;
98
+ background: linear-gradient(90deg, #ef4444 0%, #f59e0b 50%, #10b981 100%);
99
+ border-radius: 10px;
100
+ margin-top: 10px;
101
+ position: relative;
102
+ }
103
+ .gauge-pointer {
104
+ position: absolute;
105
+ top: -5px;
106
+ width: 2px;
107
+ height: 30px;
108
+ background: black;
109
+ transform: translateX(-50%);
110
+ }
111
+ .tariff-badge {
112
+ display: inline-block;
113
+ padding: 0.25rem 0.5rem;
114
+ border-radius: 9999px;
115
+ font-size: 0.75rem;
116
+ font-weight: 600;
117
+ }
118
+ .token-progress {
119
+ height: 10px;
120
+ border-radius: 5px;
121
+ background-color: #e5e7eb;
122
+ overflow: hidden;
123
+ }
124
+ .token-progress-bar {
125
+ height: 100%;
126
+ background: linear-gradient(90deg, #8b5cf6, #6366f1);
127
+ transition: width 0.3s ease;
128
+ }
129
+ .yield-farming-card {
130
+ background: linear-gradient(135deg, #f5f7fa 0%, #e4e7eb 100%);
131
+ border-radius: 12px;
132
+ padding: 1.5rem;
133
+ position: relative;
134
+ overflow: hidden;
135
+ }
136
+ .yield-farming-card::before {
137
+ content: "";
138
+ position: absolute;
139
+ top: -50%;
140
+ left: -50%;
141
+ width: 200%;
142
+ height: 200%;
143
+ background: linear-gradient(45deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
144
+ transform: rotate(45deg);
145
+ animation: shine 3s infinite;
146
+ }
147
+ @keyframes shine {
148
+ 0% { transform: translateX(-100%) rotate(45deg); }
149
+ 100% { transform: translateX(100%) rotate(45deg); }
150
+ }
151
+ .bitcoin-address {
152
+ font-family: monospace;
153
+ letter-spacing: 1px;
154
+ }
155
+ .mining-estimate {
156
+ background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
157
+ border-left: 4px solid #f59e0b;
158
+ }
159
+ .country-flag {
160
+ width: 24px;
161
+ height: 16px;
162
+ display: inline-block;
163
+ margin-right: 8px;
164
+ border: 1px solid #e5e7eb;
165
+ vertical-align: middle;
166
+ }
167
+ .tariff-impact-meter {
168
+ height: 8px;
169
+ border-radius: 4px;
170
+ background-color: #e5e7eb;
171
+ margin-top: 8px;
172
+ overflow: hidden;
173
+ }
174
+ .tariff-impact-bar {
175
+ height: 100%;
176
+ background: linear-gradient(90deg, #10b981, #3B82F6);
177
+ }
178
+ .credit-rating-badge {
179
+ display: inline-flex;
180
+ align-items: center;
181
+ padding: 0.25rem 0.5rem;
182
+ border-radius: 9999px;
183
+ font-size: 0.75rem;
184
+ font-weight: 600;
185
+ }
186
+ .economic-indicator {
187
+ display: flex;
188
+ justify-content: space-between;
189
+ padding: 0.5rem 0;
190
+ border-bottom: 1px solid #e5e7eb;
191
+ }
192
+ .economic-indicator:last-child {
193
+ border-bottom: none;
194
+ }
195
+ .credit-rating-AAA { background-color: #10b981; color: white; }
196
+ .credit-rating-AA { background-color: #34d399; color: white; }
197
+ .credit-rating-A { background-color: #60a5fa; color: white; }
198
+ .credit-rating-BBB { background-color: #f59e0b; color: white; }
199
+ .credit-rating-BB { background-color: #f97316; color: white; }
200
+ .credit-rating-B { background-color: #ef4444; color: white; }
201
+ .credit-rating-CCC { background-color: #dc2626; color: white; }
202
+ .credit-rating-CC { background-color: #991b1b; color: white; }
203
+ .credit-rating-C { background-color: #7c3aed; color: white; }
204
+ .credit-rating-D { background-color: #000000; color: white; }
205
+ </style>
206
+ </head>
207
+ <body class="bg-gray-50 min-h-screen">
208
+ <div class="container mx-auto px-4 py-12 max-w-4xl">
209
+ <div class="text-center mb-12">
210
+ <h1 class="text-4xl font-bold text-blue-800 mb-2">Global Trade Finance Calculator</h1>
211
+ <p class="text-lg text-gray-600">Calculate trade financing costs with real-world tariff rates</p>
212
+ </div>
213
+
214
+ <div class="bg-white rounded-xl shadow-lg p-6 mb-8">
215
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
216
+ <div>
217
+ <label class="block text-gray-700 font-medium mb-2">Trade Amount ($)</label>
218
+ <input type="number" id="loanAmount" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="e.g. 100000" value="100000">
219
+ </div>
220
+
221
+ <div>
222
+ <label class="block text-gray-700 font-medium mb-2">Base Interest Rate (%)</label>
223
+ <input type="number" id="primeRate" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="e.g. 7.5" value="7.5" step="0.01">
224
+ </div>
225
+ </div>
226
+
227
+ <div class="mt-6">
228
+ <label class="block text-gray-700 font-medium mb-2">Importing Country</label>
229
+ <select id="importCountry" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 mb-4">
230
+ <option value="US">United States</option>
231
+ <option value="EU">European Union</option>
232
+ <option value="CN">China</option>
233
+ <option value="JP">Japan</option>
234
+ <option value="CA">Canada</option>
235
+ <option value="MX">Mexico</option>
236
+ <option value="IN">India</option>
237
+ <option value="BR">Brazil</option>
238
+ </select>
239
+ </div>
240
+
241
+ <div class="mt-2">
242
+ <label class="block text-gray-700 font-medium mb-2">Product Category</label>
243
+ <select id="industrySelect" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
244
+ <option value="">Select a product category</option>
245
+ <option value="steel">Steel & Aluminum</option>
246
+ <option value="agriculture">Agricultural Products</option>
247
+ <option value="automotive">Automotive & Parts</option>
248
+ <option value="electronics">Consumer Electronics</option>
249
+ <option value="textiles">Textiles & Apparel</option>
250
+ <option value="chemicals">Chemicals</option>
251
+ <option value="machinery">Industrial Machinery</option>
252
+ <option value="pharmaceuticals">Pharmaceuticals</option>
253
+ <option value="custom">Custom Tariff</option>
254
+ </select>
255
+ </div>
256
+
257
+ <div class="mt-6 hidden" id="customTariffSection">
258
+ <label class="block text-gray-700 font-medium mb-2">Custom Tariff Percentage (0-100%)</label>
259
+ <input type="range" id="tariffSlider" min="0" max="100" value="5" class="w-full tariff-slider h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
260
+ <div class="flex justify-between mt-2">
261
+ <span class="text-sm text-gray-500">0%</span>
262
+ <span id="tariffValue" class="font-medium text-blue-600">5%</span>
263
+ <span class="text-sm text-gray-500">100%</span>
264
+ </div>
265
+ </div>
266
+
267
+ <div class="mt-6 bg-blue-50 p-4 rounded-lg">
268
+ <div class="flex justify-between items-center">
269
+ <span class="text-blue-700 font-medium">Total Tariff Impact:</span>
270
+ <span id="totalTariffDisplay" class="text-xl font-bold text-blue-800">$0 (0%)</span>
271
+ </div>
272
+ <div id="tariffBreakdown" class="mt-2 text-sm text-blue-600">
273
+ <!-- Tariff breakdown will appear here -->
274
+ </div>
275
+ <div id="tariffImpactMeter" class="tariff-impact-meter hidden">
276
+ <div id="tariffImpactBar" class="tariff-impact-bar" style="width: 0%"></div>
277
+ </div>
278
+ </div>
279
+
280
+ <div class="mt-8">
281
+ <button id="calculateBtn" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300 transform hover:scale-105 animate-pulse">
282
+ Calculate Trade Financing
283
+ </button>
284
+ </div>
285
+ </div>
286
+
287
+ <div id="results" class="bg-white rounded-xl shadow-lg p-6 hidden">
288
+ <h2 class="text-2xl font-bold text-gray-800 mb-4">Trade Finance Summary</h2>
289
+
290
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
291
+ <div class="bg-blue-50 p-4 rounded-lg">
292
+ <p class="text-sm text-blue-600 font-medium">Total Financing Needed</p>
293
+ <p id="totalLoan" class="text-2xl font-bold text-blue-800">$105,000</p>
294
+ </div>
295
+ <div class="bg-green-50 p-4 rounded-lg">
296
+ <p class="text-sm text-green-600 font-medium">Effective Interest Rate</p>
297
+ <p id="effectiveRate" class="text-2xl font-bold text-green-800">7.88%</p>
298
+ </div>
299
+ <div class="bg-purple-50 p-4 rounded-lg">
300
+ <p class="text-sm text-purple-600 font-medium">Monthly Payment</p>
301
+ <p id="monthlyPayment" class="text-2xl font-bold text-purple-800">$2,123</p>
302
+ </div>
303
+ </div>
304
+
305
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
306
+ <div class="bg-yellow-50 p-4 rounded-lg">
307
+ <p class="text-sm text-yellow-600 font-medium">Total Tariff Cost</p>
308
+ <p id="totalTariffCost" class="text-xl font-bold text-yellow-800">$5,000</p>
309
+ </div>
310
+ <div class="bg-red-50 p-4 rounded-lg">
311
+ <p class="text-sm text-red-600 font-medium">Total Interest Cost</p>
312
+ <p id="totalInterestCost" class="text-xl font-bold text-red-800">$12,345</p>
313
+ </div>
314
+ </div>
315
+
316
+ <h3 class="text-lg font-semibold text-gray-700 mb-3">5-Year Amortization Schedule</h3>
317
+ <div class="overflow-x-auto">
318
+ <table class="min-w-full bg-white rounded-lg overflow-hidden">
319
+ <thead class="bg-gray-100">
320
+ <tr>
321
+ <th class="py-3 px-4 text-left text-gray-600">Year</th>
322
+ <th class="py-3 px-4 text-right text-gray-600">Principal</th>
323
+ <th class="py-3 px-4 text-right text-gray-600">Interest</th>
324
+ <th class="py-3 px-4 text-right text-gray-600">Balance</th>
325
+ </tr>
326
+ </thead>
327
+ <tbody id="amortizationTable" class="divide-y divide-gray-200">
328
+ <!-- Amortization data will be inserted here -->
329
+ </tbody>
330
+ </table>
331
+ </div>
332
+ </div>
333
+ </div>
334
+
335
+ <!-- Floating Buttons -->
336
+ <button id="buyDownBtn" class="floating-btn bg-blue-600 text-white flex items-center justify-center hover:bg-blue-700">
337
+ <i class="fas fa-percentage text-2xl"></i>
338
+ </button>
339
+
340
+ <button id="marketShareBtn" class="floating-btn-secondary bg-green-600 text-white flex items-center justify-center hover:bg-green-700">
341
+ <i class="fas fa-chart-pie text-2xl"></i>
342
+ </button>
343
+
344
+ <button id="tokenMintBtn" class="floating-btn-tertiary bg-purple-600 text-white flex items-center justify-center hover:bg-purple-700">
345
+ <i class="fas fa-coins text-2xl"></i>
346
+ </button>
347
+
348
+ <button id="creditRatingBtn" class="floating-btn-quaternary bg-amber-600 text-white flex items-center justify-center hover:bg-amber-700">
349
+ <i class="fas fa-star text-2xl"></i>
350
+ </button>
351
+
352
+ <!-- Buy Down Modal -->
353
+ <div id="buyDownModal" class="modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4">
354
+ <div class="bg-white rounded-xl shadow-xl p-6 max-w-md w-full">
355
+ <div class="flex justify-between items-center mb-4">
356
+ <h3 class="text-xl font-bold text-gray-800">Interest Rate Buy Down</h3>
357
+ <button id="closeModal" class="text-gray-500 hover:text-gray-700">
358
+ <i class="fas fa-times"></i>
359
+ </button>
360
+ </div>
361
+
362
+ <div class="mb-4">
363
+ <label class="block text-gray-700 font-medium mb-2">Buy Down Points (0-5)</label>
364
+ <input type="range" id="buyDownSlider" min="0" max="5" value="0" step="0.25" class="w-full tariff-slider h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
365
+ <div class="flex justify-between mt-2">
366
+ <span class="text-sm text-gray-500">0 points</span>
367
+ <span id="buyDownValue" class="font-medium text-blue-600">0 points</span>
368
+ <span class="text-sm text-gray-500">5 points</span>
369
+ </div>
370
+ <p class="text-sm text-gray-500 mt-2">Each point reduces rate by 0.25% (costs 1% of loan amount)</p>
371
+ </div>
372
+
373
+ <div class="mb-4">
374
+ <label class="block text-gray-700 font-medium mb-2">Fractal Bitcoin Mining Address</label>
375
+ <input type="text" id="bitcoinAddress" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bitcoin-address" placeholder="bc1qxy2kgdygjrsqtzq2n0yrf249nw3q2k6x..." pattern="^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$">
376
+ <p class="text-xs text-gray-500 mt-1">Enter your Bitcoin address to apply mining rewards to loan</p>
377
+ </div>
378
+
379
+ <div class="mining-estimate p-4 rounded-lg mb-4">
380
+ <h4 class="font-medium text-yellow-800 mb-2">Quarterly Mining Estimate</h4>
381
+ <div class="grid grid-cols-2 gap-2">
382
+ <div>
383
+ <p class="text-xs text-yellow-700">Estimated BTC Mined:</p>
384
+ <p id="estimatedBTC" class="font-bold">0.0025 BTC</p>
385
+ </div>
386
+ <div>
387
+ <p class="text-xs text-yellow-700">Buydown Points:</p>
388
+ <p id="miningPoints" class="font-bold">0.5 points</p>
389
+ </div>
390
+ <div>
391
+ <p class="text-xs text-yellow-700">Rate Reduction:</p>
392
+ <p id="miningRateReduction" class="font-bold">0.125%</p>
393
+ </div>
394
+ <div>
395
+ <p class="text-xs text-yellow-700">Loan Impact:</p>
396
+ <p id="miningLoanImpact" class="font-bold">-$1,250</p>
397
+ </div>
398
+ </div>
399
+ <p class="text-xs text-yellow-700 mt-2">* Estimates based on current mining difficulty and BTC price</p>
400
+ </div>
401
+
402
+ <div class="bg-blue-50 p-4 rounded-lg mb-4">
403
+ <p class="text-sm text-blue-600 font-medium">New Interest Rate</p>
404
+ <p id="newRate" class="text-xl font-bold text-blue-800">7.50%</p>
405
+ <p class="text-sm text-blue-600 font-medium mt-2">Buy Down Cost</p>
406
+ <p id="buyDownCost" class="text-xl font-bold text-blue-800">$0</p>
407
+ </div>
408
+
409
+ <button id="applyBuyDown" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300">
410
+ Apply Buy Down
411
+ </button>
412
+ </div>
413
+ </div>
414
+
415
+ <!-- Market Share Modal -->
416
+ <div id="marketShareModal" class="modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4">
417
+ <div class="bg-white rounded-xl shadow-xl p-6 max-w-md w-full">
418
+ <div class="flex justify-between items-center mb-4">
419
+ <h3 class="text-xl font-bold text-gray-800">Market Share Impact</h3>
420
+ <button id="closeMarketShareModal" class="text-gray-500 hover:text-gray-700">
421
+ <i class="fas fa-times"></i>
422
+ </button>
423
+ </div>
424
+
425
+ <div class="mb-4">
426
+ <div class="flex justify-between mb-2">
427
+ <span class="font-medium text-red-600">Market Share Loss</span>
428
+ <span id="marketShareLoss" class="font-bold">5%</span>
429
+ </div>
430
+ <div class="flex justify-between mb-4">
431
+ <span class="font-medium text-green-600">Cost Savings</span>
432
+ <span id="costSavings" class="font-bold">15%</span>
433
+ </div>
434
+
435
+ <div class="market-share-gauge">
436
+ <div id="gaugePointer" class="gauge-pointer" style="left: 25%;"></div>
437
+ </div>
438
+ <div class="flex justify-between mt-2 text-xs">
439
+ <span>High Loss</span>
440
+ <span>Balanced</span>
441
+ <span>High Savings</span>
442
+ </div>
443
+ </div>
444
+
445
+ <div class="bg-gray-50 p-4 rounded-lg mb-4">
446
+ <p class="text-sm text-gray-700">
447
+ <span class="font-medium">Analysis:</span>
448
+ <span id="marketShareAnalysis">Using tariff financing results in moderate market share impact but significant cost savings.</span>
449
+ </p>
450
+ </div>
451
+
452
+ <button id="closeMarketShareBtn" class="w-full bg-green-600 hover:bg-green-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300">
453
+ Close
454
+ </button>
455
+ </div>
456
+ </div>
457
+
458
+ <!-- Token Minting Modal -->
459
+ <div id="tokenMintModal" class="modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4">
460
+ <div class="bg-white rounded-xl shadow-xl p-6 max-w-md w-full">
461
+ <div class="flex justify-between items-center mb-4">
462
+ <h3 class="text-xl font-bold text-gray-800">Mint FFFUND Tokens</h3>
463
+ <button id="closeTokenModal" class="text-gray-500 hover:text-gray-700">
464
+ <i class="fas fa-times"></i>
465
+ </button>
466
+ </div>
467
+
468
+ <div class="yield-farming-card mb-6">
469
+ <div class="flex justify-between items-center mb-2">
470
+ <span class="font-bold text-purple-700">Fabric Flow Fund™ (FFFUND)</span>
471
+ <span class="bg-purple-100 text-purple-800 text-xs font-medium px-2.5 py-0.5 rounded">BRC-20</span>
472
+ </div>
473
+ <p class="text-sm text-gray-600 mb-3">Yield farming token to fund your business loan with competitive APY</p>
474
+
475
+ <div class="grid grid-cols-2 gap-4 mb-3">
476
+ <div>
477
+ <p class="text-xs text-gray-500">Total Supply</p>
478
+ <p class="font-medium">50,000,000,000</p>
479
+ </div>
480
+ <div>
481
+ <p class="text-xs text-gray-500">Min Mint</p>
482
+ <p class="font-medium">10,000</p>
483
+ </div>
484
+ <div>
485
+ <p class="text-xs text-gray-500">Current APY</p>
486
+ <p class="font-medium text-green-600">11.0%</p>
487
+ </div>
488
+ <div>
489
+ <p class="text-xs text-gray-500">Your Balance</p>
490
+ <p class="font-medium">0</p>
491
+ </div>
492
+ </div>
493
+
494
+ <div class="mb-2">
495
+ <p class="text-xs text-gray-500">Mint Progress</p>
496
+ <div class="token-progress">
497
+ <div id="tokenProgressBar" class="token-progress-bar" style="width: 0%"></div>
498
+ </div>
499
+ <p class="text-right text-xs mt-1"><span id="tokensMinted">0</span>/10,000</p>
500
+ </div>
501
+ </div>
502
+
503
+ <div class="mb-4">
504
+ <label class="block text-gray-700 font-medium mb-2">Amount to Mint</label>
505
+ <input type="number" id="tokenAmount" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500" placeholder="e.g. 10000" min="10000" step="1000">
506
+ </div>
507
+
508
+ <div class="bg-purple-50 p-4 rounded-lg mb-4">
509
+ <p class="text-sm text-purple-600 font-medium">Estimated Annual Yield</p>
510
+ <p id="estimatedYield" class="text-xl font-bold text-purple-800">0 FFFUND</p>
511
+ <p class="text-sm text-purple-600 font-medium mt-2">Loan Impact</p>
512
+ <p id="tokenLoanImpact" class="text-xl font-bold text-purple-800">-$0</p>
513
+ </div>
514
+
515
+ <button id="mintTokensBtn" class="w-full bg-purple-600 hover:bg-purple-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300">
516
+ Mint Tokens
517
+ </button>
518
+ </div>
519
+ </div>
520
+
521
+ <!-- Credit Rating Modal -->
522
+ <div id="creditRatingModal" class="modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4">
523
+ <div class="bg-white rounded-xl shadow-xl p-6 max-w-md w-full">
524
+ <div class="flex justify-between items-center mb-4">
525
+ <h3 class="text-xl font-bold text-gray-800">Country Credit Rating</h3>
526
+ <button id="closeCreditRatingModal" class="text-gray-500 hover:text-gray-700">
527
+ <i class="fas fa-times"></i>
528
+ </button>
529
+ </div>
530
+
531
+ <div class="mb-4">
532
+ <label class="block text-gray-700 font-medium mb-2">Select Country</label>
533
+ <select id="countrySelect" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500">
534
+ <option value="US">United States</option>
535
+ <option value="DE">Germany</option>
536
+ <option value="GB">United Kingdom</option>
537
+ <option value="FR">France</option>
538
+ <option value="JP">Japan</option>
539
+ <option value="CN">China</option>
540
+ <option value="IN">India</option>
541
+ <option value="BR">Brazil</option>
542
+ <option value="RU">Russia</option>
543
+ <option value="ZA">South Africa</option>
544
+ </select>
545
+ </div>
546
+
547
+ <div class="bg-amber-50 p-4 rounded-lg mb-4">
548
+ <div class="flex justify-between items-center mb-2">
549
+ <span class="font-medium text-gray-700">Current Rating:</span>
550
+ <span id="creditRating" class="credit-rating-badge credit-rating-AAA">AAA</span>
551
+ </div>
552
+ <div class="flex justify-between items-center">
553
+ <span class="font-medium text-gray-700">Outlook:</span>
554
+ <span id="creditOutlook" class="text-green-600 font-medium">Stable</span>
555
+ </div>
556
+ </div>
557
+
558
+ <div id="economicIndicators" class="mb-4">
559
+ <h4 class="font-medium text-gray-700 mb-2">Key Economic Indicators</h4>
560
+ <div class="economic-indicator">
561
+ <span>GDP Growth</span>
562
+ <span id="gdpGrowth" class="font-medium">2.1%</span>
563
+ </div>
564
+ <div class="economic-indicator">
565
+ <span>Inflation Rate</span>
566
+ <span id="inflationRate" class="font-medium">3.2%</span>
567
+ </div>
568
+ <div class="economic-indicator">
569
+ <span>Unemployment</span>
570
+ <span id="unemploymentRate" class="font-medium">4.5%</span>
571
+ </div>
572
+ <div class="economic-indicator">
573
+ <span>Debt to GDP</span>
574
+ <span id="debtToGDP" class="font-medium">110%</span>
575
+ </div>
576
+ </div>
577
+
578
+ <div class="bg-gray-50 p-4 rounded-lg">
579
+ <p class="text-sm text-gray-700">
580
+ <span class="font-medium">Analysis:</span>
581
+ <span id="creditAnalysis">The country maintains a strong credit profile with stable economic growth and manageable debt levels.</span>
582
+ </p>
583
+ </div>
584
+
585
+ <button id="closeCreditRatingBtn" class="w-full bg-amber-600 hover:bg-amber-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300 mt-4">
586
+ Close
587
+ </button>
588
+ </div>
589
+ </div>
590
+
591
+ <script>
592
+ // DOM Elements
593
+ const loanAmountInput = document.getElementById('loanAmount');
594
+ const primeRateInput = document.getElementById('primeRate');
595
+ const importCountrySelect = document.getElementById('importCountry');
596
+ const industrySelect = document.getElementById('industrySelect');
597
+ const customTariffSection = document.getElementById('customTariffSection');
598
+ const tariffSlider = document.getElementById('tariffSlider');
599
+ const tariffValue = document.getElementById('tariffValue');
600
+ const totalTariffDisplay = document.getElementById('totalTariffDisplay');
601
+ const tariffBreakdown = document.getElementById('tariffBreakdown');
602
+ const tariffImpactMeter = document.getElementById('tariffImpactMeter');
603
+ const tariffImpactBar = document.getElementById('tariffImpactBar');
604
+ const calculateBtn = document.getElementById('calculateBtn');
605
+ const resultsSection = document.getElementById('results');
606
+ const totalLoan = document.getElementById('totalLoan');
607
+ const effectiveRate = document.getElementById('effectiveRate');
608
+ const monthlyPayment = document.getElementById('monthlyPayment');
609
+ const totalTariffCost = document.getElementById('totalTariffCost');
610
+ const totalInterestCost = document.getElementById('totalInterestCost');
611
+ const amortizationTable = document.getElementById('amortizationTable');
612
+
613
+ // Floating buttons and modals
614
+ const buyDownBtn = document.getElementById('buyDownBtn');
615
+ const marketShareBtn = document.getElementById('marketShareBtn');
616
+ const tokenMintBtn = document.getElementById('tokenMintBtn');
617
+ const creditRatingBtn = document.getElementById('creditRatingBtn');
618
+
619
+ const buyDownModal = document.getElementById('buyDownModal');
620
+ const marketShareModal = document.getElementById('marketShareModal');
621
+ const tokenMintModal = document.getElementById('tokenMintModal');
622
+ const creditRatingModal = document.getElementById('creditRatingModal');
623
+
624
+ const closeModal = document.getElementById('closeModal');
625
+ const closeMarketShareModal = document.getElementById('closeMarketShareModal');
626
+ const closeTokenModal = document.getElementById('closeTokenModal');
627
+ const closeCreditRatingModal = document.getElementById('closeCreditRatingModal');
628
+ const closeMarketShareBtn = document.getElementById('closeMarketShareBtn');
629
+ const closeCreditRatingBtn = document.getElementById('closeCreditRatingBtn');
630
+
631
+ // Buy Down Modal Elements
632
+ const buyDownSlider = document.getElementById('buyDownSlider');
633
+ const buyDownValue = document.getElementById('buyDownValue');
634
+ const bitcoinAddress = document.getElementById('bitcoinAddress');
635
+ const estimatedBTC = document.getElementById('estimatedBTC');
636
+ const miningPoints = document.getElementById('miningPoints');
637
+ const miningRateReduction = document.getElementById('miningRateReduction');
638
+ const miningLoanImpact = document.getElementById('miningLoanImpact');
639
+ const newRate = document.getElementById('newRate');
640
+ const buyDownCost = document.getElementById('buyDownCost');
641
+ const applyBuyDown = document.getElementById('applyBuyDown');
642
+
643
+ // Token Minting Modal Elements
644
+ const tokenAmount = document.getElementById('tokenAmount');
645
+ const tokenProgressBar = document.getElementById('tokenProgressBar');
646
+ const tokensMinted = document.getElementById('tokensMinted');
647
+ const estimatedYield = document.getElementById('estimatedYield');
648
+ const tokenLoanImpact = document.getElementById('tokenLoanImpact');
649
+ const mintTokensBtn = document.getElementById('mintTokensBtn');
650
+
651
+ // Credit Rating Modal Elements
652
+ const countrySelect = document.getElementById('countrySelect');
653
+ const creditRating = document.getElementById('creditRating');
654
+ const creditOutlook = document.getElementById('creditOutlook');
655
+ const gdpGrowth = document.getElementById('gdpGrowth');
656
+ const inflationRate = document.getElementById('inflationRate');
657
+ const unemploymentRate = document.getElementById('unemploymentRate');
658
+ const debtToGDP = document.getElementById('debtToGDP');
659
+ const creditAnalysis = document.getElementById('creditAnalysis');
660
+
661
+ // Tariff data
662
+ const tariffRates = {
663
+ steel: { US: 25, EU: 10, CN: 15, JP: 5, CA: 7, MX: 15, IN: 20, BR: 12 },
664
+ agriculture: { US: 5, EU: 12, CN: 8, JP: 15, CA: 3, MX: 10, IN: 25, BR: 8 },
665
+ automotive: { US: 2.5, EU: 10, CN: 15, JP: 0, CA: 0, MX: 0, IN: 30, BR: 20 },
666
+ electronics: { US: 0, EU: 2, CN: 0, JP: 0, CA: 0, MX: 0, IN: 10, BR: 5 },
667
+ textiles: { US: 12, EU: 8, CN: 5, JP: 7, CA: 10, MX: 15, IN: 18, BR: 12 },
668
+ chemicals: { US: 3, EU: 5, CN: 4, JP: 2, CA: 2, MX: 5, IN: 8, BR: 6 },
669
+ machinery: { US: 1.5, EU: 3, CN: 2, JP: 1, CA: 0, MX: 2, IN: 7, BR: 4 },
670
+ pharmaceuticals: { US: 0, EU: 0, CN: 3, JP: 0, CA: 0, MX: 0, IN: 5, BR: 2 }
671
+ };
672
+
673
+ // Credit rating data
674
+ const creditRatings = {
675
+ US: { rating: 'AA+', outlook: 'Stable', gdp: 2.1, inflation: 3.2, unemployment: 3.8, debt: 123 },
676
+ DE: { rating: 'AAA', outlook: 'Stable', gdp: 1.5, inflation: 2.8, unemployment: 3.0, debt: 65 },
677
+ GB: { rating: 'AA-', outlook: 'Negative', gdp: 0.8, inflation: 4.5, unemployment: 4.2, debt: 98 },
678
+ FR: { rating: 'AA', outlook: 'Stable', gdp: 1.2, inflation: 3.1, unemployment: 7.5, debt: 112 },
679
+ JP: { rating: 'A+', outlook: 'Stable', gdp: 1.0, inflation: 2.5, unemployment: 2.6, debt: 260 },
680
+ CN: { rating: 'A-', outlook: 'Negative', gdp: 5.2, inflation: 1.8, unemployment: 5.3, debt: 77 },
681
+ IN: { rating: 'BBB-', outlook: 'Stable', gdp: 6.5, inflation: 5.8, unemployment: 7.8, debt: 84 },
682
+ BR: { rating: 'BB-', outlook: 'Positive', gdp: 3.0, inflation: 4.2, unemployment: 9.1, debt: 88 },
683
+ RU: { rating: 'B', outlook: 'Negative', gdp: -2.5, inflation: 7.8, unemployment: 4.8, debt: 18 },
684
+ ZA: { rating: 'BB', outlook: 'Stable', gdp: 1.8, inflation: 5.5, unemployment: 32.7, debt: 72 }
685
+ };
686
+
687
+ // Event Listeners
688
+ industrySelect.addEventListener('change', updateTariffDisplay);
689
+ tariffSlider.addEventListener('input', updateCustomTariff);
690
+ calculateBtn.addEventListener('click', calculateLoan);
691
+ buyDownBtn.addEventListener('click', () => toggleModal(buyDownModal));
692
+ marketShareBtn.addEventListener('click', () => toggleModal(marketShareModal));
693
+ tokenMintBtn.addEventListener('click', () => toggleModal(tokenMintModal));
694
+ creditRatingBtn.addEventListener('click', () => {
695
+ toggleModal(creditRatingModal);
696
+ updateCreditRating();
697
+ });
698
+
699
+ closeModal.addEventListener('click', () => toggleModal(buyDownModal));
700
+ closeMarketShareModal.addEventListener('click', () => toggleModal(marketShareModal));
701
+ closeTokenModal.addEventListener('click', () => toggleModal(tokenMintModal));
702
+ closeCreditRatingModal.addEventListener('click', () => toggleModal(creditRatingModal));
703
+ closeMarketShareBtn.addEventListener('click', () => toggleModal(marketShareModal));
704
+ closeCreditRatingBtn.addEventListener('click', () => toggleModal(creditRatingModal));
705
+
706
+ buyDownSlider.addEventListener('input', updateBuyDown);
707
+ bitcoinAddress.addEventListener('input', updateMiningEstimate);
708
+ tokenAmount.addEventListener('input', updateTokenEstimate);
709
+ countrySelect.addEventListener('change', updateCreditRating);
710
+ applyBuyDown.addEventListener('click', applyBuyDownPoints);
711
+ mintTokensBtn.addEventListener('click', mintTokens);
712
+
713
+ // Initialize
714
+ updateTariffDisplay();
715
+
716
+ // Functions
717
+ function toggleModal(modal) {
718
+ modal.classList.toggle('active');
719
+ }
720
+
721
+ function updateTariffDisplay() {
722
+ const selectedIndustry = industrySelect.value;
723
+ const selectedCountry = importCountrySelect.value;
724
+
725
+ if (selectedIndustry === 'custom') {
726
+ customTariffSection.classList.remove('hidden');
727
+ updateCustomTariff();
728
+ } else if (selectedIndustry) {
729
+ customTariffSection.classList.add('hidden');
730
+ const tariffRate = tariffRates[selectedIndustry][selectedCountry];
731
+ const loanAmount = parseFloat(loanAmountInput.value);
732
+ const tariffAmount = (loanAmount * tariffRate) / 100;
733
+
734
+ totalTariffDisplay.textContent = `$${tariffAmount.toLocaleString()} (${tariffRate}%)`;
735
+ tariffBreakdown.innerHTML = `
736
+ <span class="tariff-badge bg-blue-100 text-blue-800">${selectedCountry}</span>
737
+ <span class="tariff-badge bg-green-100 text-green-800">${selectedIndustry.replace(/\b\w/g, l => l.toUpperCase())}</span>
738
+ `;
739
+ tariffImpactMeter.classList.remove('hidden');
740
+ tariffImpactBar.style.width = `${Math.min(tariffRate, 100)}%`;
741
+ } else {
742
+ totalTariffDisplay.textContent = '$0 (0%)';
743
+ tariffBreakdown.innerHTML = '';
744
+ tariffImpactMeter.classList.add('hidden');
745
+ }
746
+ }
747
+
748
+ function updateCustomTariff() {
749
+ const tariffRate = parseFloat(tariffSlider.value);
750
+ tariffValue.textContent = `${tariffRate}%`;
751
+
752
+ const loanAmount = parseFloat(loanAmountInput.value);
753
+ const tariffAmount = (loanAmount * tariffRate) / 100;
754
+
755
+ totalTariffDisplay.textContent = `$${tariffAmount.toLocaleString()} (${tariffRate}%)`;
756
+ tariffBreakdown.innerHTML = `
757
+ <span class="tariff-badge bg-blue-100 text-blue-800">Custom</span>
758
+ `;
759
+ tariffImpactMeter.classList.remove('hidden');
760
+ tariffImpactBar.style.width = `${tariffRate}%`;
761
+ }
762
+
763
+ function calculateLoan() {
764
+ const loanAmount = parseFloat(loanAmountInput.value);
765
+ const baseRate = parseFloat(primeRateInput.value);
766
+ const selectedIndustry = industrySelect.value;
767
+ const selectedCountry = importCountrySelect.value;
768
+
769
+ let tariffRate;
770
+ if (selectedIndustry === 'custom') {
771
+ tariffRate = parseFloat(tariffSlider.value);
772
+ } else if (selectedIndustry) {
773
+ tariffRate = tariffRates[selectedIndustry][selectedCountry];
774
+ } else {
775
+ tariffRate = 0;
776
+ }
777
+
778
+ const tariffAmount = (loanAmount * tariffRate) / 100;
779
+ const totalLoanAmount = loanAmount + tariffAmount;
780
+
781
+ // Calculate effective rate (base rate + 0.5% for tariff financing)
782
+ const effectiveInterestRate = baseRate + 0.5;
783
+
784
+ // Calculate monthly payment (5-year term)
785
+ const monthlyRate = effectiveInterestRate / 100 / 12;
786
+ const numPayments = 5 * 12;
787
+ const monthlyPaymentAmount = totalLoanAmount * monthlyRate * Math.pow(1 + monthlyRate, numPayments) / (Math.pow(1 + monthlyRate, numPayments) - 1);
788
+
789
+ // Calculate total interest
790
+ const totalInterest = (monthlyPaymentAmount * numPayments) - totalLoanAmount;
791
+
792
+ // Update UI
793
+ totalLoan.textContent = `$${totalLoanAmount.toLocaleString()}`;
794
+ effectiveRate.textContent = `${effectiveInterestRate.toFixed(2)}%`;
795
+ monthlyPayment.textContent = `$${monthlyPaymentAmount.toFixed(0)}`;
796
+ totalTariffCost.textContent = `$${tariffAmount.toLocaleString()}`;
797
+ totalInterestCost.textContent = `$${totalInterest.toLocaleString()}`;
798
+
799
+ // Generate amortization table
800
+ generateAmortizationTable(totalLoanAmount, effectiveInterestRate, numPayments);
801
+
802
+ // Show results
803
+ resultsSection.classList.remove('hidden');
804
+ }
805
+
806
+ function generateAmortizationTable(loanAmount, annualRate, numPayments) {
807
+ const monthlyRate = annualRate / 100 / 12;
808
+ let balance = loanAmount;
809
+ let html = '';
810
+
811
+ for (let year = 1; year <= 5; year++) {
812
+ let yearInterest = 0;
813
+ let yearPrincipal = 0;
814
+
815
+ for (let month = 1; month <= 12; month++) {
816
+ const interestPayment = balance * monthlyRate;
817
+ const principalPayment = (loanAmount * monthlyRate * Math.pow(1 + monthlyRate, numPayments)) / (Math.pow(1 + monthlyRate, numPayments) - 1) - interestPayment;
818
+
819
+ yearInterest += interestPayment;
820
+ yearPrincipal += principalPayment;
821
+ balance -= principalPayment;
822
+ }
823
+
824
+ html += `
825
+ <tr>
826
+ <td class="py-3 px-4">Year ${year}</td>
827
+ <td class="py-3 px-4 text-right">$${yearPrincipal.toFixed(0).toLocaleString()}</td>
828
+ <td class="py-3 px-4 text-right">$${yearInterest.toFixed(0).toLocaleString()}</td>
829
+ <td class="py-3 px-4 text-right">$${balance.toFixed(0).toLocaleString()}</td>
830
+ </tr>
831
+ `;
832
+ }
833
+
834
+ amortizationTable.innerHTML = html;
835
+ }
836
+
837
+ function updateBuyDown() {
838
+ const points = parseFloat(buyDownSlider.value);
839
+ buyDownValue.textContent = `${points} point${points !== 1 ? 's' : ''}`;
840
+
841
+ const loanAmount = parseFloat(loanAmountInput.value);
842
+ const baseRate = parseFloat(primeRateInput.value);
843
+ const cost = (loanAmount * points) / 100;
844
+ const newInterestRate = baseRate - (points * 0.25);
845
+
846
+ buyDownCost.textContent = `$${cost.toLocaleString()}`;
847
+ newRate.textContent = `${newInterestRate.toFixed(2)}%`;
848
+ }
849
+
850
+ function updateMiningEstimate() {
851
+ // Simulate mining estimate
852
+ estimatedBTC.textContent = "0.0025 BTC";
853
+ miningPoints.textContent = "0.5 points";
854
+ miningRateReduction.textContent = "0.125%";
855
+ miningLoanImpact.textContent = "-$1,250";
856
+ }
857
+
858
+ function applyBuyDownPoints() {
859
+ const points = parseFloat(buyDownSlider.value);
860
+ const baseRate = parseFloat(primeRateInput.value);
861
+ const newRateValue = baseRate - (points * 0.25);
862
+
863
+ primeRateInput.value = newRateValue.toFixed(2);
864
+ toggleModal(buyDownModal);
865
+
866
+ // Show success message
867
+ alert(`Successfully applied ${points} buy down points. New rate: ${newRateValue.toFixed(2)}%`);
868
+ }
869
+
870
+ function updateTokenEstimate() {
871
+ const amount = parseInt(tokenAmount.value) || 0;
872
+ const progress = Math.min((amount / 10000) * 100, 100);
873
+
874
+ tokenProgressBar.style.width = `${progress}%`;
875
+ tokensMinted.textContent = amount.toLocaleString();
876
+
877
+ // Calculate yield (11% APY)
878
+ const annualYield = amount * 0.11;
879
+ estimatedYield.textContent = `${annualYield.toLocaleString()} FFFUND`;
880
+
881
+ // Calculate loan impact ($0.10 per token)
882
+ const loanImpact = amount * 0.10;
883
+ tokenLoanImpact.textContent = `-$${loanImpact.toLocaleString()}`;
884
+ }
885
+
886
+ function mintTokens() {
887
+ const amount = parseInt(tokenAmount.value) || 0;
888
+
889
+ if (amount < 10000) {
890
+ alert("Minimum mint amount is 10,000 FFFUND tokens");
891
+ return;
892
+ }
893
+
894
+ // Show success message
895
+ alert(`Successfully minted ${amount.toLocaleString()} FFFUND tokens. Your annual yield will be approximately ${(amount * 0.11).toLocaleString()} FFFUND.`);
896
+
897
+ // Reset form
898
+ tokenAmount.value = '';
899
+ updateTokenEstimate();
900
+ toggleModal(tokenMintModal);
901
+ }
902
+
903
+ function updateCreditRating() {
904
+ const countryCode = countrySelect.value;
905
+ const ratingData = creditRatings[countryCode];
906
+
907
+ // Update rating
908
+ creditRating.textContent = ratingData.rating;
909
+ creditRating.className = 'credit-rating-badge';
910
+ creditRating.classList.add(`credit-rating-${ratingData.rating.replace(/[+-]/g, '')}`);
911
+
912
+ // Update outlook
913
+ creditOutlook.textContent = ratingData.outlook;
914
+ if (ratingData.outlook === 'Positive') {
915
+ creditOutlook.className = 'text-green-600 font-medium';
916
+ } else if (ratingData.outlook === 'Negative') {
917
+ creditOutlook.className = 'text-red-600 font-medium';
918
+ } else {
919
+ creditOutlook.className = 'text-gray-600 font-medium';
920
+ }
921
+
922
+ // Update economic indicators
923
+ gdpGrowth.textContent = `${ratingData.gdp}%`;
924
+ inflationRate.textContent = `${ratingData.inflation}%`;
925
+ unemploymentRate.textContent = `${ratingData.unemployment}%`;
926
+ debtToGDP.textContent = `${ratingData.debt}%`;
927
+
928
+ // Update analysis
929
+ let analysis = '';
930
+ if (ratingData.rating.startsWith('AAA')) {
931
+ analysis = 'The country maintains an exceptional credit profile with strong economic fundamentals and very low risk.';
932
+ } else if (ratingData.rating.startsWith('AA')) {
933
+ analysis = 'The country has a very strong credit profile with robust economic indicators and low risk.';
934
+ } else if (ratingData.rating.startsWith('A')) {
935
+ analysis = 'The country has a strong credit profile but may be more susceptible to adverse economic conditions.';
936
+ } else if (ratingData.rating.startsWith('BBB')) {
937
+ analysis = 'The country has adequate creditworthiness but adverse economic conditions could weaken its capacity to meet commitments.';
938
+ } else if (ratingData.rating.startsWith('BB')) {
939
+ analysis = 'The country faces major ongoing uncertainties and exposure to adverse business, financial, or economic conditions.';
940
+ } else if (ratingData.rating.startsWith('B')) {
941
+ analysis = 'The country has significant credit risk with adverse business, financial, or economic conditions likely to impair capacity to meet commitments.';
942
+ } else {
943
+ analysis = 'The country is highly vulnerable to default and currently faces extreme credit risk.';
944
+ }
945
+
946
+ creditAnalysis.textContent = analysis;
947
+ }
948
+ </script>
949
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=privateuserh/privfin-vbeta1-04" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
950
+ </html>