apphx 2.0.0 → 2.1.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.
Files changed (51) hide show
  1. package/README.md +11 -9
  2. package/dist/cli.js +41 -11
  3. package/dist/cli.js.map +1 -1
  4. package/dist/config.js +4 -2
  5. package/dist/config.js.map +1 -1
  6. package/dist/integrations.js +177 -91
  7. package/dist/integrations.js.map +1 -1
  8. package/dist/notify.js +267 -0
  9. package/dist/notify.js.map +1 -0
  10. package/dist/policy.js +3 -16
  11. package/dist/policy.js.map +1 -1
  12. package/dist/runner.js +119 -20
  13. package/dist/runner.js.map +1 -1
  14. package/dist/schemas.js +57 -2
  15. package/dist/schemas.js.map +1 -1
  16. package/dist/vendor/obfuscator/dist/config.js +119 -6
  17. package/dist/vendor/obfuscator/dist/config.js.map +1 -1
  18. package/dist/vendor/obfuscator/dist/dfa.js +528 -0
  19. package/dist/vendor/obfuscator/dist/dfa.js.map +1 -0
  20. package/dist/vendor/obfuscator/dist/flutter.js +3266 -0
  21. package/dist/vendor/obfuscator/dist/flutter.js.map +1 -0
  22. package/dist/vendor/obfuscator/dist/image-utils.js +335 -0
  23. package/dist/vendor/obfuscator/dist/image-utils.js.map +1 -0
  24. package/dist/vendor/obfuscator/dist/junk.js +1501 -0
  25. package/dist/vendor/obfuscator/dist/junk.js.map +1 -0
  26. package/dist/vendor/obfuscator/dist/lexicon-data.js +972 -0
  27. package/dist/vendor/obfuscator/dist/lexicon-data.js.map +1 -0
  28. package/dist/vendor/obfuscator/dist/obfuscate.js +51 -2
  29. package/dist/vendor/obfuscator/dist/obfuscate.js.map +1 -1
  30. package/dist/vendor/obfuscator/dist/objc-symbols.js +1819 -0
  31. package/dist/vendor/obfuscator/dist/objc-symbols.js.map +1 -0
  32. package/dist/vendor/obfuscator/dist/project-identity.js +852 -0
  33. package/dist/vendor/obfuscator/dist/project-identity.js.map +1 -0
  34. package/dist/vendor/obfuscator/dist/string-encrypt.js +330 -0
  35. package/dist/vendor/obfuscator/dist/string-encrypt.js.map +1 -0
  36. package/examples/android-java.factory.json +40 -5
  37. package/examples/expo.factory.json +68 -5
  38. package/examples/flutter.factory.json +40 -4
  39. package/examples/luggage.json +1 -0
  40. package/examples/multi-role-agents.md +129 -0
  41. package/examples/mygo.factory.json +54 -4
  42. package/examples/queue-loop-demo.md +146 -0
  43. package/examples/react-native.factory.json +58 -5
  44. package/examples/roles.example.json +31 -0
  45. package/examples/swift.factory.json +60 -5
  46. package/examples/uni-app.factory.json +58 -5
  47. package/package.json +1 -1
  48. package/skills/apphx/SKILL.md +39 -4
  49. package/skills/apphx/resources/requirement.json +1 -0
  50. package/skills/apphx-obfuscator/LICENSE +21 -0
  51. package/skills/apphx-obfuscator/SKILL.md +72 -0
