asterui 0.10.3 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -100
- package/dist/components/Anchor.d.ts +45 -0
- package/dist/components/Diff.d.ts +12 -0
- package/dist/components/Kbd.d.ts +8 -0
- package/dist/components/Segmented.d.ts +37 -0
- package/dist/components/TextRotate.d.ts +13 -0
- package/dist/components/Tour.d.ts +61 -0
- package/dist/hooks/useClickOutside.d.ts +17 -0
- package/dist/hooks/useClipboard.d.ts +20 -0
- package/dist/hooks/useDebounce.d.ts +18 -0
- package/dist/hooks/useDisclosure.d.ts +20 -0
- package/dist/hooks/useHover.d.ts +18 -0
- package/dist/hooks/useKeyPress.d.ts +40 -0
- package/dist/hooks/useLocalStorage.d.ts +12 -0
- package/dist/hooks/usePrevious.d.ts +15 -0
- package/dist/hooks/useWindowSize.d.ts +21 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +205 -174
- package/dist/index.js.map +1 -1
- package/dist/index10.js +92 -30
- package/dist/index10.js.map +1 -1
- package/dist/index100.js +12 -20
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +29 -22
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +17 -19
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +10788 -95
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +5 -360
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +40 -23
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +2 -73
- package/dist/index106.js.map +1 -1
- package/dist/index107.js +6 -15
- package/dist/index107.js.map +1 -1
- package/dist/index108.js +147 -61
- package/dist/index108.js.map +1 -1
- package/dist/index109.js +26 -140
- package/dist/index109.js.map +1 -1
- package/dist/index11.js +28 -263
- package/dist/index11.js.map +1 -1
- package/dist/index110.js +30 -2
- package/dist/index110.js.map +1 -1
- package/dist/index111.js +2 -56
- package/dist/index111.js.map +1 -1
- package/dist/index112.js +72 -2
- package/dist/index112.js.map +1 -1
- package/dist/index113.js +39 -2
- package/dist/index113.js.map +1 -1
- package/dist/index114.js +26 -2
- package/dist/index114.js.map +1 -1
- package/dist/index115.js +21 -2
- package/dist/index115.js.map +1 -1
- package/dist/index116.js +24 -2
- package/dist/index116.js.map +1 -1
- package/dist/index117.js +20 -2
- package/dist/index117.js.map +1 -1
- package/dist/index118.js +100 -2
- package/dist/index118.js.map +1 -1
- package/dist/index119.js +359 -31
- package/dist/index119.js.map +1 -1
- package/dist/index12.js +259 -89
- package/dist/index12.js.map +1 -1
- package/dist/index120.js +25 -2
- package/dist/index120.js.map +1 -1
- package/dist/index121.js +72 -7
- package/dist/index121.js.map +1 -1
- package/dist/index122.js +16 -2
- package/dist/index122.js.map +1 -1
- package/dist/index123.js +66 -2
- package/dist/index123.js.map +1 -1
- package/dist/index124.js +143 -20
- package/dist/index124.js.map +1 -1
- package/dist/index125.js +2 -2
- package/dist/index126.js +55 -23
- package/dist/index126.js.map +1 -1
- package/dist/index127.js +2 -71
- package/dist/index127.js.map +1 -1
- package/dist/index128.js +2 -21
- package/dist/index128.js.map +1 -1
- package/dist/index129.js +2 -34
- package/dist/index129.js.map +1 -1
- package/dist/index13.js +90 -153
- package/dist/index13.js.map +1 -1
- package/dist/index130.js +2 -70
- package/dist/index130.js.map +1 -1
- package/dist/index131.js +2 -2
- package/dist/index132.js +2 -2
- package/dist/index133.js +2 -22
- package/dist/index133.js.map +1 -1
- package/dist/index134.js +2 -2
- package/dist/index135.js +32 -2
- package/dist/index135.js.map +1 -1
- package/dist/index136.js +2 -2
- package/dist/index137.js +8 -2
- package/dist/index137.js.map +1 -1
- package/dist/index138.js +2 -4
- package/dist/index138.js.map +1 -1
- package/dist/index139.js +5 -0
- package/dist/index139.js.map +1 -0
- package/dist/index14.js +154 -146
- package/dist/index14.js.map +1 -1
- package/dist/index140.js +24 -0
- package/dist/index140.js.map +1 -0
- package/dist/index141.js +5 -0
- package/dist/index141.js.map +1 -0
- package/dist/index142.js +27 -0
- package/dist/index142.js.map +1 -0
- package/dist/index143.js +74 -0
- package/dist/index143.js.map +1 -0
- package/dist/index144.js +24 -0
- package/dist/index144.js.map +1 -0
- package/dist/index145.js +37 -0
- package/dist/index145.js.map +1 -0
- package/dist/index146.js +73 -0
- package/dist/index146.js.map +1 -0
- package/dist/index147.js +5 -0
- package/dist/index147.js.map +1 -0
- package/dist/index148.js +25 -0
- package/dist/index148.js.map +1 -0
- package/dist/index149.js +5 -0
- package/dist/index149.js.map +1 -0
- package/dist/index15.js +150 -5
- package/dist/index15.js.map +1 -1
- package/dist/index150.js +5 -0
- package/dist/index150.js.map +1 -0
- package/dist/index151.js +5 -0
- package/dist/index151.js.map +1 -0
- package/dist/index152.js +5 -0
- package/dist/index152.js.map +1 -0
- package/dist/index153.js +7 -0
- package/dist/index153.js.map +1 -0
- package/dist/index16.js +5 -71
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +71 -17
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +15 -96
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +89 -105
- package/dist/index19.js.map +1 -1
- package/dist/index20.js +107 -177
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +181 -107
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +107 -29
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +19 -41
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +31 -11
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +41 -33
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +12 -63
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +33 -80
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +63 -18
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +78 -159
- package/dist/index29.js.map +1 -1
- package/dist/index3.js +96 -27
- package/dist/index3.js.map +1 -1
- package/dist/index30.js +16 -1080
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +159 -16
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +1081 -121
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +17 -39
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +121 -190
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +37 -94
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +186 -157
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +89 -138
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +161 -14
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +146 -21
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +26 -99
- package/dist/index4.js.map +1 -1
- package/dist/index40.js +12 -116
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +18 -13
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +21 -35
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +117 -114
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +13 -176
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +34 -146
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +116 -12
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +176 -22
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +147 -14
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +10 -5
- package/dist/index49.js.map +1 -1
- package/dist/index5.js +100 -60
- package/dist/index5.js.map +1 -1
- package/dist/index50.js +21 -265
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +10 -13
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +7 -122
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +262 -106
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +14 -167
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +121 -31
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +107 -119
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +161 -77
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +31 -19
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +117 -69
- package/dist/index59.js.map +1 -1
- package/dist/index6.js +61 -130
- package/dist/index6.js.map +1 -1
- package/dist/index60.js +82 -53
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +19 -44
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +70 -48
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +55 -60
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +39 -101
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +52 -41
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +62 -21
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +104 -43
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +41 -134
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +65 -49
- package/dist/index69.js.map +1 -1
- package/dist/index7.js +130 -11
- package/dist/index7.js.map +1 -1
- package/dist/index70.js +21 -22
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +46 -22
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +126 -321
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +52 -56
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +22 -40
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +22 -95
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +311 -112
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +52 -157
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +40 -65
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +23 -35
- package/dist/index79.js.map +1 -1
- package/dist/index8.js +11 -70
- package/dist/index8.js.map +1 -1
- package/dist/index80.js +92 -31
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +116 -196
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +155 -207
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +60 -290
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +34 -177
- package/dist/index84.js.map +1 -1
- package/dist/index85.js +227 -251
- package/dist/index85.js.map +1 -1
- package/dist/index86.js +34 -14
- package/dist/index86.js.map +1 -1
- package/dist/index87.js +208 -31
- package/dist/index87.js.map +1 -1
- package/dist/index88.js +206 -10786
- package/dist/index88.js.map +1 -1
- package/dist/index89.js +295 -5
- package/dist/index89.js.map +1 -1
- package/dist/index9.js +69 -91
- package/dist/index9.js.map +1 -1
- package/dist/index90.js +172 -36
- package/dist/index90.js.map +1 -1
- package/dist/index91.js +258 -2
- package/dist/index91.js.map +1 -1
- package/dist/index92.js +13 -6
- package/dist/index92.js.map +1 -1
- package/dist/index93.js +32 -151
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +5 -29
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +12 -28
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +46 -2
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +12 -71
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +13 -37
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +7 -25
- package/dist/index99.js.map +1 -1
- package/package.json +1 -1
package/dist/index119.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index119.js","sources":["../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/
|
|
1
|
+
{"version":3,"file":"index119.js","sources":["../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js"],"sourcesContent":["const ECLevel = require('./error-correction-level')\r\n\r\nconst EC_BLOCKS_TABLE = [\r\n// L M Q H\r\n 1, 1, 1, 1,\r\n 1, 1, 1, 1,\r\n 1, 1, 2, 2,\r\n 1, 2, 2, 4,\r\n 1, 2, 4, 4,\r\n 2, 4, 4, 4,\r\n 2, 4, 6, 5,\r\n 2, 4, 6, 6,\r\n 2, 5, 8, 8,\r\n 4, 5, 8, 8,\r\n 4, 5, 8, 11,\r\n 4, 8, 10, 11,\r\n 4, 9, 12, 16,\r\n 4, 9, 16, 16,\r\n 6, 10, 12, 18,\r\n 6, 10, 17, 16,\r\n 6, 11, 16, 19,\r\n 6, 13, 18, 21,\r\n 7, 14, 21, 25,\r\n 8, 16, 20, 25,\r\n 8, 17, 23, 25,\r\n 9, 17, 23, 34,\r\n 9, 18, 25, 30,\r\n 10, 20, 27, 32,\r\n 12, 21, 29, 35,\r\n 12, 23, 34, 37,\r\n 12, 25, 34, 40,\r\n 13, 26, 35, 42,\r\n 14, 28, 38, 45,\r\n 15, 29, 40, 48,\r\n 16, 31, 43, 51,\r\n 17, 33, 45, 54,\r\n 18, 35, 48, 57,\r\n 19, 37, 51, 60,\r\n 19, 38, 53, 63,\r\n 20, 40, 56, 66,\r\n 21, 43, 59, 70,\r\n 22, 45, 62, 74,\r\n 24, 47, 65, 77,\r\n 25, 49, 68, 81\r\n]\r\n\r\nconst EC_CODEWORDS_TABLE = [\r\n// L M Q H\r\n 7, 10, 13, 17,\r\n 10, 16, 22, 28,\r\n 15, 26, 36, 44,\r\n 20, 36, 52, 64,\r\n 26, 48, 72, 88,\r\n 36, 64, 96, 112,\r\n 40, 72, 108, 130,\r\n 48, 88, 132, 156,\r\n 60, 110, 160, 192,\r\n 72, 130, 192, 224,\r\n 80, 150, 224, 264,\r\n 96, 176, 260, 308,\r\n 104, 198, 288, 352,\r\n 120, 216, 320, 384,\r\n 132, 240, 360, 432,\r\n 144, 280, 408, 480,\r\n 168, 308, 448, 532,\r\n 180, 338, 504, 588,\r\n 196, 364, 546, 650,\r\n 224, 416, 600, 700,\r\n 224, 442, 644, 750,\r\n 252, 476, 690, 816,\r\n 270, 504, 750, 900,\r\n 300, 560, 810, 960,\r\n 312, 588, 870, 1050,\r\n 336, 644, 952, 1110,\r\n 360, 700, 1020, 1200,\r\n 390, 728, 1050, 1260,\r\n 420, 784, 1140, 1350,\r\n 450, 812, 1200, 1440,\r\n 480, 868, 1290, 1530,\r\n 510, 924, 1350, 1620,\r\n 540, 980, 1440, 1710,\r\n 570, 1036, 1530, 1800,\r\n 570, 1064, 1590, 1890,\r\n 600, 1120, 1680, 1980,\r\n 630, 1204, 1770, 2100,\r\n 660, 1260, 1860, 2220,\r\n 720, 1316, 1950, 2310,\r\n 750, 1372, 2040, 2430\r\n]\r\n\r\n/**\r\n * Returns the number of error correction block that the QR Code should contain\r\n * for the specified version and error correction level.\r\n *\r\n * @param {Number} version QR Code version\r\n * @param {Number} errorCorrectionLevel Error correction level\r\n * @return {Number} Number of error correction blocks\r\n */\r\nexports.getBlocksCount = function getBlocksCount (version, errorCorrectionLevel) {\r\n switch (errorCorrectionLevel) {\r\n case ECLevel.L:\r\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 0]\r\n case ECLevel.M:\r\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 1]\r\n case ECLevel.Q:\r\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 2]\r\n case ECLevel.H:\r\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 3]\r\n default:\r\n return undefined\r\n }\r\n}\r\n\r\n/**\r\n * Returns the number of error correction codewords to use for the specified\r\n * version and error correction level.\r\n *\r\n * @param {Number} version QR Code version\r\n * @param {Number} errorCorrectionLevel Error correction level\r\n * @return {Number} Number of error correction codewords\r\n */\r\nexports.getTotalCodewordsCount = function getTotalCodewordsCount (version, errorCorrectionLevel) {\r\n switch (errorCorrectionLevel) {\r\n case ECLevel.L:\r\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0]\r\n case ECLevel.M:\r\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1]\r\n case ECLevel.Q:\r\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2]\r\n case ECLevel.H:\r\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3]\r\n default:\r\n return undefined\r\n }\r\n}\r\n"],"names":["ECLevel","require$$0","EC_BLOCKS_TABLE","EC_CODEWORDS_TABLE","errorCorrectionCode","version","errorCorrectionLevel"],"mappings":";;;;;;AAAA,QAAMA,IAAUC,EAAA,GAEVC,IAAkB;AAAA;AAAA,IAEtB;AAAA,IAAG;AAAA,IAAG;AAAA,IAAG;AAAA,IACT;AAAA,IAAG;AAAA,IAAG;AAAA,IAAG;AA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,IAAK;AAAA,IAAM;AAAA,IAAM;AAAA;AAWnB,SAAAC,EAAA,iBAAyB,SAAyBC,GAASC,GAAsB;AAC/E,YAAQA,GAAoB;AAAA,MAC1B,KAAKN,EAAQ;AACX,eAAOE,GAAiBG,IAAU,KAAK,IAAI,CAAC;AAAA,MAC9C,KAAKL,EAAQ;AACX,eAAOE,GAAiBG,IAAU,KAAK,IAAI,CAAC;AAAA,MAC9C,KAAKL,EAAQ;AACX,eAAOE,GAAiBG,IAAU,KAAK,IAAI,CAAC;AAAA,MAC9C,KAAKL,EAAQ;AACX,eAAOE,GAAiBG,IAAU,KAAK,IAAI,CAAC;AAAA,MAC9C;AACE;AAAA;EAEN,GAUAD,EAAA,yBAAiC,SAAiCC,GAASC,GAAsB;AAC/F,YAAQA,GAAoB;AAAA,MAC1B,KAAKN,EAAQ;AACX,eAAOG,GAAoBE,IAAU,KAAK,IAAI,CAAC;AAAA,MACjD,KAAKL,EAAQ;AACX,eAAOG,GAAoBE,IAAU,KAAK,IAAI,CAAC;AAAA,MACjD,KAAKL,EAAQ;AACX,eAAOG,GAAoBE,IAAU,KAAK,IAAI,CAAC;AAAA,MACjD,KAAKL,EAAQ;AACX,eAAOG,GAAoBE,IAAU,KAAK,IAAI,CAAC;AAAA,MACjD;AACE;AAAA;EAEN;;","x_google_ignoreList":[0]}
|
package/dist/index12.js
CHANGED
|
@@ -1,98 +1,268 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsxs as N, jsx as h, Fragment as q } from "react/jsx-runtime";
|
|
2
|
+
import { useState as x, useRef as z, useEffect as R, useCallback as D } from "react";
|
|
3
|
+
const G = [
|
|
4
|
+
"#000000",
|
|
5
|
+
"#434343",
|
|
6
|
+
"#666666",
|
|
7
|
+
"#999999",
|
|
8
|
+
"#b7b7b7",
|
|
9
|
+
"#cccccc",
|
|
10
|
+
"#d9d9d9",
|
|
11
|
+
"#efefef",
|
|
12
|
+
"#f3f3f3",
|
|
13
|
+
"#ffffff",
|
|
14
|
+
"#980000",
|
|
15
|
+
"#ff0000",
|
|
16
|
+
"#ff9900",
|
|
17
|
+
"#ffff00",
|
|
18
|
+
"#00ff00",
|
|
19
|
+
"#00ffff",
|
|
20
|
+
"#4a86e8",
|
|
21
|
+
"#0000ff",
|
|
22
|
+
"#9900ff",
|
|
23
|
+
"#ff00ff",
|
|
24
|
+
"#e6b8af",
|
|
25
|
+
"#f4cccc",
|
|
26
|
+
"#fce5cd",
|
|
27
|
+
"#fff2cc",
|
|
28
|
+
"#d9ead3",
|
|
29
|
+
"#d0e0e3",
|
|
30
|
+
"#c9daf8",
|
|
31
|
+
"#cfe2f3",
|
|
32
|
+
"#d9d2e9",
|
|
33
|
+
"#ead1dc",
|
|
34
|
+
"#dd7e6b",
|
|
35
|
+
"#ea9999",
|
|
36
|
+
"#f9cb9c",
|
|
37
|
+
"#ffe599",
|
|
38
|
+
"#b6d7a8",
|
|
39
|
+
"#a2c4c9",
|
|
40
|
+
"#a4c2f4",
|
|
41
|
+
"#9fc5e8",
|
|
42
|
+
"#b4a7d6",
|
|
43
|
+
"#d5a6bd",
|
|
44
|
+
"#cc4125",
|
|
45
|
+
"#e06666",
|
|
46
|
+
"#f6b26b",
|
|
47
|
+
"#ffd966",
|
|
48
|
+
"#93c47d",
|
|
49
|
+
"#76a5af",
|
|
50
|
+
"#6d9eeb",
|
|
51
|
+
"#6fa8dc",
|
|
52
|
+
"#8e7cc3",
|
|
53
|
+
"#c27ba0",
|
|
54
|
+
"#a61c00",
|
|
55
|
+
"#cc0000",
|
|
56
|
+
"#e69138",
|
|
57
|
+
"#f1c232",
|
|
58
|
+
"#6aa84f",
|
|
59
|
+
"#45818e",
|
|
60
|
+
"#3c78d8",
|
|
61
|
+
"#3d85c6",
|
|
62
|
+
"#674ea7",
|
|
63
|
+
"#a64d79",
|
|
64
|
+
"#85200c",
|
|
65
|
+
"#990000",
|
|
66
|
+
"#b45f06",
|
|
67
|
+
"#bf9000",
|
|
68
|
+
"#38761d",
|
|
69
|
+
"#134f5c",
|
|
70
|
+
"#1155cc",
|
|
71
|
+
"#0b5394",
|
|
72
|
+
"#351c75",
|
|
73
|
+
"#741b47",
|
|
74
|
+
"#5b0f00",
|
|
75
|
+
"#660000",
|
|
76
|
+
"#783f04",
|
|
77
|
+
"#7f6000",
|
|
78
|
+
"#274e13",
|
|
79
|
+
"#0c343d",
|
|
80
|
+
"#1c4587",
|
|
81
|
+
"#073763",
|
|
82
|
+
"#20124d",
|
|
83
|
+
"#4c1130"
|
|
84
|
+
];
|
|
85
|
+
function J(o, r, c) {
|
|
86
|
+
r /= 100, c /= 100;
|
|
87
|
+
const i = r * Math.min(c, 1 - c), a = (t) => {
|
|
88
|
+
const l = (t + o / 30) % 12, u = c - i * Math.max(Math.min(l - 3, 9 - l, 1), -1);
|
|
89
|
+
return Math.round(255 * u).toString(16).padStart(2, "0");
|
|
90
|
+
};
|
|
91
|
+
return `#${a(0)}${a(8)}${a(4)}`;
|
|
92
|
+
}
|
|
93
|
+
function w(o) {
|
|
94
|
+
const r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);
|
|
95
|
+
if (!r) return { h: 0, s: 100, l: 50 };
|
|
96
|
+
let c = parseInt(r[1], 16) / 255, i = parseInt(r[2], 16) / 255, a = parseInt(r[3], 16) / 255;
|
|
97
|
+
const t = Math.max(c, i, a), l = Math.min(c, i, a);
|
|
98
|
+
let u = 0, f = 0;
|
|
99
|
+
const p = (t + l) / 2;
|
|
100
|
+
if (t !== l) {
|
|
101
|
+
const d = t - l;
|
|
102
|
+
switch (f = p > 0.5 ? d / (2 - t - l) : d / (t + l), t) {
|
|
103
|
+
case c:
|
|
104
|
+
u = ((i - a) / d + (i < a ? 6 : 0)) / 6;
|
|
105
|
+
break;
|
|
106
|
+
case i:
|
|
107
|
+
u = ((a - c) / d + 2) / 6;
|
|
108
|
+
break;
|
|
109
|
+
case a:
|
|
110
|
+
u = ((c - i) / d + 4) / 6;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return { h: Math.round(u * 360), s: Math.round(f * 100), l: Math.round(p * 100) };
|
|
115
|
+
}
|
|
116
|
+
function E(o) {
|
|
117
|
+
return /^#[0-9A-Fa-f]{6}$/.test(o);
|
|
118
|
+
}
|
|
119
|
+
function M(o) {
|
|
120
|
+
let r = o.trim();
|
|
121
|
+
return r.startsWith("#") || (r = "#" + r), r.toLowerCase();
|
|
9
122
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
side: w = !1,
|
|
20
|
-
imageFull: x = !1,
|
|
21
|
-
actionsJustify: t = "end",
|
|
22
|
-
loading: b = !1,
|
|
23
|
-
hoverable: k = !1,
|
|
24
|
-
avatar: l,
|
|
25
|
-
description: i,
|
|
26
|
-
...f
|
|
123
|
+
function Z({
|
|
124
|
+
value: o = "#000000",
|
|
125
|
+
onChange: r,
|
|
126
|
+
mode: c = "both",
|
|
127
|
+
presets: i = G,
|
|
128
|
+
size: a = "md",
|
|
129
|
+
disabled: t = !1,
|
|
130
|
+
className: l = "",
|
|
131
|
+
...u
|
|
27
132
|
}) {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
133
|
+
const [f, p] = x(() => w(o)), [d, m] = x(o), [$, H] = x(!1), [v, I] = x(!1), k = z(null), C = z(null);
|
|
134
|
+
R(() => {
|
|
135
|
+
E(o) && (p(w(o)), m(o));
|
|
136
|
+
}, [o]);
|
|
137
|
+
const g = D((e) => {
|
|
138
|
+
p(e);
|
|
139
|
+
const n = J(e.h, e.s, e.l);
|
|
140
|
+
m(n), r?.(n);
|
|
141
|
+
}, [r]), S = D((e, n) => {
|
|
142
|
+
if (!k.current || t) return;
|
|
143
|
+
const s = k.current.getBoundingClientRect(), y = Math.max(0, Math.min(1, (e - s.left) / s.width)), V = Math.max(0, Math.min(1, (n - s.top) / s.height)), W = Math.round(y * 100), _ = Math.round((1 - V) * 100);
|
|
144
|
+
g({ ...f, s: W, l: _ });
|
|
145
|
+
}, [f, g, t]), X = (e) => {
|
|
146
|
+
t || (H(!0), S(e.clientX, e.clientY));
|
|
147
|
+
}, L = D((e) => {
|
|
148
|
+
if (!C.current || t) return;
|
|
149
|
+
const n = C.current.getBoundingClientRect(), s = Math.max(0, Math.min(1, (e - n.left) / n.width)), y = Math.round(s * 360);
|
|
150
|
+
g({ ...f, h: y });
|
|
151
|
+
}, [f, g, t]), P = (e) => {
|
|
152
|
+
t || (I(!0), L(e.clientX));
|
|
47
153
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
154
|
+
R(() => {
|
|
155
|
+
const e = (s) => {
|
|
156
|
+
$ ? S(s.clientX, s.clientY) : v && L(s.clientX);
|
|
157
|
+
}, n = () => {
|
|
158
|
+
H(!1), I(!1);
|
|
159
|
+
};
|
|
160
|
+
if ($ || v)
|
|
161
|
+
return document.addEventListener("mousemove", e), document.addEventListener("mouseup", n), () => {
|
|
162
|
+
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", n);
|
|
163
|
+
};
|
|
164
|
+
}, [$, v, S, L]);
|
|
165
|
+
const T = (e) => {
|
|
166
|
+
const n = e.target.value;
|
|
167
|
+
m(n);
|
|
168
|
+
const s = M(n);
|
|
169
|
+
E(s) && (p(w(s)), r?.(s));
|
|
170
|
+
}, Y = (e) => {
|
|
171
|
+
if (t) return;
|
|
172
|
+
const n = M(e);
|
|
173
|
+
p(w(n)), m(n), r?.(n);
|
|
174
|
+
}, b = {
|
|
175
|
+
xs: { panel: "w-32 h-32", hue: "h-3", swatch: "w-4 h-4", input: "input-xs" },
|
|
176
|
+
sm: { panel: "w-40 h-40", hue: "h-4", swatch: "w-5 h-5", input: "input-sm" },
|
|
177
|
+
md: { panel: "w-48 h-48", hue: "h-5", swatch: "w-6 h-6", input: "input-md" },
|
|
178
|
+
lg: { panel: "w-56 h-56", hue: "h-6", swatch: "w-7 h-7", input: "input-lg" }
|
|
179
|
+
}[a], F = c === "picker" || c === "both", j = c === "swatches" || c === "both", A = f.s / 100, B = 1 - f.l / 100, U = f.h / 360;
|
|
180
|
+
return /* @__PURE__ */ N("div", { className: `inline-flex flex-col gap-3 ${t ? "opacity-50 pointer-events-none" : ""} ${l}`, ...u, children: [
|
|
181
|
+
F && /* @__PURE__ */ N(q, { children: [
|
|
182
|
+
/* @__PURE__ */ h(
|
|
183
|
+
"div",
|
|
184
|
+
{
|
|
185
|
+
ref: k,
|
|
186
|
+
className: `${b.panel} relative rounded cursor-crosshair select-none`,
|
|
187
|
+
style: {
|
|
188
|
+
background: `
|
|
189
|
+
linear-gradient(to top, #000, transparent),
|
|
190
|
+
linear-gradient(to right, #fff, hsl(${f.h}, 100%, 50%))
|
|
191
|
+
`
|
|
192
|
+
},
|
|
193
|
+
onMouseDown: X,
|
|
194
|
+
children: /* @__PURE__ */ h(
|
|
195
|
+
"div",
|
|
196
|
+
{
|
|
197
|
+
className: "absolute w-4 h-4 border-2 border-white rounded-full shadow-md pointer-events-none",
|
|
198
|
+
style: {
|
|
199
|
+
left: `calc(${A * 100}% - 8px)`,
|
|
200
|
+
top: `calc(${B * 100}% - 8px)`,
|
|
201
|
+
boxShadow: "0 0 0 1px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.3)"
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
),
|
|
207
|
+
/* @__PURE__ */ h(
|
|
208
|
+
"div",
|
|
209
|
+
{
|
|
210
|
+
ref: C,
|
|
211
|
+
className: `${b.hue} w-full relative rounded cursor-pointer select-none`,
|
|
212
|
+
style: {
|
|
213
|
+
background: "linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00)"
|
|
214
|
+
},
|
|
215
|
+
onMouseDown: P,
|
|
216
|
+
children: /* @__PURE__ */ h(
|
|
217
|
+
"div",
|
|
218
|
+
{
|
|
219
|
+
className: "absolute top-1/2 w-3 h-full border-2 border-white rounded-sm shadow-md pointer-events-none",
|
|
220
|
+
style: {
|
|
221
|
+
left: `calc(${U * 100}% - 6px)`,
|
|
222
|
+
transform: "translateY(-50%)",
|
|
223
|
+
boxShadow: "0 0 0 1px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.3)"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
),
|
|
229
|
+
/* @__PURE__ */ N("div", { className: "flex items-center gap-2", children: [
|
|
230
|
+
/* @__PURE__ */ h(
|
|
231
|
+
"div",
|
|
232
|
+
{
|
|
233
|
+
className: "w-8 h-8 rounded border border-base-300 flex-shrink-0",
|
|
234
|
+
style: { backgroundColor: E(M(d)) ? M(d) : o }
|
|
235
|
+
}
|
|
236
|
+
),
|
|
237
|
+
/* @__PURE__ */ h(
|
|
238
|
+
"input",
|
|
239
|
+
{
|
|
240
|
+
type: "text",
|
|
241
|
+
value: d,
|
|
242
|
+
onChange: T,
|
|
243
|
+
className: `input input-bordered ${b.input} w-full font-mono uppercase`,
|
|
244
|
+
placeholder: "#000000",
|
|
245
|
+
maxLength: 7,
|
|
246
|
+
disabled: t
|
|
247
|
+
}
|
|
248
|
+
)
|
|
69
249
|
] })
|
|
70
|
-
] })
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
] }) : /* @__PURE__ */ e(h, { children: [
|
|
84
|
-
a && /* @__PURE__ */ s("h2", { className: "card-title", children: a }),
|
|
85
|
-
r
|
|
86
|
-
] }),
|
|
87
|
-
c && /* @__PURE__ */ s("div", { className: `card-actions ${u[t]}`, children: c })
|
|
88
|
-
] })
|
|
250
|
+
] }),
|
|
251
|
+
j && /* @__PURE__ */ h("div", { className: "grid grid-cols-10 gap-1", children: i.map((e, n) => /* @__PURE__ */ h(
|
|
252
|
+
"button",
|
|
253
|
+
{
|
|
254
|
+
type: "button",
|
|
255
|
+
className: `${b.swatch} rounded border border-base-300 cursor-pointer hover:scale-110 transition-transform ${o.toLowerCase() === e.toLowerCase() ? "ring-2 ring-primary ring-offset-1" : ""}`,
|
|
256
|
+
style: { backgroundColor: e },
|
|
257
|
+
onClick: () => Y(e),
|
|
258
|
+
disabled: t,
|
|
259
|
+
"aria-label": `Select color ${e}`
|
|
260
|
+
},
|
|
261
|
+
`${e}-${n}`
|
|
262
|
+
)) })
|
|
89
263
|
] });
|
|
90
264
|
}
|
|
91
|
-
const B = Object.assign(j, {
|
|
92
|
-
Grid: g
|
|
93
|
-
});
|
|
94
265
|
export {
|
|
95
|
-
|
|
96
|
-
B as default
|
|
266
|
+
Z as ColorPicker
|
|
97
267
|
};
|
|
98
268
|
//# sourceMappingURL=index12.js.map
|
package/dist/index12.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index12.js","sources":["../src/components/Card.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n children: React.ReactNode\n title?: React.ReactNode\n cover?: React.ReactNode\n actions?: React.ReactNode\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n bordered?: boolean\n side?: boolean\n imageFull?: boolean\n actionsJustify?: 'start' | 'center' | 'end'\n loading?: boolean\n hoverable?: boolean\n // Meta props for avatar + description layout\n avatar?: React.ReactNode\n description?: React.ReactNode\n}\n\nexport interface CardGridProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n hoverable?: boolean\n}\n\nfunction CardGrid({ children, hoverable = false, className = '', style, ...rest }: CardGridProps) {\n const classes = [\n 'p-6 border border-base-content/10',\n hoverable && 'cursor-pointer hover:shadow-md transition-shadow',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <div className={classes} style={style} {...rest}>\n {children}\n </div>\n )\n}\n\nfunction CardRoot({\n children,\n title,\n cover,\n actions,\n className = '',\n style,\n size,\n bordered = true,\n side = false,\n imageFull = false,\n actionsJustify = 'end',\n loading = false,\n hoverable = false,\n avatar,\n description,\n ...rest\n}: CardProps) {\n const sizeClasses: Record<string, string> = {\n xs: 'card-xs',\n sm: 'card-sm',\n md: 'card-md',\n lg: 'card-lg',\n xl: 'card-xl',\n }\n\n const classes = [\n 'card',\n 'bg-base-100',\n size && sizeClasses[size],\n bordered && 'border border-base-content/10 shadow-sm',\n side && 'card-side',\n imageFull && 'image-full',\n hoverable && 'transition-shadow hover:shadow-lg cursor-pointer',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n const justifyClasses: Record<string, string> = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n }\n\n if (loading) {\n return (\n <div className={classes} style={style} {...rest}>\n {cover && (\n <figure>\n <div className=\"skeleton h-48 w-full rounded-none\" />\n </figure>\n )}\n <div className=\"card-body\">\n {(avatar || title) && (\n <div className=\"flex gap-4 mb-4\">\n {avatar && <div className=\"skeleton w-12 h-12 rounded-full flex-shrink-0\" />}\n <div className=\"flex-1 space-y-2\">\n <div className=\"skeleton h-6 w-2/3\" />\n {description && <div className=\"skeleton h-4 w-full\" />}\n </div>\n </div>\n )}\n {!avatar && !title && (\n <>\n <div className=\"skeleton h-6 w-2/3 mb-4\" />\n <div className=\"space-y-2\">\n <div className=\"skeleton h-4 w-full\" />\n <div className=\"skeleton h-4 w-5/6\" />\n <div className=\"skeleton h-4 w-4/6\" />\n </div>\n </>\n )}\n {actions && (\n <div className={`card-actions ${justifyClasses[actionsJustify]} mt-4`}>\n <div className=\"skeleton h-10 w-20\" />\n <div className=\"skeleton h-10 w-20\" />\n </div>\n )}\n </div>\n </div>\n )\n }\n\n // Render with avatar + title + description layout (meta style)\n const hasMetaLayout = avatar || (title && description)\n\n return (\n <div className={classes} style={style} {...rest}>\n {cover && <figure>{cover}</figure>}\n <div className=\"card-body\">\n {hasMetaLayout ? (\n <>\n <div className=\"flex gap-4\">\n {avatar && <div className=\"flex-shrink-0\">{avatar}</div>}\n <div className=\"flex-1 min-w-0\">\n {title && <h2 className=\"card-title\">{title}</h2>}\n {description && <p className=\"text-sm opacity-70 mt-1\">{description}</p>}\n </div>\n </div>\n {children}\n </>\n ) : (\n <>\n {title && <h2 className=\"card-title\">{title}</h2>}\n {children}\n </>\n )}\n {actions && <div className={`card-actions ${justifyClasses[actionsJustify]}`}>{actions}</div>}\n </div>\n </div>\n )\n}\n\nexport const Card = Object.assign(CardRoot, {\n Grid: CardGrid,\n})\n\nexport default Card\n"],"names":["CardGrid","children","hoverable","className","style","rest","classes","CardRoot","title","cover","actions","size","bordered","side","imageFull","actionsJustify","loading","avatar","description","justifyClasses","jsx","jsxs","Fragment","Card"],"mappings":";AAwBA,SAASA,EAAS,EAAE,UAAAC,GAAU,WAAAC,IAAY,IAAO,WAAAC,IAAY,IAAI,OAAAC,GAAO,GAAGC,KAAuB;AAChG,QAAMC,IAAU;AAAA,IACd;AAAA,IACAJ,KAAa;AAAA,IACbC;AAAA,EAAA,EAEC,OAAO,OAAO,EACd,KAAK,GA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,GAAO;AAAA,UAClD,gBAAAI,EAAC,OAAA,EAAI,WAAU,kBACZ,UAAA;AAAA,YAAAb,KAAS,gBAAAY,EAAC,MAAA,EAAG,WAAU,cAAc,UAAAZ,GAAM;AAAA,YAC3CU,KAAe,gBAAAE,EAAC,KAAA,EAAE,WAAU,2BAA2B,UAAAF,EAAA,CAAY;AAAA,UAAA,EAAA,CACtE;AAAA,QAAA,GACF;AAAA,QACCjB;AAAA,MAAA,EAAA,CACH,IAEA,gBAAAoB,EAAAC,GAAA,EACG,UAAA;AAAA,QAAAd,KAAS,gBAAAY,EAAC,MAAA,EAAG,WAAU,cAAc,UAAAZ,GAAM;AAAA,QAC3CP;AAAA,MAAA,GACH;AAAA,MAEDS,uBAAY,OAAA,EAAI,WAAW,gBAAgBS,EAAeJ,CAAc,CAAC,IAAK,UAAAL,EAAA,CAAQ;AAAA,IAAA,EAAA,CACzF;AAAA,EAAA,GACF;AAEJ;AAEO,MAAMa,IAAO,OAAO,OAAOhB,GAAU;AAAA,EAC1C,MAAMP;AACR,CAAC;"}
|
|
1
|
+
{"version":3,"file":"index12.js","sources":["../src/components/ColorPicker.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect, useCallback } from 'react'\n\nexport interface ColorPickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n value?: string\n onChange?: (color: string) => void\n mode?: 'swatches' | 'picker' | 'both'\n presets?: string[]\n size?: 'xs' | 'sm' | 'md' | 'lg'\n disabled?: boolean\n}\n\nconst DEFAULT_PRESETS = [\n '#000000', '#434343', '#666666', '#999999', '#b7b7b7', '#cccccc', '#d9d9d9', '#efefef', '#f3f3f3', '#ffffff',\n '#980000', '#ff0000', '#ff9900', '#ffff00', '#00ff00', '#00ffff', '#4a86e8', '#0000ff', '#9900ff', '#ff00ff',\n '#e6b8af', '#f4cccc', '#fce5cd', '#fff2cc', '#d9ead3', '#d0e0e3', '#c9daf8', '#cfe2f3', '#d9d2e9', '#ead1dc',\n '#dd7e6b', '#ea9999', '#f9cb9c', '#ffe599', '#b6d7a8', '#a2c4c9', '#a4c2f4', '#9fc5e8', '#b4a7d6', '#d5a6bd',\n '#cc4125', '#e06666', '#f6b26b', '#ffd966', '#93c47d', '#76a5af', '#6d9eeb', '#6fa8dc', '#8e7cc3', '#c27ba0',\n '#a61c00', '#cc0000', '#e69138', '#f1c232', '#6aa84f', '#45818e', '#3c78d8', '#3d85c6', '#674ea7', '#a64d79',\n '#85200c', '#990000', '#b45f06', '#bf9000', '#38761d', '#134f5c', '#1155cc', '#0b5394', '#351c75', '#741b47',\n '#5b0f00', '#660000', '#783f04', '#7f6000', '#274e13', '#0c343d', '#1c4587', '#073763', '#20124d', '#4c1130',\n]\n\n// Convert HSL to Hex\nfunction hslToHex(h: number, s: number, l: number): string {\n s /= 100\n l /= 100\n const a = s * Math.min(l, 1 - l)\n const f = (n: number) => {\n const k = (n + h / 30) % 12\n const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)\n return Math.round(255 * color).toString(16).padStart(2, '0')\n }\n return `#${f(0)}${f(8)}${f(4)}`\n}\n\n// Convert Hex to HSL\nfunction hexToHsl(hex: string): { h: number; s: number; l: number } {\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex)\n if (!result) return { h: 0, s: 100, l: 50 }\n\n let r = parseInt(result[1], 16) / 255\n let g = parseInt(result[2], 16) / 255\n let b = parseInt(result[3], 16) / 255\n\n const max = Math.max(r, g, b)\n const min = Math.min(r, g, b)\n let h = 0\n let s = 0\n const l = (max + min) / 2\n\n if (max !== min) {\n const d = max - min\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min)\n switch (max) {\n case r:\n h = ((g - b) / d + (g < b ? 6 : 0)) / 6\n break\n case g:\n h = ((b - r) / d + 2) / 6\n break\n case b:\n h = ((r - g) / d + 4) / 6\n break\n }\n }\n\n return { h: Math.round(h * 360), s: Math.round(s * 100), l: Math.round(l * 100) }\n}\n\n// Validate hex color\nfunction isValidHex(hex: string): boolean {\n return /^#[0-9A-Fa-f]{6}$/.test(hex)\n}\n\n// Normalize hex (add # if missing, uppercase)\nfunction normalizeHex(hex: string): string {\n let normalized = hex.trim()\n if (!normalized.startsWith('#')) {\n normalized = '#' + normalized\n }\n return normalized.toLowerCase()\n}\n\nexport function ColorPicker({\n value = '#000000',\n onChange,\n mode = 'both',\n presets = DEFAULT_PRESETS,\n size = 'md',\n disabled = false,\n className = '',\n ...rest\n}: ColorPickerProps) {\n const [hsl, setHsl] = useState(() => hexToHsl(value))\n const [hexInput, setHexInput] = useState(value)\n const [isDraggingSL, setIsDraggingSL] = useState(false)\n const [isDraggingHue, setIsDraggingHue] = useState(false)\n const slPanelRef = useRef<HTMLDivElement>(null)\n const hueSliderRef = useRef<HTMLDivElement>(null)\n\n // Sync internal state when value prop changes\n useEffect(() => {\n if (isValidHex(value)) {\n setHsl(hexToHsl(value))\n setHexInput(value)\n }\n }, [value])\n\n const updateColor = useCallback((newHsl: { h: number; s: number; l: number }) => {\n setHsl(newHsl)\n const hex = hslToHex(newHsl.h, newHsl.s, newHsl.l)\n setHexInput(hex)\n onChange?.(hex)\n }, [onChange])\n\n // Saturation/Lightness panel handlers\n const handleSLChange = useCallback((clientX: number, clientY: number) => {\n if (!slPanelRef.current || disabled) return\n const rect = slPanelRef.current.getBoundingClientRect()\n const x = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width))\n const y = Math.max(0, Math.min(1, (clientY - rect.top) / rect.height))\n\n // Convert x,y to saturation and lightness\n // x = saturation (0-100), y = lightness (100-0)\n const s = Math.round(x * 100)\n const l = Math.round((1 - y) * 100)\n updateColor({ ...hsl, s, l })\n }, [hsl, updateColor, disabled])\n\n const handleSLMouseDown = (e: React.MouseEvent) => {\n if (disabled) return\n setIsDraggingSL(true)\n handleSLChange(e.clientX, e.clientY)\n }\n\n // Hue slider handlers\n const handleHueChange = useCallback((clientX: number) => {\n if (!hueSliderRef.current || disabled) return\n const rect = hueSliderRef.current.getBoundingClientRect()\n const x = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width))\n const h = Math.round(x * 360)\n updateColor({ ...hsl, h })\n }, [hsl, updateColor, disabled])\n\n const handleHueMouseDown = (e: React.MouseEvent) => {\n if (disabled) return\n setIsDraggingHue(true)\n handleHueChange(e.clientX)\n }\n\n // Global mouse handlers for dragging\n useEffect(() => {\n const handleMouseMove = (e: MouseEvent) => {\n if (isDraggingSL) {\n handleSLChange(e.clientX, e.clientY)\n } else if (isDraggingHue) {\n handleHueChange(e.clientX)\n }\n }\n\n const handleMouseUp = () => {\n setIsDraggingSL(false)\n setIsDraggingHue(false)\n }\n\n if (isDraggingSL || isDraggingHue) {\n document.addEventListener('mousemove', handleMouseMove)\n document.addEventListener('mouseup', handleMouseUp)\n return () => {\n document.removeEventListener('mousemove', handleMouseMove)\n document.removeEventListener('mouseup', handleMouseUp)\n }\n }\n }, [isDraggingSL, isDraggingHue, handleSLChange, handleHueChange])\n\n // Hex input handler\n const handleHexChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value\n setHexInput(newValue)\n const normalized = normalizeHex(newValue)\n if (isValidHex(normalized)) {\n setHsl(hexToHsl(normalized))\n onChange?.(normalized)\n }\n }\n\n // Preset click handler\n const handlePresetClick = (color: string) => {\n if (disabled) return\n const normalized = normalizeHex(color)\n setHsl(hexToHsl(normalized))\n setHexInput(normalized)\n onChange?.(normalized)\n }\n\n // Size configurations\n const sizeConfig = {\n xs: { panel: 'w-32 h-32', hue: 'h-3', swatch: 'w-4 h-4', input: 'input-xs' },\n sm: { panel: 'w-40 h-40', hue: 'h-4', swatch: 'w-5 h-5', input: 'input-sm' },\n md: { panel: 'w-48 h-48', hue: 'h-5', swatch: 'w-6 h-6', input: 'input-md' },\n lg: { panel: 'w-56 h-56', hue: 'h-6', swatch: 'w-7 h-7', input: 'input-lg' },\n }\n\n const config = sizeConfig[size]\n const showPicker = mode === 'picker' || mode === 'both'\n const showSwatches = mode === 'swatches' || mode === 'both'\n\n // Calculate picker position\n const slX = hsl.s / 100\n const slY = 1 - hsl.l / 100\n const hueX = hsl.h / 360\n\n return (\n <div className={`inline-flex flex-col gap-3 ${disabled ? 'opacity-50 pointer-events-none' : ''} ${className}`} {...rest}>\n {showPicker && (\n <>\n {/* Saturation/Lightness Panel */}\n <div\n ref={slPanelRef}\n className={`${config.panel} relative rounded cursor-crosshair select-none`}\n style={{\n background: `\n linear-gradient(to top, #000, transparent),\n linear-gradient(to right, #fff, hsl(${hsl.h}, 100%, 50%))\n `,\n }}\n onMouseDown={handleSLMouseDown}\n >\n {/* Picker indicator */}\n <div\n className=\"absolute w-4 h-4 border-2 border-white rounded-full shadow-md pointer-events-none\"\n style={{\n left: `calc(${slX * 100}% - 8px)`,\n top: `calc(${slY * 100}% - 8px)`,\n boxShadow: '0 0 0 1px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.3)',\n }}\n />\n </div>\n\n {/* Hue Slider */}\n <div\n ref={hueSliderRef}\n className={`${config.hue} w-full relative rounded cursor-pointer select-none`}\n style={{\n background: 'linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00)',\n }}\n onMouseDown={handleHueMouseDown}\n >\n {/* Hue indicator */}\n <div\n className=\"absolute top-1/2 w-3 h-full border-2 border-white rounded-sm shadow-md pointer-events-none\"\n style={{\n left: `calc(${hueX * 100}% - 6px)`,\n transform: 'translateY(-50%)',\n boxShadow: '0 0 0 1px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.3)',\n }}\n />\n </div>\n\n {/* Hex Input and Preview */}\n <div className=\"flex items-center gap-2\">\n <div\n className=\"w-8 h-8 rounded border border-base-300 flex-shrink-0\"\n style={{ backgroundColor: isValidHex(normalizeHex(hexInput)) ? normalizeHex(hexInput) : value }}\n />\n <input\n type=\"text\"\n value={hexInput}\n onChange={handleHexChange}\n className={`input input-bordered ${config.input} w-full font-mono uppercase`}\n placeholder=\"#000000\"\n maxLength={7}\n disabled={disabled}\n />\n </div>\n </>\n )}\n\n {showSwatches && (\n <div className=\"grid grid-cols-10 gap-1\">\n {presets.map((color, index) => (\n <button\n key={`${color}-${index}`}\n type=\"button\"\n className={`${config.swatch} rounded border border-base-300 cursor-pointer hover:scale-110 transition-transform ${\n value.toLowerCase() === color.toLowerCase() ? 'ring-2 ring-primary ring-offset-1' : ''\n }`}\n style={{ backgroundColor: color }}\n onClick={() => handlePresetClick(color)}\n disabled={disabled}\n aria-label={`Select color ${color}`}\n />\n ))}\n </div>\n )}\n </div>\n )\n}\n"],"names":["DEFAULT_PRESETS","hslToHex","h","s","l","a","f","n","k","color","hexToHsl","hex","result","r","g","b","max","min","isValidHex","normalizeHex","normalized","ColorPicker","value","onChange","mode","presets","size","disabled","className","rest","hsl","setHsl","useState","hexInput","setHexInput","isDraggingSL","setIsDraggingSL","isDraggingHue","setIsDraggingHue","slPanelRef","useRef","hueSliderRef","useEffect","updateColor","useCallback","newHsl","handleSLChange","clientX","clientY","rect","x","y","handleSLMouseDown","handleHueChange","handleHueMouseDown","handleMouseMove","e","handleMouseUp","handleHexChange","newValue","handlePresetClick","config","showPicker","showSwatches","slX","slY","hueX","jsxs","Fragment","jsx","index"],"mappings":";;AAWA,MAAMA,IAAkB;AAAA,EACtB;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EACnG;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EACnG;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EACnG;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,E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AR5B,GAAGA,CAAK,IAAI6D,CAAK;AAAA,IAAA,CAUzB,EAAA,CACH;AAAA,EAAA,GAEJ;AAEJ;"}
|
package/dist/index120.js
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
import { __require as h } from "./index135.js";
|
|
2
|
+
var o, a;
|
|
3
|
+
function g() {
|
|
4
|
+
if (a) return o;
|
|
5
|
+
a = 1;
|
|
6
|
+
const t = h();
|
|
7
|
+
function n(i) {
|
|
8
|
+
this.genPoly = void 0, this.degree = i, this.degree && this.initialize(this.degree);
|
|
9
|
+
}
|
|
10
|
+
return n.prototype.initialize = function(e) {
|
|
11
|
+
this.degree = e, this.genPoly = t.generateECPolynomial(this.degree);
|
|
12
|
+
}, n.prototype.encode = function(e) {
|
|
13
|
+
if (!this.genPoly)
|
|
14
|
+
throw new Error("Encoder not initialized");
|
|
15
|
+
const d = new Uint8Array(e.length + this.degree);
|
|
16
|
+
d.set(e);
|
|
17
|
+
const r = t.mod(d, this.genPoly), s = this.degree - r.length;
|
|
18
|
+
if (s > 0) {
|
|
19
|
+
const l = new Uint8Array(this.degree);
|
|
20
|
+
return l.set(r, s), l;
|
|
21
|
+
}
|
|
22
|
+
return r;
|
|
23
|
+
}, o = n, o;
|
|
24
|
+
}
|
|
2
25
|
export {
|
|
3
|
-
|
|
26
|
+
g as __require
|
|
4
27
|
};
|
|
5
28
|
//# sourceMappingURL=index120.js.map
|
package/dist/index120.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index120.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"index120.js","sources":["../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/reed-solomon-encoder.js"],"sourcesContent":["const Polynomial = require('./polynomial')\n\nfunction ReedSolomonEncoder (degree) {\n this.genPoly = undefined\n this.degree = degree\n\n if (this.degree) this.initialize(this.degree)\n}\n\n/**\n * Initialize the encoder.\n * The input param should correspond to the number of error correction codewords.\n *\n * @param {Number} degree\n */\nReedSolomonEncoder.prototype.initialize = function initialize (degree) {\n // create an irreducible generator polynomial\n this.degree = degree\n this.genPoly = Polynomial.generateECPolynomial(this.degree)\n}\n\n/**\n * Encodes a chunk of data\n *\n * @param {Uint8Array} data Buffer containing input data\n * @return {Uint8Array} Buffer containing encoded data\n */\nReedSolomonEncoder.prototype.encode = function encode (data) {\n if (!this.genPoly) {\n throw new Error('Encoder not initialized')\n }\n\n // Calculate EC for this data block\n // extends data size to data+genPoly size\n const paddedData = new Uint8Array(data.length + this.degree)\n paddedData.set(data)\n\n // The error correction codewords are the remainder after dividing the data codewords\n // by a generator polynomial\n const remainder = Polynomial.mod(paddedData, this.genPoly)\n\n // return EC data blocks (last n byte, where n is the degree of genPoly)\n // If coefficients number in remainder are less than genPoly degree,\n // pad with 0s to the left to reach the needed number of coefficients\n const start = this.degree - remainder.length\n if (start > 0) {\n const buff = new Uint8Array(this.degree)\n buff.set(remainder, start)\n\n return buff\n }\n\n return remainder\n}\n\nmodule.exports = ReedSolomonEncoder\n"],"names":["Polynomial","require$$0","ReedSolomonEncoder","degree","data","paddedData","remainder","start","buff","reedSolomonEncoder"],"mappings":";;;;;AAAA,QAAMA,IAAaC,EAAA;AAEnB,WAASC,EAAoBC,GAAQ;AACnC,SAAK,UAAU,QACf,KAAK,SAASA,GAEV,KAAK,UAAQ,KAAK,WAAW,KAAK,MAAM;AAAA,EAC9C;AAQA,SAAAD,EAAmB,UAAU,aAAa,SAAqBC,GAAQ;AAErE,SAAK,SAASA,GACd,KAAK,UAAUH,EAAW,qBAAqB,KAAK,MAAM;AAAA,EAC5D,GAQAE,EAAmB,UAAU,SAAS,SAAiBE,GAAM;AAC3D,QAAI,CAAC,KAAK;AACR,YAAM,IAAI,MAAM,yBAAyB;AAK3C,UAAMC,IAAa,IAAI,WAAWD,EAAK,SAAS,KAAK,MAAM;AAC3D,IAAAC,EAAW,IAAID,CAAI;AAInB,UAAME,IAAYN,EAAW,IAAIK,GAAY,KAAK,OAAO,GAKnDE,IAAQ,KAAK,SAASD,EAAU;AACtC,QAAIC,IAAQ,GAAG;AACb,YAAMC,IAAO,IAAI,WAAW,KAAK,MAAM;AACvC,aAAAA,EAAK,IAAIF,GAAWC,CAAK,GAElBC;AAAA,IACX;AAEE,WAAOF;AAAA,EACT,GAEAG,IAAiBP;;","x_google_ignoreList":[0]}
|
package/dist/index121.js
CHANGED
|
@@ -1,11 +1,76 @@
|
|
|
1
|
-
import { __exports as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { __exports as f } from "./index136.js";
|
|
2
|
+
import { __require as M } from "./index112.js";
|
|
3
|
+
import { __require as w } from "./index119.js";
|
|
4
|
+
import { __require as D } from "./index113.js";
|
|
5
|
+
import { __require as p } from "./index123.js";
|
|
6
|
+
import { __require as y } from "./index137.js";
|
|
7
|
+
var B;
|
|
8
|
+
function H() {
|
|
9
|
+
return B ? f : (B = 1, (function(i) {
|
|
10
|
+
const u = M(), m = w(), l = D(), n = p(), a = y(), d = 7973, g = u.getBCHDigit(d);
|
|
11
|
+
function E(o, e, r) {
|
|
12
|
+
for (let t = 1; t <= 40; t++)
|
|
13
|
+
if (e <= i.getCapacity(t, r, o))
|
|
14
|
+
return t;
|
|
15
|
+
}
|
|
16
|
+
function C(o, e) {
|
|
17
|
+
return n.getCharCountIndicator(o, e) + 4;
|
|
18
|
+
}
|
|
19
|
+
function _(o, e) {
|
|
20
|
+
let r = 0;
|
|
21
|
+
return o.forEach(function(t) {
|
|
22
|
+
const s = C(t.mode, e);
|
|
23
|
+
r += s + t.getBitsLength();
|
|
24
|
+
}), r;
|
|
25
|
+
}
|
|
26
|
+
function q(o, e) {
|
|
27
|
+
for (let r = 1; r <= 40; r++)
|
|
28
|
+
if (_(o, r) <= i.getCapacity(r, e, n.MIXED))
|
|
29
|
+
return r;
|
|
30
|
+
}
|
|
31
|
+
i.from = function(e, r) {
|
|
32
|
+
return a.isValid(e) ? parseInt(e, 10) : r;
|
|
33
|
+
}, i.getCapacity = function(e, r, t) {
|
|
34
|
+
if (!a.isValid(e))
|
|
35
|
+
throw new Error("Invalid QR Code version");
|
|
36
|
+
typeof t > "u" && (t = n.BYTE);
|
|
37
|
+
const s = u.getSymbolTotalCodewords(e), V = m.getTotalCodewordsCount(e, r), h = (s - V) * 8;
|
|
38
|
+
if (t === n.MIXED) return h;
|
|
39
|
+
const c = h - C(t, e);
|
|
40
|
+
switch (t) {
|
|
41
|
+
case n.NUMERIC:
|
|
42
|
+
return Math.floor(c / 10 * 3);
|
|
43
|
+
case n.ALPHANUMERIC:
|
|
44
|
+
return Math.floor(c / 11 * 2);
|
|
45
|
+
case n.KANJI:
|
|
46
|
+
return Math.floor(c / 13);
|
|
47
|
+
case n.BYTE:
|
|
48
|
+
default:
|
|
49
|
+
return Math.floor(c / 8);
|
|
50
|
+
}
|
|
51
|
+
}, i.getBestVersionForData = function(e, r) {
|
|
52
|
+
let t;
|
|
53
|
+
const s = l.from(r, l.M);
|
|
54
|
+
if (Array.isArray(e)) {
|
|
55
|
+
if (e.length > 1)
|
|
56
|
+
return q(e, s);
|
|
57
|
+
if (e.length === 0)
|
|
58
|
+
return 1;
|
|
59
|
+
t = e[0];
|
|
60
|
+
} else
|
|
61
|
+
t = e;
|
|
62
|
+
return E(t.mode, t.getLength(), s);
|
|
63
|
+
}, i.getEncodedBits = function(e) {
|
|
64
|
+
if (!a.isValid(e) || e < 7)
|
|
65
|
+
throw new Error("Invalid QR Code version");
|
|
66
|
+
let r = e << 12;
|
|
67
|
+
for (; u.getBCHDigit(r) - g >= 0; )
|
|
68
|
+
r ^= d << u.getBCHDigit(r) - g;
|
|
69
|
+
return e << 12 | r;
|
|
70
|
+
};
|
|
71
|
+
})(f), f);
|
|
7
72
|
}
|
|
8
73
|
export {
|
|
9
|
-
|
|
74
|
+
H as __require
|
|
10
75
|
};
|
|
11
76
|
//# sourceMappingURL=index121.js.map
|
package/dist/index121.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index121.js","sources":["../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version
|
|
1
|
+
{"version":3,"file":"index121.js","sources":["../../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version.js"],"sourcesContent":["const Utils = require('./utils')\nconst ECCode = require('./error-correction-code')\nconst ECLevel = require('./error-correction-level')\nconst Mode = require('./mode')\nconst VersionCheck = require('./version-check')\n\n// Generator polynomial used to encode version information\nconst G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0)\nconst G18_BCH = Utils.getBCHDigit(G18)\n\nfunction getBestVersionForDataLength (mode, length, errorCorrectionLevel) {\n for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {\n if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {\n return currentVersion\n }\n }\n\n return undefined\n}\n\nfunction getReservedBitsCount (mode, version) {\n // Character count indicator + mode indicator bits\n return Mode.getCharCountIndicator(mode, version) + 4\n}\n\nfunction getTotalBitsFromDataArray (segments, version) {\n let totalBits = 0\n\n segments.forEach(function (data) {\n const reservedBits = getReservedBitsCount(data.mode, version)\n totalBits += reservedBits + data.getBitsLength()\n })\n\n return totalBits\n}\n\nfunction getBestVersionForMixedData (segments, errorCorrectionLevel) {\n for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {\n const length = getTotalBitsFromDataArray(segments, currentVersion)\n if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {\n return currentVersion\n }\n }\n\n return undefined\n}\n\n/**\n * Returns version number from a value.\n * If value is not a valid version, returns defaultValue\n *\n * @param {Number|String} value QR Code version\n * @param {Number} defaultValue Fallback value\n * @return {Number} QR Code version number\n */\nexports.from = function from (value, defaultValue) {\n if (VersionCheck.isValid(value)) {\n return parseInt(value, 10)\n }\n\n return defaultValue\n}\n\n/**\n * Returns how much data can be stored with the specified QR code version\n * and error correction level\n *\n * @param {Number} version QR Code version (1-40)\n * @param {Number} errorCorrectionLevel Error correction level\n * @param {Mode} mode Data mode\n * @return {Number} Quantity of storable data\n */\nexports.getCapacity = function getCapacity (version, errorCorrectionLevel, mode) {\n if (!VersionCheck.isValid(version)) {\n throw new Error('Invalid QR Code version')\n }\n\n // Use Byte mode as default\n if (typeof mode === 'undefined') mode = Mode.BYTE\n\n // Total codewords for this QR code version (Data + Error correction)\n const totalCodewords = Utils.getSymbolTotalCodewords(version)\n\n // Total number of error correction codewords\n const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)\n\n // Total number of data codewords\n const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8\n\n if (mode === Mode.MIXED) return dataTotalCodewordsBits\n\n const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version)\n\n // Return max number of storable codewords\n switch (mode) {\n case Mode.NUMERIC:\n return Math.floor((usableBits / 10) * 3)\n\n case Mode.ALPHANUMERIC:\n return Math.floor((usableBits / 11) * 2)\n\n case Mode.KANJI:\n return Math.floor(usableBits / 13)\n\n case Mode.BYTE:\n default:\n return Math.floor(usableBits / 8)\n }\n}\n\n/**\n * Returns the minimum version needed to contain the amount of data\n *\n * @param {Segment} data Segment of data\n * @param {Number} [errorCorrectionLevel=H] Error correction level\n * @param {Mode} mode Data mode\n * @return {Number} QR Code version\n */\nexports.getBestVersionForData = function getBestVersionForData (data, errorCorrectionLevel) {\n let seg\n\n const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M)\n\n if (Array.isArray(data)) {\n if (data.length > 1) {\n return getBestVersionForMixedData(data, ecl)\n }\n\n if (data.length === 0) {\n return 1\n }\n\n seg = data[0]\n } else {\n seg = data\n }\n\n return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl)\n}\n\n/**\n * Returns version information with relative error correction bits\n *\n * The version information is included in QR Code symbols of version 7 or larger.\n * It consists of an 18-bit sequence containing 6 data bits,\n * with 12 error correction bits calculated using the (18, 6) Golay code.\n *\n * @param {Number} version QR Code version\n * @return {Number} Encoded version info bits\n */\nexports.getEncodedBits = function getEncodedBits (version) {\n if (!VersionCheck.isValid(version) || version < 7) {\n throw new Error('Invalid QR Code version')\n }\n\n let d = version << 12\n\n while (Utils.getBCHDigit(d) - G18_BCH >= 0) {\n d ^= (G18 << (Utils.getBCHDigit(d) - G18_BCH))\n }\n\n return (version << 12) | d\n}\n"],"names":["Utils","require$$0","ECCode","require$$1","ECLevel","require$$2","Mode","require$$3","VersionCheck","require$$4","G18","G18_BCH","getBestVersionForDataLength","mode","length","errorCorrectionLevel","currentVersion","exports","getReservedBitsCount","version","getTotalBitsFromDataArray","segments","totalBits","data","reservedBits","getBestVersionForMixedData","value","defaultValue","totalCodewords","ecTotalCodewords","dataTotalCodewordsBits","usableBits","seg","ecl","d"],"mappings":";;;;;;;;;AAAA,UAAMA,IAAQC,EAAA,GACRC,IAASC,EAAA,GACTC,IAAUC,EAAA,GACVC,IAAOC,EAAA,GACPC,IAAeC,EAAA,GAGfC,IAAO,MACPC,IAAUX,EAAM,YAAYU,CAAG;AAErC,aAASE,EAA6BC,GAAMC,GAAQC,GAAsB;AACxE,eAASC,IAAiB,GAAGA,KAAkB,IAAIA;AACjD,YAAIF,KAAUG,EAAQ,YAAYD,GAAgBD,GAAsBF,CAAI;AAC1E,iBAAOG;AAAA,IAKb;AAEA,aAASE,EAAsBL,GAAMM,GAAS;AAE5C,aAAOb,EAAK,sBAAsBO,GAAMM,CAAO,IAAI;AAAA,IACrD;AAEA,aAASC,EAA2BC,GAAUF,GAAS;AACrD,UAAIG,IAAY;AAEhB,aAAAD,EAAS,QAAQ,SAAUE,GAAM;AAC/B,cAAMC,IAAeN,EAAqBK,EAAK,MAAMJ,CAAO;AAC5D,QAAAG,KAAaE,IAAeD,EAAK,cAAa;AAAA,MAClD,CAAG,GAEMD;AAAA,IACT;AAEA,aAASG,EAA4BJ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