@@ -0,0 +1,1819 @@
1
+ import { deriveHash, extension, seededRandom, writeIfChanged } from "./common.js";
2
+ import { readFileSync } from "node:fs";
3
+ // src/objc-symbols.ts
4
+ /**
5
+ * Deterministic Objective-C & Swift symbol renamer. Qt GUI, SQLite, networking,
6
+ * licensing and nltk/wordnet lookups are dropped. All randomness flows through
7
+ * the seeded PRNG in common.js, so a given seed always produces the same output.
8
+ */
9
+ const LEXICON = [
10
+ "application",
11
+ "architecture",
12
+ "argument",
13
+ "array",
14
+ "arrow",
15
+ "assembly",
16
+ "assign",
17
+ "assignment",
18
+ "associated",
19
+ "associative",
20
+ "atomic",
21
+ "attribute",
22
+ "audio",
23
+ "background",
24
+ "backward",
25
+ "bandwidth",
26
+ "base",
27
+ "batch",
28
+ "benefit",
29
+ "best",
30
+ "binary",
31
+ "binding",
32
+ "bitmap",
33
+ "bitwise",
34
+ "block",
35
+ "boolean",
36
+ "border",
37
+ "breakpoint",
38
+ "build",
39
+ "bus",
40
+ "business",
41
+ "buttons",
42
+ "byte",
43
+ "cache",
44
+ "call",
45
+ "callback",
46
+ "candidate",
47
+ "chain",
48
+ "character",
49
+ "check",
50
+ "checked",
51
+ "child",
52
+ "cleanup",
53
+ "client",
54
+ "clipboard",
55
+ "clone",
56
+ "collection",
57
+ "combo",
58
+ "command",
59
+ "communication",
60
+ "compatible",
61
+ "compile",
62
+ "compiler",
63
+ "component",
64
+ "composition",
65
+ "computer",
66
+ "concept",
67
+ "concrete",
68
+ "concurrent",
69
+ "configuration",
70
+ "connection",
71
+ "constraint",
72
+ "construct",
73
+ "container",
74
+ "containment",
75
+ "context",
76
+ "control",
77
+ "console",
78
+ "const",
79
+ "constant",
80
+ "copy",
81
+ "cover",
82
+ "create",
83
+ "creation",
84
+ "cursor",
85
+ "custom",
86
+ "data",
87
+ "database",
88
+ "datagram",
89
+ "dead",
90
+ "debug",
91
+ "debugger",
92
+ "declaration",
93
+ "deduction",
94
+ "default",
95
+ "defer",
96
+ "define",
97
+ "definition",
98
+ "delegate",
99
+ "delegation",
100
+ "demarshal",
101
+ "dereference",
102
+ "derived",
103
+ "design",
104
+ "destroy",
105
+ "destructor",
106
+ "device",
107
+ "dialog",
108
+ "directive",
109
+ "directory",
110
+ "disk",
111
+ "dispatch",
112
+ "distributed",
113
+ "document",
114
+ "dot",
115
+ "driver",
116
+ "dynamic",
117
+ "efficiency",
118
+ "efficient",
119
+ "end",
120
+ "entity",
121
+ "encapsulation",
122
+ "enclosing",
123
+ "enum",
124
+ "enumerators",
125
+ "equal",
126
+ "equality",
127
+ "equivalence",
128
+ "equivalent",
129
+ "escape",
130
+ "evaluate",
131
+ "event",
132
+ "exception",
133
+ "explicit",
134
+ "export",
135
+ "expression",
136
+ "facility",
137
+ "feature",
138
+ "field",
139
+ "file",
140
+ "firmware",
141
+ "flag",
142
+ "flash",
143
+ "flexibility",
144
+ "flush",
145
+ "font",
146
+ "form",
147
+ "formal",
148
+ "forward",
149
+ "forwarding",
150
+ "fractal",
151
+ "framework",
152
+ "full",
153
+ "function",
154
+ "functionality",
155
+ "functor",
156
+ "game",
157
+ "generate",
158
+ "generic",
159
+ "getter",
160
+ "global",
161
+ "group",
162
+ "guard",
163
+ "gui",
164
+ "hand",
165
+ "handle",
166
+ "handler",
167
+ "hard",
168
+ "hardware",
169
+ "hash",
170
+ "header",
171
+ "heap",
172
+ "hierarchy",
173
+ "hook",
174
+ "hyperlink",
175
+ "icon",
176
+ "ide",
177
+ "identifier",
178
+ "illinois",
179
+ "image",
180
+ "immediate",
181
+ "immutability",
182
+ "immutable",
183
+ "implement",
184
+ "implementation",
185
+ "implicit",
186
+ "import",
187
+ "increment",
188
+ "infinite",
189
+ "information",
190
+ "infrastructure",
191
+ "inheritance",
192
+ "inline",
193
+ "initialization",
194
+ "initialize",
195
+ "inner",
196
+ "instance",
197
+ "instantiated",
198
+ "instantiation",
199
+ "integer",
200
+ "integrate",
201
+ "interacts",
202
+ "interface",
203
+ "for",
204
+ "interpreter",
205
+ "invariants",
206
+ "invoke",
207
+ "iterate",
208
+ "iterative",
209
+ "iterator",
210
+ "iteration",
211
+ "item",
212
+ "laser",
213
+ "level",
214
+ "library",
215
+ "lifetime",
216
+ "link",
217
+ "linker",
218
+ "literal",
219
+ "load",
220
+ "loader",
221
+ "local",
222
+ "lock",
223
+ "loop",
224
+ "lvalue",
225
+ "macro",
226
+ "magic",
227
+ "maintain",
228
+ "manipulator",
229
+ "marshal",
230
+ "mechanism",
231
+ "member",
232
+ "memberwise",
233
+ "memory",
234
+ "menu",
235
+ "message",
236
+ "method",
237
+ "micro",
238
+ "middleware",
239
+ "modeling",
240
+ "modem",
241
+ "module",
242
+ "modifier",
243
+ "most",
244
+ "mouse",
245
+ "mutable",
246
+ "namespace",
247
+ "native",
248
+ "nested",
249
+ "network",
250
+ "object",
251
+ "online",
252
+ "opaque",
253
+ "operand",
254
+ "operating",
255
+ "operation",
256
+ "operator",
257
+ "option",
258
+ "ordinary",
259
+ "overflow",
260
+ "overhead",
261
+ "overload",
262
+ "overloaded",
263
+ "override",
264
+ "package",
265
+ "pair",
266
+ "palette",
267
+ "pane",
268
+ "parallel",
269
+ "parameter",
270
+ "parent",
271
+ "parentheses",
272
+ "parse",
273
+ "part",
274
+ "partial",
275
+ "pass",
276
+ "pattern",
277
+ "performance",
278
+ "persistence",
279
+ "pixel",
280
+ "placement",
281
+ "platform",
282
+ "pointer",
283
+ "poll",
284
+ "polymorphism",
285
+ "pop",
286
+ "port",
287
+ "postfix",
288
+ "precedence",
289
+ "prefix",
290
+ "preprocessor",
291
+ "prime",
292
+ "primitive",
293
+ "print",
294
+ "printer",
295
+ "priority",
296
+ "procedure",
297
+ "procedural",
298
+ "process",
299
+ "profile",
300
+ "profiler",
301
+ "programmer",
302
+ "programming",
303
+ "progress",
304
+ "project",
305
+ "property",
306
+ "protocol",
307
+ "pseudo",
308
+ "qualified",
309
+ "qualifier",
310
+ "quality",
311
+ "queue",
312
+ "radian",
313
+ "radio",
314
+ "raise",
315
+ "random",
316
+ "rank",
317
+ "raw",
318
+ "record",
319
+ "recordset",
320
+ "recursive",
321
+ "refactoring",
322
+ "refer",
323
+ "reference",
324
+ "register",
325
+ "reflection",
326
+ "relational",
327
+ "represent",
328
+ "resolve",
329
+ "resolution",
330
+ "restriction",
331
+ "return",
332
+ "robust",
333
+ "robustness",
334
+ "routine",
335
+ "runtime",
336
+ "common",
337
+ "rvalue",
338
+ "save",
339
+ "schedule",
340
+ "scheduler",
341
+ "scheme",
342
+ "scroll",
343
+ "scope",
344
+ "screen",
345
+ "search",
346
+ "semantics",
347
+ "sequential",
348
+ "server",
349
+ "serial",
350
+ "serialization",
351
+ "setter",
352
+ "signal",
353
+ "signature",
354
+ "slider",
355
+ "slot",
356
+ "smart",
357
+ "snapshot",
358
+ "specialization",
359
+ "specification",
360
+ "splitter",
361
+ "software",
362
+ "solution",
363
+ "source",
364
+ "stack",
365
+ "standard",
366
+ "statement",
367
+ "status",
368
+ "stl",
369
+ "stream",
370
+ "string",
371
+ "subroutine",
372
+ "subscript",
373
+ "subtype",
374
+ "support",
375
+ "suspend",
376
+ "symbol",
377
+ "syntax",
378
+ "tag",
379
+ "target",
380
+ "task",
381
+ "template",
382
+ "temporary",
383
+ "text",
384
+ "thread",
385
+ "throw",
386
+ "token",
387
+ "transaction",
388
+ "traverse",
389
+ "trigger",
390
+ "type",
391
+ "uml",
392
+ "unary",
393
+ "underflow",
394
+ "unchecked",
395
+ "unqualified",
396
+ "unwinding",
397
+ "user",
398
+ "variable",
399
+ "vector",
400
+ "viable",
401
+ "video",
402
+ "view",
403
+ "virtual",
404
+ "volatile",
405
+ "vowel",
406
+ "window",
407
+ "word",
408
+ "wrapper",
409
+ "abstract",
410
+ "abstraction",
411
+ "access",
412
+ "account",
413
+ "action",
414
+ "activate",
415
+ "active",
416
+ "actual",
417
+ "adapter",
418
+ "address",
419
+ "adl",
420
+ "advanced",
421
+ "aggregation",
422
+ "algorithm",
423
+ "alias",
424
+ "align",
425
+ "allocate",
426
+ "angle",
427
+ "annotation",
428
+ "api",
429
+ "app",
430
+ "appearance",
431
+ "append",
432
+ "archive",
433
+ "asynchronous",
434
+ "authentication",
435
+ "authorization",
436
+ "backup",
437
+ "bcl",
438
+ "bookkeeping",
439
+ "bounds",
440
+ "boxing",
441
+ "brace",
442
+ "bracket",
443
+ "browser",
444
+ "bug",
445
+ "through",
446
+ "calendar",
447
+ "cascading",
448
+ "casting",
449
+ "catalog",
450
+ "checkpoint",
451
+ "cil",
452
+ "class",
453
+ "classification",
454
+ "clause",
455
+ "code",
456
+ "cli",
457
+ "cls",
458
+ "coff",
459
+ "com",
460
+ "comment",
461
+ "commit",
462
+ "composite",
463
+ "concurrency",
464
+ "constructor",
465
+ "cookie",
466
+ "corba",
467
+ "crosstab",
468
+ "crtp",
469
+ "cts",
470
+ "cube",
471
+ "dataset",
472
+ "dbms",
473
+ "dcom",
474
+ "deallocate",
475
+ "decay",
476
+ "decision",
477
+ "declarative",
478
+ "dependent",
479
+ "deploy",
480
+ "dhtml",
481
+ "digest",
482
+ "digital",
483
+ "dime",
484
+ "dirty",
485
+ "disassembler",
486
+ "disco",
487
+ "dispid",
488
+ "dna",
489
+ "dom",
490
+ "dtd",
491
+ "dump",
492
+ "eai",
493
+ "ebco",
494
+ "edi",
495
+ "engine",
496
+ "error",
497
+ "exclusive",
498
+ "evidence",
499
+ "exit",
500
+ "fat",
501
+ "fetch",
502
+ "filter",
503
+ "finalization",
504
+ "firewall",
505
+ "finalizer",
506
+ "foreign",
507
+ "fragmentation",
508
+ "gac",
509
+ "genericity"
510
+ ];
511
+ const FILTER_CLASS_NAME_LIST = [
512
+ "TabBarController",
513
+ "AppDelegate",
514
+ "ViewController",
515
+ "UINavigationController",
516
+ "NavigationController",
517
+ "ScriptMessageHandler",
518
+ "CollectionViewFlowLayout",
519
+ "main",
520
+ "CoreBle",
521
+ "Photo",
522
+ "Manager"
523
+ ];
524
+ const FILTER_LIST_A = "enable scale URL supportsTextureSampleCount writeToFile code zoomScale direction videoGravity textLabel anonymous progress failure cancel block time enabled drawRect flashMode newCommandQueueWithMaxCommandBufferCount animateTransition secureTextEntry mediaType fileType device animation value draw commit play pause hide version locale parentController credential affinity listContainerView transitionDuration day context accessoryType detailText identifier object length path array queue beginTime timer configuration notify interval isEqual UUID timeRange createdAt containerSize url parameters player session pickerView row bridge section hidden badgeValue spacing rowHeight systemVersion ScriptMessage toURL quality logout hints uuid apple cache list selectIndex string isSelected fillColor cornerRadius masksToBounds borderColor delay receiver placeholderText timeZone archiveRootObject exponent widthIs heightIs regularExpression sureBtn param isPlaying itemSize inputView filter strokeColor state latitude longitude types attributed suspend inTransaction protocol seekToTime paused loadImage localizable standard webView button label orientation objects resources meta index completion attributedText bounces animationDuration goBack goForward operationType lastPathComponent loopMode animationImages begin LocationManager response config lineSpacing lineHeight customView backgroundView volume MD5 animationRepeatCount exposureMode appID encode lossless sel topItem asset reset manager userInfo top params date components sectionInset actions line borderUIColor selector scheme location request openURL executing finished beginAppearanceTransition origin isRecording totalCount totalCost writer totalSize read beginUpdates String after endIndex reduce schedule refresh convert isFileURL accessibilityLabel combine valueChanged named canEditRowAt insets torchMode cancelled task jpushNotificationCenter layoutMargins evaluateJavaScript dateFromString withString handlers calendar cancelExport selectItem rounded editingStyleForRowAt awakeFromNib alertControllerWithTitle allocWithZone init drawMode sourceType substring dispose unarchiveObjectWithFile preferHDAudio username loopCount union endAppearanceTransition actionWithTitle alert track create resume prepareForReuse dismiss normalColor selectColor repeating fromJSON voiceDetect onSuccess onError reversed cgPath grouped configurations dateFormat beginRefreshing endRefreshing refreshing compare stringFromDate visibleCells video progressBlock rotationAngle isTouchInside CC_DLL isNegative sizing voiceToText beforeSend completed instance pathForResource loadRequest loadHTMLString completionHandler long options color lock unlock format body description streamError query openLog userSig resignFirstResponder valueForHTTPHeaderField FBlock textAlignment memberNumber hangup cityEntity drawableSize texture screen presentsWithTransaction pixelFormat framebufferOnly role isCancelled item toView bundle values placeholderImage targetId tapGesture handler hidesForSinglePage country postNotification right lineHeightMultiple textContainer layoutManager textStorage items phoneNumber thumbnail isAnimating rightView progressView searchBar pageControl segmentedControl resultBlock objectAtIndex highlightedColor md5 synchronize maskView audioDenoise trackTimerStart trackTimerEnd notificationWithName localizedDescription _id playerView highlighted speed md5HashOfData requestAuthorization NobleInfo nobleInfo displayAvailable struct callback newRequest onReceive conversationType userId userID completionBlock openid window navigationController selectRow inDatabase timeInterval autoDeactivateAudioSession decodeForDisplay allowPickingOriginalPhoto muted StatusBarStyle refreshControl editable countLimit region coordinate mediaTypes stringValue thumbImage avatar sort prefersStatusBarHidden dealloc const method createDirectory linkTextAttributes selectable clearsOnInsertion textContainerInset second notification invalidate exit radius opacity readOptions canGoBack canGoForward exportAsynchronouslyWithCompletionHandler animations rect save change makeImage makeNSView makeUIView colorWithRed createDirectoryAtPath panGestureRecognizer gestureRecognizer editing password mode uid weixin_no order_by crc32 completeTransition cost screenX screenY screenViewX screenViewY screenFrame allKeys objc_setAssociatedObject moveItemAtURL constraintForView batteryLevel children push_back objectForKeyedSubscript totalTime close bind connect cocos2d isOn weekday hour minute second objc weixinAuthLoginInContext qqAuthLoginWithDelegate presentDrawable nextDrawable sorted batteryMonitoringEnabled defaultCenter clearCache round fullResolutionImage blue red green now implementationLayer encoding fileName topLeft layer paragraphStyle zero groupId groupID groupid".split(" ");
525
+ const FILTER_LIST_B = "int reason bytes endDate mute one focusMode running sessionPreset timeStamp portraitUri groupName extra labelText weight userName objectName operation topRight displayName nickName gender birthday nickname headerImageView once minSize margin timestamp quitAfterComment commentId starValue resolveStatus sourceUserId transform phoneNumbers clear alpha appendBytes exp phone level_id email write matrix find shake complete notificationWithOperation parse times log sum empty debuggerVacateOpen executeUpdate recordedDuration requestImageWithURL source loadData executeQuery layout managedObjectContext end attributes timeoutInterval cachePolicy attribute baseURL port statusCode arguments lineWidth lineCap timingFunction products whiteBalanceMode kickUsers endUpdates statusBarStyle videoMaximumDuration progressHandler networkAccessAllowed equalTo fail reuseIdentifier priority normalize false true next reverse order loop first frames awake errno std function capacity evutil_socket_geterror leading trailing custom property xml trigger locations continuous emotionOriginalURL connection magic sectionTitles background emotionType inView emotionOriginalURL sampleRate category translation price isValid headerReferenceSize footerReferenceSize ext backgroundImage city subject province searchDisplayController appKey host failureBlock cls pageIndex pageNum horizontal isHidden weak coverImage networkActivityIndicatorVisible launchOptions event info leading price experience leftMargin rightMargin topMargin leadingMargin trailingMargin strong where alias login edges menuRightMargin triangleY triangleRightMargin triangleSize otherMargin beginMargin endMargin for seq subtitle openId sign stack isSuccess buttonWithType scene Double metrics copyWithZone endEditing defaultManager selectItemAtIndexPath encodeWithCoder authorizationStatus product loadingView invite_code resourceLoader exportSessionWithAsset final mask distance subscriber deselectItemAtIndexPath dictionaryRepresentation pagingEnabled team_scale compressQuality netStatus Finish platform faceView tableView Array readData rotated copyItem decelerationRate isLoading accessoryView language baseline superview selectionStyle successBlock hidesBottomBarWhenPushed lineJoin colors endPoint indicatorColor parentVC propertyName socks5Type page accessoryData fromType result scheduleRule comment customizedId menu inputAccessoryView privilege containerView backSpaceButtonImage intrinsicContentSize accessibilityValue mAveragePower mPeakPower badge msg DelayTime categories lineColor isFirstResponder becomeFirstResponder constraint inset downloadImageWithURL isWXAppSupport scaleToSize colorWithHexString Clear resetOffsetFromCenter popActivity bounds responseSerializer acceptableContentTypes requestSerializer strokeEnd lineBreakMode vertical hudType customImage indicatorBackGroundColor acceptableStatusCodes readingOptions automaticallyInflatesResponseImage videoPath cancelAllOperations appendData dictionary model icon user photo controlView rate bezierPath clearMemory arrayWithArray streamStatus limit post AssetsManagerEx undoManager scheduledTimerWithTimeInterval attributeText fillWithData suspended operations serverTrust fromValue toValue inviterAccid cacheKeyForURL socks5Addr nextObject sorted stretch value_type keyPath system area resourcePath decode failed unsigned operator revents events auto listen shutdown map Quaternion override AffineTransform Rect totalUnitCount nibWithNibName topAnchor activityItems process datePickerMode datePicker alignmentMode detailsLabel administrativeArea locality thoroughfare subLocality horizontalEdgeLength enablesReturnKeyAutomatically JSONObjectWithData async isDirectory adSize render uint BytesSize serializer subThoroughfare callStatus groupMemberDataSource videoView dateInterval daterRange transactions fetchRequest audioMix videoComposition reader posterImage propertyType blueColor EVP_CIPHER buffer myself multiplier BN_ULONG switch disconnect cachedResponseForRequest JSONString jsonString FFTSetup Sticker pauseRecord willRotateToInterfaceOrientation GetSize collection localIdentifier socket tree searchTextField camera audioMuted backItem isEditing parent videoOrientation endTime lastInsertRowId names active isOriginal handleOpenURL handleOpenUniversalLink openWXApp toDate isExist _block textValue rectOfInterest metadataObjectTypes hideHUDForView ins nib beautyLevel totleTime invalidateLayout clearDiskOnCompletion willAnimateRotationToInterfaceOrientation navigationBarHidden navigationBar repeats dragging statusBarHidden beautyLevel ruddinessLevel isReceived lineViewWithFrame unreadCount outputImage placeholderColor videoAsset videoResolution decompress m_frictionIndex lineView timeLabel avatarView expirationTimeInGMTFormat onNewMessage conversationData onlineUserOnly inviter clockwise convData hCenter vCenter listView listScrollView pagerView fetchOne applyTransform reachabilityStatusChangeBlock targetSize provider objectId columnNumber presetName isRunning frameCount outputURL URLCache creationDate videoSettings outputSettings attributedTitle atIndex fromView inSection diskCache isVisible pixelWidth pixelHeight md5String columnExists xmlChar prefix noMoreData frameOfPresentedViewInContainerView truncationToken releaseToRefresh refreshSuccess refreshFailure myNetworkLoggerPlugin".split(" ");
526
+ const FILTER_LIST = [...FILTER_LIST_A, ...FILTER_LIST_B];
527
+ const FILTER_MUST_IGNORE_METHOD_AND_PROPERTY_LIST = "select realloc const swap move pop sqrtf Free operator Init Key Vec2 reserve retain release erase append fastSet resize continue uLong uInt Bytef intValue floatValue step detach value Value Point point interactive replace edge intValue uncompress push rewind strcasecmp eof flush main back rotation npos Type resize random arc4random pointer reference Position position timeval mData self epsilon uLongf itemWidth pointSize snapshot acceleration fixed abort args base iconv_close force isAnalog isPressed _Nonnull Nonnull valueOptions interface isKindOfClass BackgroundColor backgroundColor effect infoDictionary foregroundColor extent statusBarFrame error key applyLayoutAttributes record fireDate headers cancelButtonTitle methodSignature returnValue dynamic superclass userContentController frame float and front double const doubleValue free copy from open leftView year month height width padding familyName itemForTag text textColor duration count type success title class name keyboardType borderWidth target tag left offset placeholder status alignment action delegate style lessThanOrEqualTo Group nil model leftBarButtonItem rightBarButtonItem assign extension constant opaque nextResponder statusBarOrientation navigationItem safeAreaInsets option userInterfaceStyle attributedPlaceholder physicalMemory transitionCoordinator translucent colorSpace givenName Height Width anchorPoint id ID switcher disableActions traitCollection nativeScale repeatCount resourceValue range BOOL bool load mix flags className tabBarItem tabBar tabBarController tabBarItemsAttributes __nullable Nullable _Nullable null _Nonnull fontSize fontName font SEL touchesBegan touchesEnded titleColor titleView titleLabel titleSelectedColor titles titleForState titleTextAttributes titlePositionAdjustment titleShadowColor TitleColor titleEdgeInsets titleFont keyword keyWords addSubview layoutSubviews subviews destination keyboardAppearance keyWindow domain observeValueForKeyPath snapshotView blockOperationWithBlock colorSpace contentOffset document firstResponder brightness isTracking cornerRadii statusBarManager playCommand pauseCommand cameraFlashMode cameraDevice prefix suffix href node properties childViewControllers owner windowScene dateComponents done subscription blur newValue cgImage layerClass sampleData container footerView headerView plugins break longValue appearance available restarted enabledConsoleLog sockaddr isExecuting isFinished pathExtension conditions convertPoint convertRect seekToOffset readDataOfLength writeData signal broadcast allHeaderFields exporter runsForEachTargetApplicationUIConfiguration stroke UTF8String stringFromNumber required default enum weekOfYear weekOfMonth weekdayOrdinal itemSpacing with lineFragmentPadding marker if_data rawValue identity keys distribution documentDirectory isEnabled compressionQuality isEmpty ciImage Data deviceMotionUpdateInterval pixelBuffer machine matches contains last actionSheet defaults oldValue searchController bytesPerRow mediaBox superlayer connections devices level ports enumerator lensPosition deviceWhiteBalanceGains activeFormat high autoFocus results mtlDevice commandBuffer targetContentOffset velocity canBecomeFirstResponder minimumValue autoscroll pitch gravity roll isHighlighted baseAddress animate supportedInterfaceOrientations shouldAutorotate preview queryItems isReady isAsynchronous targetFrame oldValue span intersection cachesDirectory undoManager hexString service uuidString scaleX jsonObject errCode absoluteString before appendString windows listener desc dict isReachable diskCapacity securityPolicy firstWeekday component identifierForVendor gestureRecognizerShouldBegin".split(" ");
528
+ const FILTER_MUST_IGNORE_METHOD_LIST = "viewDidLoad viewWillDisappear viewWillAppear layoutSubviews viewDidLayoutSubviews forwardInvocation scrollViewDidScroll awakeFromNib willMoveToSuperview drawTextInRect drawRect dealloc load layerClass performBatchUpdates md5String columnExists writeData debugDescription".split(" ");
529
+ function pyCapitalize(s) {
530
+ if (s.length === 0) return s;
531
+ return s[0].toUpperCase() + s.slice(1).toLowerCase();
532
+ }
533
+ function pyTitle(s) {
534
+ return pyCapitalize(s);
535
+ }
536
+ function upperFirst(s) {
537
+ if (s.length === 0) return s;
538
+ return s[0].toUpperCase() + s.slice(1);
539
+ }
540
+ function pyIsTitle(s) {
541
+ if (s.length === 0) return false;
542
+ if (!(s[0] >= "A" && s[0] <= "Z")) return false;
543
+ for (let i = 1; i < s.length; i += 1) if (s[i] >= "A" && s[i] <= "Z") return false;
544
+ return true;
545
+ }
546
+ function pyIsUpper(s) {
547
+ return s.length > 0 && /^[A-Z]+$/.test(s);
548
+ }
549
+ function pyIsDigit(s) {
550
+ return s.length > 0 && /^[0-9]+$/.test(s);
551
+ }
552
+ function createRng(seed) {
553
+ const random = seededRandom(deriveHash(seed, "objc-symbols"));
554
+ return {
555
+ next: random,
556
+ randInt(min, max) {
557
+ return min + Math.floor(random() * (max - min + 1));
558
+ },
559
+ choice(values) {
560
+ return values[Math.floor(random() * values.length)];
561
+ }
562
+ };
563
+ }
564
+ function createRenameContext(options = {}, seed) {
565
+ return {
566
+ options,
567
+ seed,
568
+ rng: createRng(seed),
569
+ methodMap: /* @__PURE__ */ new Map(),
570
+ propertyMap: /* @__PURE__ */ new Map(),
571
+ classMap: /* @__PURE__ */ new Map(),
572
+ temporaryPropertyNames: /* @__PURE__ */ new Set(),
573
+ allMissClassNames: /* @__PURE__ */ new Set(),
574
+ projectNames: []
575
+ };
576
+ }
577
+ const ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
578
+ function randomStringNoNumber(num, ctx) {
579
+ let salt = "";
580
+ for (let i = 0; i < num; i += 1) salt += ALPHA[ctx.rng.randInt(0, 51)];
581
+ return salt;
582
+ }
583
+ function randomWordFromLexicon(ctx) {
584
+ let word = ctx.rng.choice(LEXICON);
585
+ word = word.replace(/\n/g, "");
586
+ if (word === "virtual") word = "virtualObj";
587
+ word = word.replace(/ /g, "").replace(/"/g, "");
588
+ if (word.length === 0) word = "word";
589
+ return word;
590
+ }
591
+ function isContainChinese(text) {
592
+ for (const ch of text) if (ch >= "一" && ch <= "鿿") return true;
593
+ return false;
594
+ }
595
+ const PINYIN = {
596
+ 一: "Yi",
597
+ 二: "Er",
598
+ 三: "San",
599
+ 四: "Si",
600
+ 五: "Wu",
601
+ 六: "Liu",
602
+ 七: "Qi",
603
+ 八: "Ba",
604
+ 九: "Jiu",
605
+ 十: "Shi",
606
+ 中: "Zhong",
607
+ 文: "Wen",
608
+ 上: "Shang",
609
+ 下: "Xia",
610
+ 大: "Da",
611
+ 小: "Xiao",
612
+ 左: "Zuo",
613
+ 右: "You",
614
+ 前: "Qian",
615
+ 后: "Hou",
616
+ 登: "Deng",
617
+ 录: "Lu",
618
+ 注: "Zhu",
619
+ 册: "Ce",
620
+ 用: "Yong",
621
+ 户: "Hu",
622
+ 名: "Ming",
623
+ 密: "Mi",
624
+ 码: "Ma",
625
+ 视: "Shi",
626
+ 图: "Tu",
627
+ 本: "Ben",
628
+ 按: "An",
629
+ 钮: "Niu",
630
+ 页: "Ye",
631
+ 面: "Mian",
632
+ 数: "Shu",
633
+ 据: "Ju",
634
+ 字: "Zi"
635
+ };
636
+ function chineseToPinyin(chineseWord) {
637
+ let out = "";
638
+ for (const ch of chineseWord) out += PINYIN[ch] ?? ch;
639
+ return out;
640
+ }
641
+ function isNumberString(text) {
642
+ return /[0-9]+/.test(text);
643
+ }
644
+ function isIgnoreAnalysisLine(line) {
645
+ const stripped = line.trim();
646
+ if (line.length === 0 || stripped.length === 0) return true;
647
+ if (stripped.startsWith("#") && !stripped.startsWith("#define")) return true;
648
+ if (stripped.startsWith("//")) return true;
649
+ if (stripped.startsWith("/*")) return true;
650
+ return false;
651
+ }
652
+ function isXibOrSb(filePath) {
653
+ return filePath.endsWith(".xib") || filePath.endsWith(".storyboard");
654
+ }
655
+ function isHaveSpecialChar(text) {
656
+ for (const ch of "~!@#$%^&*()+-*/<>,.[]\\/") if (text.includes(ch)) return true;
657
+ return false;
658
+ }
659
+ const METHOD_STARTS = [
660
+ "RSA_",
661
+ "_ossl_",
662
+ "frame",
663
+ "mas_",
664
+ "mj_",
665
+ "sd_",
666
+ "yy_",
667
+ "bk_",
668
+ "allows",
669
+ "number",
670
+ "cell",
671
+ "is",
672
+ "data",
673
+ "reload",
674
+ "min",
675
+ "max",
676
+ "separator",
677
+ "file",
678
+ "tableView",
679
+ "scrollView",
680
+ "application",
681
+ "dequeue",
682
+ "heightFor",
683
+ "cameraView",
684
+ "transfor",
685
+ "has",
686
+ "scrollTo",
687
+ "insert",
688
+ "animated",
689
+ "center",
690
+ "bottom",
691
+ "indexPath",
692
+ "message",
693
+ "collectionView",
694
+ "newQuadricyc",
695
+ "show",
696
+ "view",
697
+ "shadow",
698
+ "selected",
699
+ "timeout",
700
+ "didReceive",
701
+ "tintColor",
702
+ "textView",
703
+ "textField",
704
+ "timeInterval",
705
+ "table",
706
+ "scroll",
707
+ "image",
708
+ "shareTo",
709
+ "preferred",
710
+ "start",
711
+ "stop",
712
+ "add",
713
+ "layoutAttributesFor",
714
+ "dispatch_",
715
+ "tap",
716
+ "keyboard",
717
+ "async",
718
+ "chatToolBar",
719
+ "formatted",
720
+ "remove",
721
+ "register",
722
+ "share",
723
+ "send",
724
+ "Send",
725
+ "delete",
726
+ "addRightBarButtonItem",
727
+ "onTM",
728
+ "onDisconnect",
729
+ "stringWith",
730
+ "prepareTo",
731
+ "downloadTask",
732
+ "uploadTask",
733
+ "current",
734
+ "constraints",
735
+ "activityIndicator",
736
+ "estimated",
737
+ "content",
738
+ "size",
739
+ "Size",
740
+ "nib",
741
+ "Unity",
742
+ "il2cpp_",
743
+ "pthread_",
744
+ "inet_",
745
+ "onTouch",
746
+ "loadTexture",
747
+ "bufferevent_",
748
+ "evbuffer_",
749
+ "event_",
750
+ "evutil_",
751
+ "evthread_",
752
+ "update",
753
+ "xml",
754
+ "enumerateKeysAnd",
755
+ "fetchAlbum",
756
+ "delegate",
757
+ "CGImage",
758
+ "build",
759
+ "get",
760
+ "set",
761
+ "did"
762
+ ];
763
+ const METHOD_ENDS = [
764
+ "TintColor",
765
+ "ForKey",
766
+ "Texture",
767
+ "ViewController",
768
+ "ViewControllerAnimated",
769
+ "SpaceToView",
770
+ "EqualToView",
771
+ "RatioToView",
772
+ "OfUID"
773
+ ];
774
+ const METHOD_EXACT = /* @__PURE__ */ new Set([
775
+ "_free",
776
+ "free",
777
+ "_setFree",
778
+ "setFree",
779
+ "_malloc",
780
+ "malloc",
781
+ "_setMalloc",
782
+ "setMalloc",
783
+ "_setDebugMalloc",
784
+ "setDebugMalloc",
785
+ "set",
786
+ "Set"
787
+ ]);
788
+ const METHOD_CONTAINS = [
789
+ ")",
790
+ "(",
791
+ "#",
792
+ ",",
793
+ "*",
794
+ " ",
795
+ "/"
796
+ ];
797
+ function isPassMethodName(funName, isSwift) {
798
+ if (funName.length <= 4) return true;
799
+ if (FILTER_LIST.includes(funName)) return true;
800
+ if (FILTER_MUST_IGNORE_METHOD_AND_PROPERTY_LIST.includes(funName)) return true;
801
+ if (funName.startsWith("init")) return true;
802
+ if (funName.startsWith("set") && !isSwift && !funName.startsWith("setting")) return true;
803
+ if (funName.startsWith("get") && !isSwift) return true;
804
+ if (funName.startsWith("color") && funName.length <= 11) return true;
805
+ if (METHOD_CONTAINS.some((c) => funName.includes(c))) return true;
806
+ if (pyIsUpper(funName)) return true;
807
+ if (funName.startsWith("save") && funName.endsWith("Value")) return true;
808
+ if (METHOD_STARTS.some((p) => funName.startsWith(p))) return true;
809
+ if (METHOD_ENDS.some((s) => funName.endsWith(s))) return true;
810
+ if (METHOD_EXACT.has(funName)) return true;
811
+ if (isContainChinese(funName)) return true;
812
+ return false;
813
+ }
814
+ function isHaveMethodName(line) {
815
+ const lineNew = line.replace(/ /g, "");
816
+ const eq = line.indexOf("=");
817
+ const bracket = line.indexOf("(");
818
+ if (bracket > eq && eq !== -1 && bracket !== -1) return false;
819
+ if (!line.includes("(") && !line.includes(")")) return false;
820
+ if (lineNew.startsWith("+(")) return true;
821
+ if (lineNew.startsWith("-(")) return true;
822
+ if (line.startsWith("void ")) return true;
823
+ if (line.startsWith("short ")) return true;
824
+ if (line.startsWith("int ")) return true;
825
+ if (line.startsWith("long ")) return true;
826
+ if (line.startsWith("float ")) return true;
827
+ if (line.startsWith("double ")) return true;
828
+ if (line.startsWith("char ")) return true;
829
+ if (line.startsWith("bool ")) return true;
830
+ if (line.startsWith("BOOL ")) return true;
831
+ return false;
832
+ }
833
+ function colonIsInBrackets(line) {
834
+ let count = 0;
835
+ for (const ch of line) {
836
+ if (ch === "(") count += 1;
837
+ else if (ch === ")") count -= 1;
838
+ if (ch === ":" && count !== 0) return true;
839
+ }
840
+ return false;
841
+ }
842
+ function methodNameListInLine(line) {
843
+ const funList = [];
844
+ if (line.includes("^") && !line.includes(":")) {
845
+ funList.push(line.split(")").at(-1).replace(/;/g, "").replace(/ /g, "").replace(/\n/g, ""));
846
+ return funList;
847
+ }
848
+ if (line.startsWith("void ")) {
849
+ funList.push(line.slice(line.indexOf("void ") + 5, line.indexOf("(")).replace(/ /g, "").replace(/\n/g, ""));
850
+ return funList;
851
+ }
852
+ if (line.startsWith("int ")) {
853
+ funList.push(line.slice(line.indexOf("int ") + 4, line.indexOf("(")).replace(/ /g, "").replace(/\n/g, ""));
854
+ return funList;
855
+ }
856
+ line = line.replace(/\+/g, "").replace(/-/g, "").replace(/\+ /g, "").replace(/- /g, "").trim();
857
+ line = line.replace(/ :\(/g, ":(");
858
+ if (line.includes(":") && !colonIsInBrackets(line)) {
859
+ for (let item of line.split(" ")) if (item.includes(":")) {
860
+ item = item.split(":")[0];
861
+ item = item.slice(item.indexOf(")") + 1);
862
+ if (item.length > 0) funList.push(item);
863
+ }
864
+ if (funList.length === 1) {
865
+ funList[0] = `${funList[0]}:`;
866
+ return funList;
867
+ }
868
+ return funList;
869
+ }
870
+ const index = line.indexOf(")") + 1;
871
+ const semi = line.indexOf(";");
872
+ let funName = line.slice(index, semi === -1 ? void 0 : semi);
873
+ if (funName.length === 0) {
874
+ line = line.slice(0, line.indexOf("("));
875
+ funName = line.split(/\s+/).at(-1).trim();
876
+ }
877
+ funList.push(funName);
878
+ return funList;
879
+ }
880
+ function createMissMethodName(funName, ctx) {
881
+ const parts = funName.replace(/[A-Z]/g, (m) => `_${m}`).split("_").filter((item) => item.length > 2);
882
+ const lastFunName = parts.length > 0 ? ctx.rng.choice(parts) : pyTitle(randomWordFromLexicon(ctx));
883
+ let miss = randomWordFromLexicon(ctx) + pyCapitalize(randomWordFromLexicon(ctx)) + pyTitle(lastFunName);
884
+ if (funName.startsWith("_")) miss = `_${miss}`;
885
+ return miss;
886
+ }
887
+ function getMissMethodNameWithOriginalName(methodName, methodPrefix, ctx) {
888
+ const prefix = methodPrefix ?? "";
889
+ let miss;
890
+ if (prefix.length > 0 && prefix.endsWith("#")) miss = `${prefix.split("#")[0]}${methodName}`;
891
+ else if (ctx.options.algorithmType === 0) miss = createMissMethodName(methodName, ctx);
892
+ else if (ctx.options.algorithmType === 1) miss = randomWordByEnchant(methodName, ctx);
893
+ else if (ctx.options.algorithmType === 3) miss = randomStringNoNumber(methodName.length * 2, ctx);
894
+ else miss = createMissMethodName(methodName, ctx);
895
+ if (prefix.length > 0) miss = prefix.endsWith("_") ? `${prefix}${miss}` : `${prefix}${upperFirst(miss)}`;
896
+ const suffix = ctx.options.methodSuffix ?? "";
897
+ if (suffix.length > 0) miss = `${miss}${suffix}`;
898
+ return miss;
899
+ }
900
+ function getMissMethodNameTuple(line, methodPrefix, ctx) {
901
+ const lineNew = line.replace(/\n/g, "").replace(/: \(/g, ":(").replace(/\*\) /g, "*)").trimStart();
902
+ if (!isHaveMethodName(lineNew)) return null;
903
+ const funList = methodNameListInLine(lineNew);
904
+ if (funList.length === 0) return null;
905
+ let funName = funList[0].trim();
906
+ if (funName.includes(":")) funName = funName.split(":")[0].trim();
907
+ if (isPassMethodName(funName, false)) return null;
908
+ const cached = ctx.methodMap.get(funName);
909
+ if (cached !== void 0) return [funName, cached];
910
+ const repName = getMissMethodNameWithOriginalName(funName, methodPrefix, ctx).replace(/\s+/g, "");
911
+ ctx.methodMap.set(funName, repName);
912
+ return [funName, repName];
913
+ }
914
+ function replaceMethodNameInLine(line, funName, missFunName, isXib) {
915
+ const markCode2 = "{Z-F-J}";
916
+ const markCode3 = "$Z-F-J$";
917
+ if (line.includes(`*${funName} `)) line = line.replaceAll(`*${funName} `, `*${missFunName} `);
918
+ if (line.includes(`"${funName}"`)) line = line.replaceAll(`"${funName}"`, markCode2);
919
+ if (line.includes(`"${funName}.h"`)) line = line.replaceAll(`"${funName}.h"`, markCode3);
920
+ const c1 = "$MISSFUNCNAME=1$";
921
+ const r1 = `${funName}://`;
922
+ if (line.includes(r1)) line = line.replaceAll(r1, c1);
923
+ const c2 = "$MISSFUNCNAME=2$";
924
+ const r2 = `${funName}/`;
925
+ if (line.includes(r2)) line = line.replaceAll(r2, c2);
926
+ const c3 = "$MISSFUNCNAME=3$";
927
+ const r3 = `/${funName}`;
928
+ if (line.includes(r3)) line = line.replaceAll(r3, c3);
929
+ const c4 = "$MISSFUNCNAME=4$";
930
+ const r4 = `<${funName}>`;
931
+ if (line.includes(r4) && isXib) line = line.replaceAll(r4, c4);
932
+ let result = line.replace(/\b\w+\b/g, (token) => token === funName ? missFunName : token);
933
+ if (line.includes(`_${funName}`)) result = result.replace(/\b\w+\b/g, (token) => token === `_${funName}` ? `_${missFunName}` : token);
934
+ if (result.includes(markCode2)) result = result.replaceAll(markCode2, `"${funName}"`);
935
+ if (result.includes(markCode3)) result = result.replaceAll(markCode3, `"${funName}.h"`);
936
+ if (result.includes(c1)) result = result.replaceAll(c1, r1);
937
+ if (result.includes(c2)) result = result.replaceAll(c2, r2);
938
+ if (result.includes(c3)) result = result.replaceAll(c3, r3);
939
+ if (result.includes(c4)) result = result.replaceAll(c4, r4);
940
+ return result;
941
+ }
942
+ const KEY_WORD_PASS = /* @__PURE__ */ new Set([
943
+ "manager",
944
+ "model",
945
+ "view",
946
+ "cell",
947
+ "controller",
948
+ "root",
949
+ "event",
950
+ "header",
951
+ "is",
952
+ "set",
953
+ "base",
954
+ "with",
955
+ "index",
956
+ "table",
957
+ "api",
958
+ "string",
959
+ "data",
960
+ "error",
961
+ "block",
962
+ "button",
963
+ "time",
964
+ "array",
965
+ "dictionary",
966
+ "key",
967
+ "color",
968
+ "mutable",
969
+ "date",
970
+ "picker",
971
+ "image",
972
+ "integer",
973
+ "int",
974
+ "collection",
975
+ "title",
976
+ "label"
977
+ ]);
978
+ const ARABIC_NUMERALS_MAP = {
979
+ "1": "one",
980
+ "2": "two",
981
+ "3": "three",
982
+ "4": "four",
983
+ "5": "five",
984
+ "6": "six",
985
+ "7": "seven",
986
+ "8": "eight",
987
+ "9": "nine",
988
+ "0": "zero"
989
+ };
990
+ function judgeTitleIsCapitalize(word, list) {
991
+ if (list.length === 0) return;
992
+ const first = list[0];
993
+ list[0] = /[a-z]/.test(word[0] ?? "") ? first.toLowerCase() : pyCapitalize(first);
994
+ }
995
+ function randomWordByEnchant(word, ctx) {
996
+ let w = word.includes("-") ? word.replace(/-/g, "_") : word;
997
+ let newWord = "";
998
+ for (let i = 0; i < w.length; i += 1) {
999
+ const ch = w[i];
1000
+ if (ch >= "0" && ch <= "9") {
1001
+ const name = ARABIC_NUMERALS_MAP[ch];
1002
+ newWord += i === 0 ? name : pyCapitalize(name);
1003
+ } else newWord += ch;
1004
+ }
1005
+ if (isContainChinese(w)) for (const item of w.match(/[一-鿿]+/g) ?? []) newWord = newWord.replace(item, chineseToPinyin(item));
1006
+ w = newWord;
1007
+ let wordList;
1008
+ if (w.includes("_")) {
1009
+ const parts = w.split("_");
1010
+ const out = [];
1011
+ parts.forEach((part, idx) => {
1012
+ out.push(...part.match(/[a-zA-Z][^A-Z]*/g) ?? []);
1013
+ if (idx !== parts.length - 1) out.push("_");
1014
+ });
1015
+ wordList = out;
1016
+ } else wordList = w.match(/[a-zA-Z][^A-Z]*/g) ?? [];
1017
+ if (wordList.length === 0) return w;
1018
+ const newWordList = [];
1019
+ for (const item of wordList) {
1020
+ if (item === "_") {
1021
+ newWordList.push(item);
1022
+ continue;
1023
+ }
1024
+ if (KEY_WORD_PASS.has(item.toLowerCase()) || /[0-9]/.test(item)) {
1025
+ newWordList.push(item);
1026
+ continue;
1027
+ }
1028
+ const randomWord = randomWordFromLexicon(ctx);
1029
+ newWordList.push(pyIsTitle(item) ? pyCapitalize(randomWord) : randomWord.toLowerCase());
1030
+ }
1031
+ judgeTitleIsCapitalize(w, newWordList);
1032
+ let returnWord = newWordList.join("");
1033
+ if (w === returnWord) {
1034
+ const idx = ctx.rng.randInt(0, newWordList.length - 1);
1035
+ if (idx === 0) {
1036
+ newWordList[0] = pyTitle(newWordList[0]);
1037
+ newWordList.splice(idx, 0, randomWordFromLexicon(ctx));
1038
+ } else newWordList.splice(idx, 0, pyTitle(randomWordFromLexicon(ctx)));
1039
+ judgeTitleIsCapitalize(w, newWordList);
1040
+ returnWord = newWordList.join("");
1041
+ }
1042
+ if (returnWord.length <= 3) returnWord += pyTitle(randomWordFromLexicon(ctx));
1043
+ if (w.endsWith("_")) return `${returnWord}_`;
1044
+ return returnWord;
1045
+ }
1046
+ const PROPERTY_STARTS = [
1047
+ "CG",
1048
+ "preferred",
1049
+ "UI",
1050
+ "NS",
1051
+ "AV",
1052
+ "CF",
1053
+ "HTTP",
1054
+ "mas_",
1055
+ "mj_",
1056
+ "sd_",
1057
+ "yy_",
1058
+ "allows",
1059
+ "start",
1060
+ "stop",
1061
+ "add",
1062
+ "layoutAttributesFor",
1063
+ "number",
1064
+ "cell",
1065
+ "data",
1066
+ "init",
1067
+ "weak",
1068
+ "reload",
1069
+ "min",
1070
+ "max",
1071
+ "separator",
1072
+ "file",
1073
+ "tableView",
1074
+ "scrollView",
1075
+ "set",
1076
+ "get",
1077
+ "application",
1078
+ "dequeue",
1079
+ "heightFor",
1080
+ "cameraView",
1081
+ "transfor",
1082
+ "has",
1083
+ "scrollTo",
1084
+ "insert",
1085
+ "animated",
1086
+ "center",
1087
+ "bottom",
1088
+ "indexPath",
1089
+ "message",
1090
+ "collectionView",
1091
+ "show",
1092
+ "view",
1093
+ "shadow",
1094
+ "selected",
1095
+ "timeout",
1096
+ "didReceive",
1097
+ "tintColor",
1098
+ "timeInterval",
1099
+ "textView",
1100
+ "textField",
1101
+ "table",
1102
+ "scroll",
1103
+ "image",
1104
+ "kCGImage",
1105
+ "update",
1106
+ "_t",
1107
+ "_value",
1108
+ "tv_",
1109
+ "GL",
1110
+ "offset",
1111
+ "bool",
1112
+ "asset",
1113
+ "ritl_",
1114
+ "AFNetworking",
1115
+ "SDWebImage",
1116
+ "task",
1117
+ "build",
1118
+ "get",
1119
+ "set",
1120
+ "did",
1121
+ "WX",
1122
+ "GIF_",
1123
+ "Audio",
1124
+ "DDLog",
1125
+ "shareTo",
1126
+ "dispatch_",
1127
+ "tap",
1128
+ "keyboard",
1129
+ "async",
1130
+ "chatToolBar",
1131
+ "formatted",
1132
+ "remove",
1133
+ "register",
1134
+ "share",
1135
+ "send",
1136
+ "delete",
1137
+ "addRightBarButtonItem",
1138
+ "onTM",
1139
+ "onDisconnect",
1140
+ "stringWith",
1141
+ "prepareTo",
1142
+ "downloadTask",
1143
+ "uploadTask",
1144
+ "current",
1145
+ "constraints",
1146
+ "activityIndicator",
1147
+ "estimated",
1148
+ "content",
1149
+ "size",
1150
+ "Size",
1151
+ "nib",
1152
+ "markedText",
1153
+ "lua_get"
1154
+ ];
1155
+ const PROPERTY_ENDS = [
1156
+ "TintColor",
1157
+ "ForKey",
1158
+ "_func",
1159
+ "ViewController",
1160
+ "ViewControllerAnimated",
1161
+ "SpaceToView",
1162
+ "EqualToView",
1163
+ "RatioToView",
1164
+ "OfUID",
1165
+ "StatusBarStyle",
1166
+ "StatusBarHidden"
1167
+ ];
1168
+ const PROPERTY_EXACT = /* @__PURE__ */ new Set([
1169
+ "release",
1170
+ "return",
1171
+ "ignored",
1172
+ "_nullable",
1173
+ "int",
1174
+ "str",
1175
+ "the",
1176
+ "cmd",
1177
+ "void",
1178
+ "val",
1179
+ "field",
1180
+ "token",
1181
+ "token_",
1182
+ "_token",
1183
+ "SEL",
1184
+ "sel"
1185
+ ]);
1186
+ const PROPERTY_CONTAINS = [
1187
+ "Delegate",
1188
+ "delegate",
1189
+ " ",
1190
+ ":",
1191
+ "]",
1192
+ "(",
1193
+ ")"
1194
+ ];
1195
+ function isPassPropertyName(propertyName, propertyEndsWithNum = false) {
1196
+ if (propertyName.length === 0 || propertyName.length <= 3) return true;
1197
+ if (FILTER_LIST.includes(propertyName)) return true;
1198
+ if (FILTER_MUST_IGNORE_METHOD_AND_PROPERTY_LIST.includes(propertyName)) return true;
1199
+ if (isNumberString(propertyName) && propertyEndsWithNum) return true;
1200
+ if (PROPERTY_EXACT.has(propertyName)) return true;
1201
+ if (propertyName.startsWith("AL") && pyIsTitle(propertyName[0]) && pyIsTitle(propertyName[1])) return true;
1202
+ if (propertyName.startsWith("save") && propertyName.endsWith("Value")) return true;
1203
+ if (propertyName.startsWith("bt") && !pyIsTitle(propertyName[2] ?? "")) return true;
1204
+ if (propertyName.startsWith("ai_") && !pyIsTitle(propertyName[3] ?? "")) return true;
1205
+ if (pyIsUpper(propertyName)) return true;
1206
+ if (pyIsDigit(propertyName)) return true;
1207
+ if (PROPERTY_STARTS.some((p) => propertyName.startsWith(p))) return true;
1208
+ if (PROPERTY_ENDS.some((s) => propertyName.endsWith(s))) return true;
1209
+ if (PROPERTY_CONTAINS.some((c) => propertyName.includes(c))) return true;
1210
+ return false;
1211
+ }
1212
+ const STRING_PUNCTUATION = /* @__PURE__ */ new Set("!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~");
1213
+ function getSetProName(propertyName) {
1214
+ return `set${propertyName.slice(0, 1).toUpperCase()}${propertyName.slice(1)}`;
1215
+ }
1216
+ function createMissPropertyNameWithOriginalPropertyName(propertyName, ctx, isAddWord = false) {
1217
+ const parts = propertyName.replace(/[A-Z]/g, (m) => `_${m}`).split("_").filter((item) => item.length > 2);
1218
+ const lastPropertyName = parts.length > 0 ? parts.at(-1) : pyTitle(randomWordFromLexicon(ctx));
1219
+ let miss;
1220
+ if (parts.length > 0) miss = randomWordFromLexicon(ctx) + pyTitle(lastPropertyName);
1221
+ else if (propertyName.length <= 5) miss = randomWordFromLexicon(ctx) + pyCapitalize(propertyName);
1222
+ else miss = randomWordFromLexicon(ctx) + pyCapitalize(propertyName.slice(0, Math.floor(propertyName.length / 2)));
1223
+ if (isAddWord) miss = randomWordFromLexicon(ctx) + miss;
1224
+ return miss;
1225
+ }
1226
+ function getMissPropertyNameAndAddTemporaryList(propertyName, ctx) {
1227
+ let miss;
1228
+ if (ctx.options.algorithmType === 3) miss = randomStringNoNumber(propertyName.length * 2, ctx);
1229
+ else {
1230
+ miss = createMissPropertyNameWithOriginalPropertyName(propertyName, ctx);
1231
+ if (miss === "Array") miss = randomWordFromLexicon(ctx) + miss;
1232
+ }
1233
+ if (propertyName.startsWith("_")) miss = `_${miss}`;
1234
+ if (ctx.temporaryPropertyNames.has(miss)) return null;
1235
+ ctx.temporaryPropertyNames.add(miss);
1236
+ return miss;
1237
+ }
1238
+ function getOcMissPropertyNameTub(propertyName, propertyPrefix, ctx) {
1239
+ const prefix = propertyPrefix ?? "";
1240
+ if (prefix.length > 0 && prefix.endsWith("#")) return `${prefix.split("#")[0]}${propertyName}`;
1241
+ const miss = ctx.options.algorithmType === 1 ? randomWordByEnchant(propertyName, ctx) : getMissPropertyNameAndAddTemporaryList(propertyName, ctx) ?? randomWordByEnchant(propertyName, ctx);
1242
+ if (prefix.length > 0) return prefix.endsWith("_") ? `${prefix}${miss}` : `${prefix}${upperFirst(miss)}`;
1243
+ return miss;
1244
+ }
1245
+ function getSwiftMissPropertyNameTub(propertyName, propertyPrefix, ctx) {
1246
+ const prefix = propertyPrefix ?? "";
1247
+ let miss = randomWordFromLexicon(ctx);
1248
+ if (prefix.length > 0 && prefix.endsWith("#")) miss = `${prefix.split("#")[0]}${propertyName}`;
1249
+ else if (prefix.length > 0) {
1250
+ const base = ctx.options.algorithmType === 1 ? randomWordByEnchant(propertyName, ctx) : getMissPropertyNameAndAddTemporaryList(propertyName, ctx) ?? randomWordByEnchant(propertyName, ctx);
1251
+ miss = prefix.endsWith("_") ? `${prefix}${base}` : `${prefix}${upperFirst(base)}`;
1252
+ } else miss = ctx.options.algorithmType === 1 ? randomWordByEnchant(propertyName, ctx) : getMissPropertyNameAndAddTemporaryList(propertyName, ctx) ?? randomWordByEnchant(propertyName, ctx);
1253
+ if (propertyName.startsWith("_")) miss = `_${miss}`;
1254
+ return miss;
1255
+ }
1256
+ function resolvePropertyMissName(propertyName, propertyPrefix, ctx, isSwift) {
1257
+ const cached = ctx.propertyMap.get(propertyName);
1258
+ if (cached !== void 0) return cached;
1259
+ let miss = isSwift ? getSwiftMissPropertyNameTub(propertyName, propertyPrefix, ctx) : getOcMissPropertyNameTub(propertyName, propertyPrefix, ctx);
1260
+ if (new Set(ctx.propertyMap.values()).has(miss)) miss += pyTitle(randomWordFromLexicon(ctx));
1261
+ if (FILTER_LIST.includes(miss)) miss += pyTitle(randomWordFromLexicon(ctx));
1262
+ if (FILTER_MUST_IGNORE_METHOD_AND_PROPERTY_LIST.includes(propertyName)) miss += pyTitle(randomWordFromLexicon(ctx));
1263
+ ctx.propertyMap.set(propertyName, miss);
1264
+ return miss;
1265
+ }
1266
+ function ocPropertyNameTup(line, propertyPrefix, ctx) {
1267
+ if (isIgnoreAnalysisLine(line)) return null;
1268
+ let work = line;
1269
+ if (work.includes("*")) work = work.replace(/\*/g, " * ");
1270
+ if (work.includes(" ")) work = work.replace(/\t/g, " ");
1271
+ if (work.includes("\n")) work = work.replace(/\n/g, " ");
1272
+ let propertyName = null;
1273
+ if (work.includes("(^")) {
1274
+ const compact = work.split(/\s+/).join("");
1275
+ propertyName = compact.slice(compact.indexOf("(^") + 2, compact.indexOf(")("));
1276
+ } else {
1277
+ let lineNew = work.split(";")[0];
1278
+ lineNew = lineNew.replace(/<.*?>/g, " ").replace(/@property /g, "");
1279
+ const lineListNew = lineNew.split(" ").reverse().filter((x) => x.length > 0);
1280
+ const starIndex = lineListNew.indexOf("*");
1281
+ if (starIndex !== -1) propertyName = lineListNew[starIndex - 1] ?? null;
1282
+ else for (const item of lineListNew) if (!pyIsUpper(item) && ![...item].some((ch) => STRING_PUNCTUATION.has(ch))) {
1283
+ propertyName = item;
1284
+ break;
1285
+ }
1286
+ }
1287
+ if (propertyName == null) return null;
1288
+ propertyName = propertyName.split(" ").join("");
1289
+ if (propertyName.startsWith("*")) propertyName = propertyName.slice(1);
1290
+ if (propertyName.startsWith("_")) propertyName = propertyName.slice(1);
1291
+ if (propertyName.endsWith(";") || propertyName.endsWith(",")) propertyName = propertyName.slice(0, -1);
1292
+ if (isPassPropertyName(propertyName)) return null;
1293
+ const miss = resolvePropertyMissName(propertyName, propertyPrefix, ctx, false);
1294
+ return miss === null ? null : [propertyName, miss];
1295
+ }
1296
+ function ocConstantNameTup(line, propertyPrefix, ctx) {
1297
+ if (isIgnoreAnalysisLine(line)) return null;
1298
+ const work = line.replace(/\*/g, " ").replace(/\n/g, "");
1299
+ let propertyName = null;
1300
+ for (const item of work.split(" ")) if (item.includes(";")) {
1301
+ propertyName = item.split(";")[0];
1302
+ break;
1303
+ }
1304
+ if (propertyName == null) return null;
1305
+ propertyName = propertyName.split(" ").join("");
1306
+ if (propertyName.startsWith("*")) propertyName = propertyName.slice(1);
1307
+ if (propertyName.startsWith("_")) propertyName = propertyName.slice(1);
1308
+ if (propertyName.endsWith(";") || propertyName.endsWith(",")) propertyName = propertyName.slice(0, -1);
1309
+ if (isPassPropertyName(propertyName)) return null;
1310
+ const miss = resolvePropertyMissName(propertyName, propertyPrefix, ctx, false);
1311
+ return miss === null ? null : [propertyName, miss];
1312
+ }
1313
+ function swiftCppPropertyNameTup(line, propertyPrefix, _isCCFile, ctx) {
1314
+ if (isIgnoreAnalysisLine(line)) return null;
1315
+ let lineNew = line.replace(/\[.*?\]/g, " ");
1316
+ if (lineNew.includes("//")) lineNew = lineNew.slice(0, lineNew.indexOf("//"));
1317
+ lineNew = lineNew.replace(/\/.*?\*\//g, "");
1318
+ lineNew = lineNew.replace(/;/g, " ").replace(/\t/g, " ").replace(/\n/g, " ").trim();
1319
+ if (lineNew.includes("::")) return null;
1320
+ if (lineNew.length === 0) return null;
1321
+ if (lineNew.startsWith("@NSManaged ")) return null;
1322
+ let propertyName = null;
1323
+ if (lineNew.includes("var ") && lineNew.includes(":") && !lineNew.includes("=")) propertyName = lineNew.slice(lineNew.indexOf("var ") + 4, lineNew.indexOf(":"));
1324
+ else if (lineNew.includes("var ") && lineNew.includes("=")) propertyName = lineNew.slice(lineNew.indexOf("var ") + 4, lineNew.indexOf("="));
1325
+ else if (lineNew.includes("let ") && lineNew.includes(":") && !lineNew.includes("=")) propertyName = lineNew.slice(lineNew.indexOf("let ") + 4, lineNew.indexOf(":"));
1326
+ else if (lineNew.includes("let ") && lineNew.includes("=")) propertyName = lineNew.slice(lineNew.indexOf("let ") + 4, lineNew.indexOf("="));
1327
+ if (propertyName == null) {
1328
+ const lineNoWrap = line.trim();
1329
+ if (line.includes(" *") && line.includes("(") && line.includes(")")) propertyName = line.slice(line.indexOf("*") + 1, line.indexOf("(")).split(" ")[0] ?? null;
1330
+ else if (line.includes(" *") && (lineNoWrap.endsWith(";") || lineNoWrap.endsWith(","))) {
1331
+ for (const item of lineNew.split(" ")) if (item.includes("*")) {
1332
+ propertyName = item.replace(/\*/g, "");
1333
+ break;
1334
+ }
1335
+ } else {
1336
+ const basic = [
1337
+ "short",
1338
+ "int",
1339
+ "long",
1340
+ "float",
1341
+ "double",
1342
+ "char",
1343
+ "bool",
1344
+ "int64_t",
1345
+ "const",
1346
+ "BOOL"
1347
+ ];
1348
+ const lineListNew = lineNew.split(" ");
1349
+ const intersection = basic.filter((v) => lineListNew.includes(v));
1350
+ const eqIndex = lineListNew.includes("=") ? lineListNew.indexOf("=") : -1;
1351
+ if (eqIndex !== -1) propertyName = lineListNew[eqIndex - 1] ?? null;
1352
+ else if (intersection.length === 1) {
1353
+ const start = lineListNew.indexOf(intersection[0]) + 1;
1354
+ for (let i = start; i < lineListNew.length; i += 1) {
1355
+ propertyName = lineListNew[i];
1356
+ if (propertyName === "unichar") propertyName = "";
1357
+ if (propertyName.length > 0) break;
1358
+ }
1359
+ }
1360
+ }
1361
+ }
1362
+ if (propertyName == null) return null;
1363
+ propertyName = propertyName.trim();
1364
+ propertyName = propertyName.split(" ").join("");
1365
+ if (propertyName.includes(":")) propertyName = propertyName.split(":")[0];
1366
+ if (propertyName.startsWith("*")) propertyName = propertyName.slice(1);
1367
+ if (propertyName.startsWith("_")) propertyName = propertyName.slice(1);
1368
+ if (propertyName.endsWith(";") || propertyName.endsWith(",")) propertyName = propertyName.slice(0, -1);
1369
+ if (isPassPropertyName(propertyName)) return null;
1370
+ if ([...propertyName].some((ch) => STRING_PUNCTUATION.has(ch))) return null;
1371
+ const miss = resolvePropertyMissName(propertyName, propertyPrefix, ctx, true);
1372
+ return miss === null ? null : [propertyName, miss];
1373
+ }
1374
+ function maskQuotedStrings(line) {
1375
+ const store = [];
1376
+ let idx = 0;
1377
+ line = line.replace(/"([^"]*)"/g, (_full, content) => {
1378
+ const token = `\u0000Q${idx++}\u0000`;
1379
+ store.push(content);
1380
+ return `"${token}"`;
1381
+ });
1382
+ return {
1383
+ line,
1384
+ restore(s) {
1385
+ return s.replace(/"\u0000Q(\d+)\u0000"/g, (_f, n) => `"${store[Number(n)]}"`);
1386
+ }
1387
+ };
1388
+ }
1389
+ function replacePropertyNameInLine(line, propertyName, missPropertyName, isSwift, isXib, isWithinQuotationMarks) {
1390
+ if (isIgnoreAnalysisLine(line)) return line;
1391
+ const masked = maskQuotedStrings(line);
1392
+ line = masked.line;
1393
+ if (isSwift && line.includes(`(${propertyName})`)) line = line.replaceAll(`(${propertyName})`, `(${missPropertyName})`);
1394
+ const setProp = `set${propertyName.slice(0, 1).toUpperCase()}${propertyName.slice(1)}`;
1395
+ const missSetProp = `set${missPropertyName.slice(0, 1).toUpperCase()}${missPropertyName.slice(1)}`;
1396
+ if (line.includes(setProp)) line = line.replaceAll(setProp, missSetProp);
1397
+ line = line.replace(/\b\w+\b/g, (token) => {
1398
+ if (token === propertyName) return missPropertyName;
1399
+ if (token === `_${propertyName}`) return `_${missPropertyName}`;
1400
+ if (token === `${propertyName}Set`) return `${missPropertyName}Set`;
1401
+ return token;
1402
+ });
1403
+ return masked.restore(line);
1404
+ }
1405
+ const OBJECT_NAME_PASS_LIST = [
1406
+ "Config",
1407
+ "text",
1408
+ "lock",
1409
+ "debug",
1410
+ "Base",
1411
+ "Version",
1412
+ "main",
1413
+ "Codable",
1414
+ "version",
1415
+ "thread",
1416
+ "cocos2d",
1417
+ "system",
1418
+ "titleView",
1419
+ "RootViewController",
1420
+ "TabBarController",
1421
+ "Decodable",
1422
+ "Request",
1423
+ "WebCache",
1424
+ "YYAdd"
1425
+ ];
1426
+ function isPassObjectName(objectName, ctx) {
1427
+ if (FILTER_CLASS_NAME_LIST.includes(objectName)) return true;
1428
+ if (objectName.includes("AppDelegate")) return true;
1429
+ if (objectName.length <= 4) return true;
1430
+ if (objectName.startsWith("MEIQIA_")) return true;
1431
+ if (objectName.startsWith("UMCSDK")) return true;
1432
+ if (objectName.startsWith("OSS")) return true;
1433
+ if (objectName.startsWith("GTT")) return true;
1434
+ if (objectName.startsWith("_")) return true;
1435
+ if (objectName.startsWith("x86")) return true;
1436
+ if (objectName.startsWith("x64")) return true;
1437
+ if (objectName.startsWith("win32_")) return true;
1438
+ if (objectName.startsWith("UI")) return true;
1439
+ if (objectName.startsWith("NS")) return true;
1440
+ if (objectName.startsWith("Agora")) return true;
1441
+ if (objectName.startsWith("MJRefresh")) return true;
1442
+ if (objectName.includes("-")) return true;
1443
+ if (OBJECT_NAME_PASS_LIST.includes(objectName)) return true;
1444
+ if (ctx.projectNames.includes(objectName)) return true;
1445
+ if (ctx.classMap.has(objectName)) return true;
1446
+ if (isContainChinese(objectName)) return true;
1447
+ return false;
1448
+ }
1449
+ function getMissObjName(oldObjName, ctx) {
1450
+ if (oldObjName.includes("+")) oldObjName = oldObjName.split("+").at(-1);
1451
+ let parts = oldObjName.replace(/[A-Z]/g, (m) => `_${m}`).split("_").filter((item) => item.length > 2);
1452
+ if (parts.length > 2) parts = parts.slice(-2);
1453
+ if (parts.length <= 2) parts.unshift(pyTitle(randomWordFromLexicon(ctx)));
1454
+ parts.unshift(pyTitle(randomWordFromLexicon(ctx)));
1455
+ return parts.join("");
1456
+ }
1457
+ function getMissClassName(className, classPrefix, ctx) {
1458
+ if (className.length === 0) return className;
1459
+ const prefix = classPrefix ?? "";
1460
+ let miss;
1461
+ if (prefix.length > 0 && prefix.endsWith("#")) miss = `${prefix.split("#")[0]}${className.includes("+") ? className.split("+").at(-1) : className}`;
1462
+ else if (ctx.options.algorithmType === 0) miss = getMissObjName(className, ctx).replace(/new/g, "OBF");
1463
+ else if (ctx.options.algorithmType === 1) miss = randomWordByEnchant(className, ctx);
1464
+ else if (ctx.options.algorithmType === 3) miss = randomStringNoNumber(className.length, ctx);
1465
+ else miss = `${prefix}${getMissObjName(className, ctx).replace(/new/g, "OBF")}`;
1466
+ if (miss.length > 0) miss = /[a-z]/.test(className[0]) ? miss[0].toLowerCase() + miss.slice(1) : upperFirst(miss);
1467
+ if (prefix.length > 0 && prefix.endsWith("_")) miss = `${prefix}${miss}`;
1468
+ else if (prefix.length > 0 && !prefix.endsWith("#")) miss = `${prefix}${upperFirst(miss)}`;
1469
+ if (ctx.allMissClassNames.has(miss)) return `${miss}${pyTitle(randomWordFromLexicon(ctx))}`;
1470
+ ctx.allMissClassNames.add(miss);
1471
+ return miss;
1472
+ }
1473
+ function replaceObjNameByReInLine(line, objectName, missObjectName) {
1474
+ let result = line.replace(/\b\w+\b/g, (token) => token === objectName ? missObjectName : token);
1475
+ const sharedName = `shared${objectName}`;
1476
+ if (result.includes(sharedName)) result = result.replace(/\b\w+\b/g, (token) => token === sharedName ? `shared${missObjectName}` : token);
1477
+ if (result.includes(`"${objectName}.`)) result = result.replaceAll(`"${objectName}.`, `"${missObjectName}.`);
1478
+ return result;
1479
+ }
1480
+ function collectMethodPrefixTuple(line, oldPrefix, newPrefix, ctx) {
1481
+ const lineNew = line.replace(/\n/g, "").replace(/: \(/g, ":(").replace(/\*\) /g, "*)").trimStart();
1482
+ if (!isHaveMethodName(lineNew)) return null;
1483
+ const funList = methodNameListInLine(lineNew);
1484
+ if (funList.length === 0) return null;
1485
+ let methodName = funList[0].trim();
1486
+ if (methodName.includes(":")) methodName = methodName.split(":")[0].trim();
1487
+ if (!methodName.startsWith(oldPrefix)) return null;
1488
+ if (isPassMethodName(methodName, false) || methodName.startsWith("newQuadricyc")) return null;
1489
+ const replace = `${newPrefix}${methodName.slice(oldPrefix.length)}`;
1490
+ ctx.methodMap.set(methodName, replace);
1491
+ return [methodName, replace];
1492
+ }
1493
+ function propertyNameReplaceTuple(line, oldPrefix, newPrefix) {
1494
+ const trimmed = line.replace(/\n/g, "").trim();
1495
+ const work = trimmed.slice(0, trimmed.indexOf(";") === -1 ? void 0 : trimmed.indexOf(";")).replace(/\* /g, "*");
1496
+ let propertyName = null;
1497
+ const compact = work.split(/\s+/).join("");
1498
+ if (compact.includes("(^")) propertyName = compact.slice(compact.indexOf("(^") + 2, compact.indexOf(")("));
1499
+ else {
1500
+ const tail = work.split(")").at(-1).trim();
1501
+ let list;
1502
+ if (tail.includes(" ")) list = tail.split(" ");
1503
+ else if (!tail.includes(" ") && work.includes("*")) list = tail.split("*");
1504
+ else list = [];
1505
+ if (list.length < 2) return null;
1506
+ const starItem = list.find((item) => item.includes("*"));
1507
+ propertyName = starItem == null ? list[1].replace(/\*/g, "") : starItem.slice(starItem.indexOf("*") + 1);
1508
+ }
1509
+ if (propertyName.includes(">")) propertyName = propertyName.slice(propertyName.indexOf(">") + 1);
1510
+ propertyName = propertyName.replace(/\*/g, "");
1511
+ if (!propertyName.startsWith(oldPrefix)) return null;
1512
+ if (isNumberString(propertyName)) return null;
1513
+ if (isPassPropertyName(propertyName)) return null;
1514
+ if ([...propertyName].some((ch) => STRING_PUNCTUATION.has(ch))) return null;
1515
+ return [propertyName, `${newPrefix}${propertyName.slice(oldPrefix.length)}`];
1516
+ }
1517
+ const OC_VIEW_LIST = [
1518
+ "UIView",
1519
+ "UILabel",
1520
+ "UIButton",
1521
+ "UISegmentedControl",
1522
+ "UITextField",
1523
+ "UISlider",
1524
+ "UISwitch",
1525
+ "UIProgressView",
1526
+ "UITableView",
1527
+ "UITableViewCell",
1528
+ "UIImageView",
1529
+ "UICollectionView",
1530
+ "UICollectionViewCell",
1531
+ "UITextView",
1532
+ "UIScrollView",
1533
+ "UIPickerView"
1534
+ ];
1535
+ function getSpaceCount(line) {
1536
+ let count = 0;
1537
+ for (const ch of line) if (ch === " ") count += 1;
1538
+ else break;
1539
+ return count;
1540
+ }
1541
+ function getClassProNameTub(line, isSwift) {
1542
+ const newLine = line.replace(/\s+/g, "");
1543
+ let ret = null;
1544
+ for (const className of OC_VIEW_LIST) if (!isSwift) {
1545
+ if (line.includes(`[${className} `) && line.includes("=")) ret = [line.slice(line.indexOf("*") + 1, line.indexOf("=")).trim(), className];
1546
+ } else if (newLine.includes(`${className}(`) && line.includes("=")) {
1547
+ let proName;
1548
+ if (line.includes("let ")) proName = line.slice(line.indexOf("let ") + 4, line.indexOf("="));
1549
+ else if (line.includes("var ")) proName = line.slice(line.indexOf("var ") + 4, line.indexOf("="));
1550
+ else proName = line.slice(line.indexOf(" ") + 1, line.indexOf("="));
1551
+ if (proName.includes(":")) proName = proName.split(":")[0];
1552
+ ret = [proName.trim(), className];
1553
+ }
1554
+ if (line.includes("//") && ret != null && line.indexOf("//") < line.indexOf(ret[0])) ret = null;
1555
+ return ret;
1556
+ }
1557
+ function round2(v) {
1558
+ return (Math.round(v * 100) / 100).toString();
1559
+ }
1560
+ function ocRandomColor(alpha, ctx) {
1561
+ return `[UIColor colorWithRed:${round2(ctx.rng.next())} green:${round2(ctx.rng.next())} blue:${round2(ctx.rng.next())} alpha:${alpha}]`;
1562
+ }
1563
+ function swiftRandomColor(alpha, ctx) {
1564
+ return `UIColor.init(red: ${round2(ctx.rng.next())}, green: ${round2(ctx.rng.next())}, blue: ${round2(ctx.rng.next())}, alpha: ${alpha})`;
1565
+ }
1566
+ function swiftSysColor(line) {
1567
+ for (const color of [
1568
+ "black",
1569
+ "darkGray",
1570
+ "lightGray",
1571
+ "white",
1572
+ "gray",
1573
+ "red",
1574
+ "green",
1575
+ "blue",
1576
+ "cyan",
1577
+ "yellow",
1578
+ "magenta",
1579
+ "orange",
1580
+ "purple",
1581
+ "brown",
1582
+ "clear",
1583
+ "groupTableViewBackground"
1584
+ ]) if (line.includes(`UIColor.${color}`)) return `UIColor.${color}`;
1585
+ return null;
1586
+ }
1587
+ function getSwiftColorCodeInLine(line) {
1588
+ const sys = swiftSysColor(line);
1589
+ if (sys != null) return sys;
1590
+ const start = line.indexOf("UIColor.");
1591
+ if (start === -1) return null;
1592
+ let depth = 0;
1593
+ let lastClose = -1;
1594
+ for (let i = start; i < line.length; i += 1) {
1595
+ const ch = line[i];
1596
+ if (ch === "(") depth += 1;
1597
+ else if (ch === ")") {
1598
+ depth -= 1;
1599
+ if (depth === 0) {
1600
+ lastClose = i;
1601
+ break;
1602
+ }
1603
+ }
1604
+ }
1605
+ if (lastClose === -1) return null;
1606
+ return line.slice(start, lastClose + 1);
1607
+ }
1608
+ function ocColorReplaceLine(line, alpha, ctx) {
1609
+ const start = line.indexOf("[UIColor ");
1610
+ if (start === -1) return line;
1611
+ const end = line.indexOf("]", start);
1612
+ if (end === -1) return line;
1613
+ return line.replace(line.slice(start, end + 1), ocRandomColor(alpha, ctx));
1614
+ }
1615
+ function changeViewBackgroundColor(line, isSwift, magic, ctx) {
1616
+ const isRepBgColor = magic.replaceColor?.[0] ?? -1;
1617
+ const isRepTextColor = magic.replaceColor?.[1] ?? -1;
1618
+ const isRepClearColor = magic.replaceColor?.[2] ?? -1;
1619
+ const isAddBgColor = magic.addColor ?? -1;
1620
+ const isAddTextColor = magic.textColor ?? -1;
1621
+ const bgAlpha = magic.alpha?.[0] ?? 1;
1622
+ const textAlpha = magic.alpha?.[1] ?? 1;
1623
+ const otherAlpha = 1;
1624
+ const proNameTub = getClassProNameTub(line, isSwift);
1625
+ if (proNameTub != null) {
1626
+ const spaceCount = getSpaceCount(line);
1627
+ if (isSwift) {
1628
+ if (spaceCount > 4) {
1629
+ if (isAddBgColor !== -1) line += `${" ".repeat(spaceCount)}${proNameTub[0]}.backgroundColor = ${swiftRandomColor(bgAlpha, ctx)}\n`;
1630
+ if (isAddTextColor !== -1) {
1631
+ if (proNameTub[1] === "UILabel" || proNameTub[1] === "UITextField") {
1632
+ line += `${" ".repeat(spaceCount)}${proNameTub[0]}.textColor = ${swiftRandomColor(textAlpha, ctx)}\n`;
1633
+ return line;
1634
+ }
1635
+ if (proNameTub[1] === "UIButton") line += `${" ".repeat(spaceCount)}${proNameTub[0]}.setTitleColor(${swiftRandomColor(textAlpha, ctx)}, for: .normal)\n`;
1636
+ }
1637
+ }
1638
+ return line;
1639
+ }
1640
+ if (isAddBgColor !== -1) line += `${" ".repeat(spaceCount)}${proNameTub[0]}.backgroundColor = ${ocRandomColor(bgAlpha, ctx)};\n`;
1641
+ if (isAddTextColor !== -1) {
1642
+ if (proNameTub[1] === "UILabel" || proNameTub[1] === "UITextField") {
1643
+ line += `${" ".repeat(spaceCount)}${proNameTub[0]}.textColor = ${ocRandomColor(textAlpha, ctx)};\n`;
1644
+ return line;
1645
+ }
1646
+ if (proNameTub[1] === "UIButton") line += `${" ".repeat(spaceCount)}[${proNameTub[0]} setTitleColor:${ocRandomColor(textAlpha, ctx)} forState:UIControlStateNormal];\n`;
1647
+ }
1648
+ return line;
1649
+ }
1650
+ if (isSwift) {
1651
+ if ((line.includes("UIColor.init(") || line.includes("UIColor.")) && !line.includes("UIColor.clear")) {
1652
+ const oldColorCode = getSwiftColorCodeInLine(line);
1653
+ if (line.includes(".backgroundColor") && oldColorCode != null) return isRepBgColor !== -1 ? line.replace(oldColorCode, swiftRandomColor(bgAlpha, ctx)) : line;
1654
+ if ((line.includes(" setTitleColor:") || line.includes(".tintColor")) && oldColorCode != null) return isRepTextColor !== -1 ? line.replace(oldColorCode, swiftRandomColor(textAlpha, ctx)) : line;
1655
+ return oldColorCode != null ? line.replace(oldColorCode, swiftRandomColor(otherAlpha, ctx)) : line;
1656
+ }
1657
+ if (line.includes("UIColor.clear") && isRepClearColor !== -1) {
1658
+ const oldColorCode = "UIColor.clear";
1659
+ if (line.includes(".backgroundColor")) return isRepBgColor !== -1 ? line.replace(oldColorCode, swiftRandomColor(bgAlpha, ctx)) : line;
1660
+ if (line.includes(" setTitleColor:") || line.includes(".tintColor")) return isRepTextColor !== -1 ? line.replace(oldColorCode, swiftRandomColor(textAlpha, ctx)) : line;
1661
+ return line.replace(oldColorCode, swiftRandomColor(otherAlpha, ctx));
1662
+ }
1663
+ return line;
1664
+ }
1665
+ if (line.includes("[UIColor ")) {
1666
+ if (line.includes(".backgroundColor") || line.includes(" setBackgroundColor:")) return isRepBgColor !== -1 ? ocColorReplaceLine(line, bgAlpha, ctx) : line;
1667
+ if (line.includes(" setTextColor:") || line.includes(" setTitleColor:") || line.includes(".tintColor") || line.includes(" setTintColor:")) return isRepTextColor !== -1 ? ocColorReplaceLine(line, textAlpha, ctx) : line;
1668
+ return ocColorReplaceLine(line, otherAlpha, ctx);
1669
+ }
1670
+ if ((line.includes("[UIColor clearColor]") || line.includes("UIColor.clearColor")) && isRepClearColor !== -1) {
1671
+ const oldColorCode = line.includes("[UIColor clearColor]") ? "[UIColor clearColor]" : "UIColor.clearColor";
1672
+ if (line.includes(".backgroundColor") || line.includes(" setBackgroundColor:")) return isRepBgColor !== -1 ? line.replace(oldColorCode, ocRandomColor(bgAlpha, ctx)) : line;
1673
+ if (line.includes(" setTextColor:") || line.includes(" setTitleColor:") || line.includes(".tintColor") || line.includes(" setTintColor:")) return isRepTextColor !== -1 ? line.replace(oldColorCode, ocRandomColor(textAlpha, ctx)) : line;
1674
+ return line.replace(oldColorCode, ocRandomColor(otherAlpha, ctx));
1675
+ }
1676
+ return line;
1677
+ }
1678
+ const DEFAULT_EXTENSIONS = [
1679
+ "m",
1680
+ "mm",
1681
+ "cpp",
1682
+ "h",
1683
+ "swift",
1684
+ "pch",
1685
+ "c",
1686
+ "cc",
1687
+ "xib",
1688
+ "storyboard",
1689
+ "inl",
1690
+ "hpp"
1691
+ ];
1692
+ function isSupported(relative, options) {
1693
+ return new Set(options.fileExtensions ?? DEFAULT_EXTENSIONS).has(extension(relative));
1694
+ }
1695
+ function basenameWithoutExtension(relative) {
1696
+ const base = relative.slice(relative.lastIndexOf("/") + 1);
1697
+ const dot = base.lastIndexOf(".");
1698
+ return dot < 1 ? base : base.slice(0, dot);
1699
+ }
1700
+ function transformLine(ctx, relative, line) {
1701
+ const isSwift = extension(relative) === "swift";
1702
+ const isXib = isXibOrSb(relative);
1703
+ let out = line;
1704
+ for (const [from, to] of ctx.methodMap) if (out.includes(from)) out = replaceMethodNameInLine(out, from, to, isXib);
1705
+ for (const [from, to] of ctx.propertyMap) if (out.includes(from) || out.includes(getSetProName(from))) out = replacePropertyNameInLine(out, from, to, isSwift, isXib, false);
1706
+ for (const [from, to] of ctx.classMap) if (out.includes(from)) out = replaceObjNameByReInLine(out, from, to);
1707
+ if (ctx.options.magicColor?.enabled) out = changeViewBackgroundColor(out, isSwift, ctx.options.magicColor, ctx);
1708
+ return out;
1709
+ }
1710
+ function collectMethodFromLine(ctx, line) {
1711
+ getMissMethodNameTuple(line, ctx.options.methodPrefix, ctx);
1712
+ }
1713
+ function collectSwiftMethod(ctx, line) {
1714
+ const trimmed = line.trim();
1715
+ if (!trimmed.includes("func ")) return;
1716
+ let funcName = trimmed.slice(trimmed.indexOf("func ") + 5);
1717
+ funcName = funcName.slice(0, funcName.indexOf("{") === -1 ? void 0 : funcName.indexOf("{"));
1718
+ if (funcName.includes("(")) funcName = funcName.slice(0, funcName.indexOf("("));
1719
+ funcName = funcName.trim();
1720
+ if (isHaveSpecialChar(funcName) || funcName.length <= 3) return;
1721
+ if (isPassMethodName(funcName, true)) return;
1722
+ if (FILTER_LIST.includes(funcName)) return;
1723
+ if (!ctx.methodMap.has(funcName)) {
1724
+ const prefix = ctx.options.methodPrefix ?? "";
1725
+ let miss;
1726
+ if (prefix.endsWith("#")) miss = `${prefix.split("#")[0]}${funcName}`;
1727
+ else {
1728
+ const suffix = ctx.options.methodSuffix ?? "";
1729
+ miss = randomWordFromLexicon(ctx) + pyCapitalize(randomWordFromLexicon(ctx)) + pyCapitalize(randomWordFromLexicon(ctx)) + suffix;
1730
+ if (prefix.length > 0) miss = prefix.endsWith("_") ? `${prefix}${miss}` : `${prefix}${pyCapitalize(miss)}`;
1731
+ }
1732
+ ctx.methodMap.set(funcName, miss.replace(/\s+/g, ""));
1733
+ }
1734
+ }
1735
+ function collectPropertiesForLine(ctx, relative, line) {
1736
+ if (isIgnoreAnalysisLine(line)) return;
1737
+ const ext = extension(relative);
1738
+ if (ext === "h" || ext === "m" || ext === "mm" || ext === "cpp") {
1739
+ if (line.includes("@property")) ocPropertyNameTup(line, ctx.options.propertyPrefix, ctx);
1740
+ else if (line.trim().startsWith("@interface") || line.trim().startsWith("@implementation")) ocConstantNameTup(line, ctx.options.propertyPrefix, ctx);
1741
+ else swiftCppPropertyNameTup(line, ctx.options.propertyPrefix, ext === "cpp", ctx);
1742
+ } else if (ext === "swift") swiftCppPropertyNameTup(line, ctx.options.propertyPrefix, false, ctx);
1743
+ }
1744
+ function obfuscateObjcContent(content, options = {}, seed) {
1745
+ const ctx = createRenameContext(options, seed);
1746
+ const lines = content.split("\n");
1747
+ for (const line of lines) {
1748
+ if (line.trim().includes("func ")) collectSwiftMethod(ctx, line);
1749
+ else collectMethodFromLine(ctx, line);
1750
+ collectPropertiesForLine(ctx, "sample.swift", line);
1751
+ }
1752
+ return lines.map((line) => transformLine(ctx, "sample.swift", line)).join("\n");
1753
+ }
1754
+ function renameObjcSymbols(files, options = {}, seed) {
1755
+ const ctx = createRenameContext(options, seed);
1756
+ const ordered = [...files].sort((a, b) => a.relative.localeCompare(b.relative));
1757
+ const classPrefixOpt = options.replaceClassPrefix;
1758
+ const methodPrefixOpt = options.replaceMethodPrefix;
1759
+ const propertyPrefixOpt = options.replacePropertyPrefix;
1760
+ const headers = /* @__PURE__ */ new Set();
1761
+ const impls = /* @__PURE__ */ new Set();
1762
+ for (const entry of ordered) {
1763
+ const base = basenameWithoutExtension(entry.relative);
1764
+ const ext = extension(entry.relative);
1765
+ if (ext === "h") headers.add(base);
1766
+ if (ext === "m" || ext === "mm" || ext === "cpp" || ext === "hpp" || ext === "swift") impls.add(base);
1767
+ }
1768
+ for (const base of [...headers].sort()) {
1769
+ if (!impls.has(base) || base.includes("+")) continue;
1770
+ if (classPrefixOpt) {
1771
+ if (!base.startsWith(classPrefixOpt.from) || base.includes("AppDelegate")) continue;
1772
+ ctx.classMap.set(base, `${classPrefixOpt.to}${base.slice(classPrefixOpt.from.length)}`);
1773
+ continue;
1774
+ }
1775
+ if (isPassObjectName(base, ctx)) continue;
1776
+ ctx.classMap.set(base, getMissClassName(base, ctx.options.classPrefix, ctx));
1777
+ }
1778
+ for (const entry of ordered) {
1779
+ if (!isSupported(entry.relative, ctx.options)) continue;
1780
+ const content = readFileSync(entry.absolute, "utf8");
1781
+ const ext = extension(entry.relative);
1782
+ if (methodPrefixOpt) {
1783
+ if (ext === "h") for (const line of content.split("\n")) collectMethodPrefixTuple(line, methodPrefixOpt.from, methodPrefixOpt.to, ctx);
1784
+ } else if (ext === "h") for (const line of content.split("\n")) collectMethodFromLine(ctx, line);
1785
+ else if (ext === "swift") for (const line of content.split("\n")) collectSwiftMethod(ctx, line);
1786
+ if ([
1787
+ "h",
1788
+ "m",
1789
+ "mm",
1790
+ "cpp",
1791
+ "swift"
1792
+ ].includes(ext)) for (const line of content.split("\n")) if (propertyPrefixOpt) {
1793
+ if (line.includes("@property")) {
1794
+ const tuple = propertyNameReplaceTuple(line, propertyPrefixOpt.from, propertyPrefixOpt.to);
1795
+ if (tuple) ctx.propertyMap.set(tuple[0], tuple[1]);
1796
+ }
1797
+ } else collectPropertiesForLine(ctx, entry.relative, line);
1798
+ }
1799
+ const changedPaths = [];
1800
+ let changed = 0;
1801
+ for (const entry of ordered) {
1802
+ if (!isSupported(entry.relative, ctx.options)) continue;
1803
+ const before = readFileSync(entry.absolute, "utf8");
1804
+ const after = before.split("\n").map((line) => transformLine(ctx, entry.relative, line)).join("\n");
1805
+ if (after !== before) {
1806
+ if (writeIfChanged(entry, after)) {
1807
+ changed += 1;
1808
+ changedPaths.push(entry.relative);
1809
+ }
1810
+ }
1811
+ }
1812
+ return {
1813
+ changed,
1814
+ changedPaths
1815
+ };
1816
+ }
1817
+ export { FILTER_CLASS_NAME_LIST, FILTER_LIST, FILTER_MUST_IGNORE_METHOD_AND_PROPERTY_LIST, FILTER_MUST_IGNORE_METHOD_LIST, changeViewBackgroundColor, chineseToPinyin, colonIsInBrackets, createMissMethodName, createMissPropertyNameWithOriginalPropertyName, createRenameContext, getClassProNameTub, getMissClassName, getMissMethodNameTuple, getMissMethodNameWithOriginalName, getMissObjName, getMissPropertyNameAndAddTemporaryList, getOcMissPropertyNameTub, getSetProName, getSpaceCount, getSwiftMissPropertyNameTub, isContainChinese, isHaveMethodName, isHaveSpecialChar, isIgnoreAnalysisLine, isNumberString, isPassMethodName, isPassObjectName, isPassPropertyName, isXibOrSb, methodNameListInLine, obfuscateObjcContent, ocColorReplaceLine, ocConstantNameTup, ocPropertyNameTup, ocRandomColor, propertyNameReplaceTuple, randomWordByEnchant, renameObjcSymbols, replaceMethodNameInLine, replaceObjNameByReInLine, replacePropertyNameInLine, swiftCppPropertyNameTup, swiftRandomColor };
1818
+
1819
+ //# sourceMappingURL=objc-symbols.js.map