<|start_filename|>ObjC/Weaver/WVDOMContext.h<|end_filename|>
//
//  WVDOMContext.h
//  Texture
//
//  Copyright (c) 2017-present, Pinterest, Inc.  All rights reserved.
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface WVDOMContext : NSObject

/**
 * Returns object key represented by the given string
 *
 * @param keyString The string represents a key
 *
 * @return The key of the string is valid, nil otherwise
 */
+ (NSNumber *)keyFromString:(NSString *)keyString;

/**
 * Stores the given object and returns its associated key
 *
 * @param object The object to be stored
 *
 * @return The object's key
 */
- (NSNumber *)storeObject:(NSObject *)object;

/**
 * Retrieves the object associated with the given key
 *
 * @param key The key to lookup
 *
 * @return The object if found, nil otherwise
 */
- (NSObject *)objectForKey:(NSNumber *)key;

/**
 * Stores the given rect with the given associated key
 *
 * @param rect The rect to be stored
 *
 * @param key The key assocaites with the rect
 */
- (void)setRect:(CGRect)rect forKey:(NSNumber *)key;

/**
 * Retrieves the rect associated with the given key
 *
 * @param key The key to lookup
 *
 * @return The rect if found, CGRectNull otherwise
 */
- (CGRect)rectForKey:(NSNumber *)key;

/**
 * Removes the rect for the given key, if one exists.
 *
 * @param key The key to remove.
 */
- (void)removeRectForKey:(NSNumber *)key;

@end

NS_ASSUME_NONNULL_END


<|start_filename|>ObjC/Weaver/WVDebugger.h<|end_filename|>
//
//  WVDebugger.h
//  Texture
//
//  Copyright (c) 2017-present, Pinterest, Inc.  All rights reserved.
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//

#import <Weaver/PDDebugger.h>

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface WVDebugger : PDDebugger

+ (WVDebugger *)defaultInstance;

- (void)enableLayoutElementDebuggingWithApplication:(UIApplication *)application;

@end

NS_ASSUME_NONNULL_END


<|start_filename|>ObjC/DerivedSources/PDCSSTypes.h<|end_filename|>
//    
//  PDCSSTypes.h
//  PonyDebuggerDerivedSources
//
//  Generated on 8/23/12
//
//  Licensed to Square, Inc. under one or more contributor license agreements.
//  See the LICENSE file distributed with this work for the terms under
//  which Square, Inc. licenses this file to you.
//
    
#import <Weaver/PDObject.h>
#import <Weaver/PDDebugger.h>
#import <Weaver/PDDynamicDebuggerDomain.h>

NS_ASSUME_NONNULL_BEGIN

typedef NSString PDCSSStyleSheetId;

// CSS rule collection for a single pseudo style.
@interface PDCSSPseudoIdRules : PDObject

// Pseudo style identifier (see <code>enum PseudoId</code> in <code>RenderStyleConstants.h</code>).
// Type: integer
@property (nonatomic, strong) NSNumber *pseudoId;

// CSS rules applicable to the pseudo style.
// Type: array
@property (nonatomic, strong) NSArray *rules;

@end


// Text range within a resource. All numbers are zero-based.
@interface PDCSSSourceRange : PDObject

// Start line of range.
// Type: integer
@property (nonatomic, strong) NSNumber *startLine;

// Start column of range (inclusive).
// Type: integer
@property (nonatomic, strong) NSNumber *startColumn;

// End line of range.
// Type: integer
@property (nonatomic, strong) NSNumber *endLine;

// End column of range (exclusive).
// Type: integer
@property (nonatomic, strong) NSNumber *endColumn;

@end


// CSS property declaration data.
@interface PDCSSProperty : PDObject

// The property name.
@property (nonatomic, strong) NSString *name;

// The property value.
@property (nonatomic, strong) NSString *value;

// Whether the property has \"!important\" annotation (implies <code>false</code> if absent).
// Type: boolean
@property (nonatomic, strong, nullable) NSNumber *important;

// Whether the property is implicit (implies <code>false</code> if absent).
// Type: boolean
@property (nonatomic, strong, nullable) NSNumber *implicit;

// The full property text as specified in the style.
@property (nonatomic, strong, nullable) NSString *text;

// Whether the property is understood by the browser (implies <code>true</code> if absent).
// Type: boolean
@property (nonatomic, strong, nullable) NSNumber *parsedOk;

// Whether the property is disabled by the user (present for source-based properties only).
// Type
@property (nonatomic, strong, nullable) NSNumber *disabled;

// The entire property range in the enclosing style declaration (if available).
@property (nonatomic, strong, nullable) PDCSSSourceRange *range;

+ (instancetype)propertyWithName:(NSString *)name value:(NSString *)value;

@end


@interface PDCSSShorthandEntry : PDObject

// Shorthand name.
@property (nonatomic, strong) NSString *name;

// Shorthand value.
@property (nonatomic, strong) NSString *value;

// Whether the property has \"!important\" annotation (implies <code>false</code> if absent).
// Type: boolean
@property (nonatomic, strong, nullable) NSNumber *important;

@end


// CSS style representation.
@interface PDCSSStyle : PDObject

// The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from.
@property (nonatomic, strong, nullable) PDCSSStyleSheetId *styleSheetId;

// CSS properties in the style.
@property (nonatomic, strong) NSArray<PDCSSProperty *> *cssProperties;

// Computed values for all shorthands found in the style.
@property (nonatomic, strong) NSArray<PDCSSShorthandEntry *> *shorthandEntries;

// Style declaration text (if available).
@property (nonatomic, strong, nullable) NSString *cssText;

// Style declaration range in the enclosing stylesheet (if available).
@property (nonatomic, strong, nullable) PDCSSSourceRange *range;

@end


// CSS rule collection for a single pseudo style.
@interface PDCSSInheritedStyleEntry : PDObject

// The ancestor node's inline style, if any, in the style inheritance chain.
@property (nonatomic, strong) PDCSSStyle *inlineStyle;

// CSS rules matching the ancestor node in the style inheritance chain.
// Type: array
@property (nonatomic, strong) NSArray *matchedCSSRules;

@end


// CSS style information for a DOM style attribute.
@interface PDCSSStyleAttribute : PDObject

// DOM attribute name (e.g. "width").
// Type: string
@property (nonatomic, strong) NSString *name;

// CSS style generated by the respective DOM attribute.
@property (nonatomic, strong) PDCSSStyle *style;

@end


// CSS stylesheet metainformation.
@interface PDCSSStyleSheetHeader : PDObject

// The stylesheet identifier.
@property (nonatomic, strong) NSString *styleSheetId;

// Owner frame identifier.
@property (nonatomic, strong) NSString *frameId;

// Stylesheet resource URL.
// Type: string
@property (nonatomic, strong) NSString *sourceURL;

// Stylesheet origin.
@property (nonatomic, strong) NSString *origin;

// Stylesheet title.
// Type: string
@property (nonatomic, strong) NSString *title;

// Denotes whether the stylesheet is disabled.
// Type: boolean
@property (nonatomic, strong) NSNumber *disabled;

@end


// CSS stylesheet contents.
@interface PDCSSStyleSheetBody : PDObject

// The stylesheet identifier.
@property (nonatomic, strong) NSString *styleSheetId;

// Stylesheet resource URL.
// Type: array
@property (nonatomic, strong) NSArray *rules;

// Stylesheet resource contents (if available).
@property (nonatomic, strong) NSString *text;

@end


// Data for a simple selector (these are delimited by commas in a selector list).
@interface PDCSSValue : PDObject

+ (instancetype)valueWithText:(NSString *)text;

// Selector text.
@property (nonatomic, strong) NSString *text;

// Selector range in the underlying resource (if available).
@property (nonatomic, strong, nullable) PDCSSSourceRange *range;

@end


// Selector list data.
@interface PDCSSSelectorList : PDObject

+ (instancetype)selectorListWithSelectors:(NSArray<PDCSSValue *> *)selectors;

// Selectors in the list.
@property (nonatomic, strong) NSArray<PDCSSValue *> *selectors;

// Rule selector text.
@property (nonatomic, strong) NSString *text;

@end


@interface PDCSSMediaQueryExpression : PDObject

// Media query expression value.
// Type: number
@property (nonatomic, strong) NSNumber *value;

// Media query expression units.
@property (nonatomic, strong) NSString *unit;

// Media query expression feature.
@property (nonatomic, strong) NSString *feature;

// The associated range of the value text in the enclosing stylesheet (if available).
@property (nonatomic, strong, nullable) PDCSSSourceRange *valueRange;

// Computed length of media query expression (if applicable).
// Type: number
@property (nonatomic, strong, nullable) NSNumber *computedLength;

@end


@interface PDCSSMediaQuery : PDObject

// Array of media query expressions.
@property (nonatomic, strong) NSArray<PDCSSMediaQueryExpression *> *expressions;

// Whether the media query condition is satisfied.
// Type: boolean
@property (nonatomic, strong) NSNumber *active;

@end


// CSS media query descriptor.
@interface PDCSSMedia : PDObject

// Media query text.
@property (nonatomic, strong) NSString *text;

// Source of the media query: "mediaRule" if specified by a @media rule, "importRule" if specified by an @import rule, "linkedSheet" if specified by a "media" attribute in a linked stylesheet's LINK tag, "inlineSheet" if specified by a "media" attribute in an inline stylesheet's STYLE tag.
@property (nonatomic, strong) NSString *source;

// URL of the document containing the media query description.
@property (nonatomic, strong, nullable) NSString *sourceURL;

// The associated rule (@media or @import) header range in the enclosing stylesheet (if available).
@property (nonatomic, strong, nullable) PDCSSSourceRange *range;

// Identifier of the stylesheet containing this object (if exists).
@property (nonatomic, strong, nullable) PDCSSStyleSheetId *parentStyleSheetId;

// Array of media queries.
@property (nonatomic, strong, nullable) NSArray<PDCSSMediaQuery *> *mediaList;

@end


typedef NSString PDCSSStyleSheetOrigin;
// for stylesheets injected via extension
#define PDCSSStyleSheetOriginInjected @"injected"
// for user-agent stylesheets
#define PDCSSStyleSheetOriginUserAgent @"user-agent"
// for stylesheets created by the inspector (i.e. those holding the "via inspector" rules)
#define PDCSSStyleSheetOriginInspector @"inspector"
// for regular stylesheets
#define PDCSSStyleSheetOriginRegular @"regular"

// CSS rule representation.
@interface PDCSSRule : PDObject

// The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from.
@property (nonatomic, strong, nullable) NSString *styleSheetId;

// Rule selector data.
@property (nonatomic, strong) PDCSSSelectorList *selectorList;

// Parent stylesheet's origin.
// Either of PDCSSStyleSheetOriginInjected, PDCSSStyleSheetOriginUserAgent, PDCSSStyleSheetOriginInspector or PDCSSStyleSheetOriginRegular
@property (nonatomic, strong) PDCSSStyleSheetOrigin *origin;

// Associated style declaration.
@property (nonatomic, strong) PDCSSStyle *style;

// Media list array (for rules involving media queries). The array enumerates media queries starting with the innermost one, going outwards.
@property (nonatomic, strong, nullable) NSArray<PDCSSMedia *> *media;

@end


// Match data for a CSS rule
@interface PDCSSRuleMatch : PDObject

// CSS rule in the match.
@property (nonatomic, strong) PDCSSRule *rule;

// Matching selector indices in the rule's selectorList selectors (0-based).
// Type: array of integers
@property (nonatomic, strong) NSArray<NSNumber *> *matchingSelectors;

@end


@interface PDCSSPropertyInfo : PDObject

// Property name.
// Type: string
@property (nonatomic, strong) NSString *name;

// Longhand property names.
// Type: array
@property (nonatomic, strong) NSArray *longhands;

@end


@interface PDCSSComputedStyleProperty : PDObject

// Computed style property name.
// Type: string
@property (nonatomic, strong) NSString *name;

// Computed style property value.
// Type: string
@property (nonatomic, strong) NSString *value;

@end


// CSS selector profile entry.
@interface PDCSSSelectorProfileEntry : PDObject

// CSS selector of the corresponding rule.
// Type: string
@property (nonatomic, strong) NSString *selector;

// URL of the resource containing the corresponding rule.
// Type: string
@property (nonatomic, strong) NSString *url;

// Selector line number in the resource for the corresponding rule.
// Type: integer
@property (nonatomic, strong) NSNumber *lineNumber;

// Total time this rule handling contributed to the browser running time during profiling (in milliseconds.)
// Type: number
@property (nonatomic, strong) NSNumber *time;

// Number of times this rule was considered a candidate for matching against DOM elements.
// Type: integer
@property (nonatomic, strong) NSNumber *hitCount;

// Number of times this rule actually matched a DOM element.
// Type: integer
@property (nonatomic, strong) NSNumber *matchCount;

@end


@interface PDCSSSelectorProfile : PDObject

// Total processing time for all selectors in the profile (in milliseconds.)
// Type: number
@property (nonatomic, strong) NSNumber *totalTime;

// CSS selector profile entries.
// Type: array
@property (nonatomic, strong) NSArray *data;

@end


// This object represents a region that flows from a Named Flow.
@interface PDCSSRegion : PDObject

// The "overset" attribute of a Named Flow.
// Type: string
@property (nonatomic, strong) NSString *regionOverset;

// The corresponding DOM node id.
@property (nonatomic, strong) NSNumber *nodeId;

@end


// This object represents a Named Flow.
@interface PDCSSNamedFlow : PDObject

// The document node id.
@property (nonatomic, strong) NSNumber *documentNodeId;

// Named Flow identifier.
// Type: string
@property (nonatomic, strong) NSString *name;

// The "overset" attribute of a Named Flow.
// Type: boolean
@property (nonatomic, strong) NSNumber *overset;

// An array of nodes that flow into the Named Flow.
// Type: array
@property (nonatomic, strong) NSArray *content;

// An array of regions associated with the Named Flow.
// Type: array
@property (nonatomic, strong) NSArray *regions;

@end

// A descriptor of operation to mutate style declaration text.
@interface PDCSSStyleDeclarationEdit : PDObject

// The css style sheet identifier.
@property (nonatomic, strong) PDCSSStyleSheetId *styleSheetId;

// The range of the style text in the enclosing stylesheet.
@property (nonatomic, strong) PDCSSSourceRange *range;

// New style text.
@property (nonatomic, strong) NSString *text;

@end

NS_ASSUME_NONNULL_END



<|start_filename|>ObjC/Weaver/PDDOMTypes+UIKit.h<|end_filename|>
//
//  PDDOMTypes+UIKit.h
//  Texture
//
//  Copyright (c) 2017-present, Pinterest, Inc.  All rights reserved.
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//

#import <UIKit/UIKit.h>
#import <Weaver/PDDOMTypes.h>

@interface NSDictionary (PDDOMRGBA)

- (UIColor *)UIColor;

@end

@interface NSDictionary (PDDOMHighlightConfig)

- (UIColor *)contentUIColor;

- (UIColor *)paddingUIColor;

- (UIColor *)borderUIColor;

- (UIColor *)marginUIColor;

@end


<|start_filename|>ObjC/Weaver/NSObject+KVSC.h<|end_filename|>
//
//  NSObject+KVSC.h
//  PonyDebugger
//
//  Created by <NAME> on 13/6/17.
//
//  Licensed to Square, Inc. under one or more contributor license agreements.
//  See the LICENSE file distributed with this work for the terms under
//  which Square, Inc. licenses this file to you.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSObject (KVSC)

+ (nullable NSString *)PD_stringForValue:(id)value atKeyPath:(NSString *)keyPath onObject:(id)object;

+ (const char *)PD_typeEncodingForKeyPath:(NSString *)keyPath onObject:(id)object;

- (nullable NSString *)PD_valueStringForKeyPath:(NSString *)keyPath;

- (void)PD_setValueString:(NSString *)valueString forKeyPath:(NSString *)keyPath;

@end

NS_ASSUME_NONNULL_END


<|start_filename|>ObjC/DerivedSources/PDCSSDomain.h<|end_filename|>
//
//  PDCSSDomain.h
//  PonyDebuggerDerivedSources
//
//  Generated on 8/23/12
//
//  Licensed to Square, Inc. under one or more contributor license agreements.
//  See the LICENSE file distributed with this work for the terms under
//  which Square, Inc. licenses this file to you.
//

#import <Weaver/PDObject.h>
#import <Weaver/PDDebugger.h>
#import <Weaver/PDDynamicDebuggerDomain.h>

@class PDCSSRule;
@class PDCSSStyleId;
@class PDCSSStyleSheetBody;
@class PDCSSStyle;
@class PDCSSSelectorProfile;
@class PDCSSNamedFlow;
@class PDCSSRuleMatch;
@class PDCSSComputedStyleProperty;
@class PDCSSStyleDeclarationEdit;

@protocol PDCSSCommandDelegate;

// This domain exposes CSS read/write operations. All CSS objects, like stylesheets, rules, and styles, have an associated <code>id</code> used in subsequent operations on the related object. Each object type has a specific <code>id</code> structure, and those are not interchangeable between objects of different kinds. CSS objects can be loaded using the <code>get*ForNode()</code> calls (which accept a DOM node id). Alternatively, a client can discover all the existing stylesheets with the <code>getAllStyleSheets()</code> method and subsequently load the required stylesheet contents using the <code>getStyleSheet[Text]()</code> methods.
@interface PDCSSDomain : PDDynamicDebuggerDomain 

@property (nonatomic, weak) id <PDCSSCommandDelegate, PDCommandDelegate> delegate;

// Events

// Fires whenever a MediaQuery result changes (for example, after a browser window has been resized.) The current implementation considers only viewport-dependent media features.
- (void)mediaQueryResultChanged;

// Fired whenever a stylesheet is changed as a result of the client operation.
- (void)styleSheetChangedWithStyleSheetId:(NSString *)styleSheetId;

// Fires when a Named Flow is created.
// Param documentNodeId: The document node id.
// Param namedFlow: Identifier of the new Named Flow.
- (void)namedFlowCreatedWithDocumentNodeId:(NSNumber *)documentNodeId namedFlow:(NSString *)namedFlow;

// Fires when a Named Flow is removed: has no associated content nodes and regions.
// Param documentNodeId: The document node id.
// Param namedFlow: Identifier of the removed Named Flow.
- (void)namedFlowRemovedWithDocumentNodeId:(NSNumber *)documentNodeId namedFlow:(NSString *)namedFlow;

@end

@protocol PDCSSCommandDelegate <PDCommandDelegate>
@optional

// Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been enabled until the result of this command is received.
- (void)domain:(PDCSSDomain *)domain enableWithCallback:(void (^)(id error))callback;

// Disables the CSS agent for the given page.
- (void)domain:(PDCSSDomain *)domain disableWithCallback:(void (^)(id error))callback;

// Returns requested styles for a DOM node identified by <code>nodeId</code>.
// Param includePseudo: Whether to include pseudo styles (default: true).
// Param includeInherited: Whether to include inherited styles (default: true).
// Callback Param matchedCSSRules: CSS rules matching this node, from all applicable stylesheets.
// Callback Param pseudoElements: Pseudo style rules for this node.
// Callback Param inherited: A chain of inherited styles (from the immediate node parent up to the DOM tree root).
- (void)domain:(PDCSSDomain *)domain getMatchedStylesForNodeWithNodeId:(NSNumber *)nodeId includePseudo:(NSNumber *)includePseudo includeInherited:(NSNumber *)includeInherited callback:(void (^)(NSArray<PDCSSRuleMatch *> *matchedCSSRules, NSArray *pseudoElements, NSArray *inherited, id error))callback;

// Applies specified style edits one after another in the given order.
// Callback Param styles: The resulting styles after modification.
- (void)domain:(PDCSSDomain *)domain setStyleTextsWithEdits:(NSArray<NSDictionary *> *)edits callback:(void (^)(NSArray<PDCSSStyle *> *styles, id error))callback;

@end

@interface PDDebugger (PDCSSDomain)

@property (nonatomic, readonly, strong) PDCSSDomain *CSSDomain;

@end


<|start_filename|>ObjC/Weaver/NSObject+WVDOMNodeProviding.h<|end_filename|>
//
//  NSObject+WVDOMNodeProviding.h
//  Texture
//
//  Copyright (c) 2017-present, Pinterest, Inc.  All rights reserved.
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@class PDDOMNode, WVDOMContext;

@interface NSObject (PDDOMNodeProviding)

- (PDDOMNode *)wv_generateDOMNodeWithContext:(WVDOMContext *)context;
- (CGRect)wv_frameInWindow;
- (NSArray *)wv_children;

@end

NS_ASSUME_NONNULL_END


<|start_filename|>ObjC/Weaver/WVElementDomainController.h<|end_filename|>
//
//  WVElementDomainController.h
//  Texture
//
//  Copyright (c) 2017-present, Pinterest, Inc.  All rights reserved.
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//

#import <Weaver/WVElementPropsDomainController.h>

#import <Weaver/PDDOMDomain.h>
#import <Weaver/PDDomainController.h>

#import <UIKit/UIKit.h>

@class WVDOMContext;

NS_ASSUME_NONNULL_BEGIN

@interface WVElementDomainController : PDDomainController <PDDOMCommandDelegate, WVElementPropsDomainControllerDataSource>

@property (nonatomic, strong) PDDOMDomain *domain;
@property (nonatomic, readonly) WVDOMContext *context;

+ (WVElementDomainController *)defaultInstance;

- (void)startMonitoringWithApplication:(UIApplication *)application;

@end

NS_ASSUME_NONNULL_END


<|start_filename|>ObjC/DerivedSources/PDDOMDomain.h<|end_filename|>
//
//  PDDOMDomain.h
//  PonyDebuggerDerivedSources
//
//  Generated on 8/23/12
//
//  Licensed to Square, Inc. under one or more contributor license agreements.
//  See the LICENSE file distributed with this work for the terms under
//  which Square, Inc. licenses this file to you.
//

#import <Weaver/PDObject.h>
#import <Weaver/PDDebugger.h>
#import <Weaver/PDDynamicDebuggerDomain.h>

@class PDRuntimeRemoteObject;
@class PDDOMHighlightConfig;
@class PDDOMRGBA;
@class PDDOMNode;

@protocol PDDOMCommandDelegate;

// This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object that has an <code>id</code>. This <code>id</code> can be used to get additional information on the Node, resolve it into the JavaScript object wrapper, etc. It is important that client receives DOM events only for the nodes that are known to the client. Backend keeps track of the nodes that were sent to the client and never sends the same node twice. It is client's responsibility to collect information about the nodes that were sent to the client.<p>Note that <code>iframe</code> owner elements will return corresponding document elements as their child nodes.</p>
@interface PDDOMDomain : PDDynamicDebuggerDomain 

@property (nonatomic, weak) id <PDDOMCommandDelegate, PDCommandDelegate> delegate;

// Events

// Fired when <code>Document</code> has been totally updated. Node ids are no longer valid.
- (void)documentUpdated;

// Fired when backend wants to provide client with the missing DOM structure. This happens upon most of the calls requesting node ids.
// Param parentId: Parent node id to populate with children.
// Param nodes: Child nodes array.
- (void)setChildNodesWithParentId:(NSNumber *)parentId nodes:(NSArray *)nodes;

// Fired when <code>Element</code>'s attribute is modified.
// Param nodeId: Id of the node that has changed.
// Param name: Attribute name.
// Param value: Attribute value.
- (void)attributeModifiedWithNodeId:(NSNumber *)nodeId name:(NSString *)name value:(NSString *)value;

// Fired when <code>Element</code>'s attribute is removed.
// Param nodeId: Id of the node that has changed.
// Param name: A ttribute name.
- (void)attributeRemovedWithNodeId:(NSNumber *)nodeId name:(NSString *)name;

// Fired when <code>Element</code>'s inline style is modified via a CSS property modification.
// Param nodeIds: Ids of the nodes for which the inline styles have been invalidated.
- (void)inlineStyleInvalidatedWithNodeIds:(NSArray *)nodeIds;

// Mirrors <code>DOMCharacterDataModified</code> event.
// Param nodeId: Id of the node that has changed.
// Param characterData: New text value.
- (void)characterDataModifiedWithNodeId:(NSNumber *)nodeId characterData:(NSString *)characterData;

// Fired when <code>Container</code>'s child node count has changed.
// Param nodeId: Id of the node that has changed.
// Param childNodeCount: New node count.
- (void)childNodeCountUpdatedWithNodeId:(NSNumber *)nodeId childNodeCount:(NSNumber *)childNodeCount;

// Mirrors <code>DOMNodeInserted</code> event.
// Param parentNodeId: Id of the node that has changed.
// Param previousNodeId: If of the previous siblint.
// Param node: Inserted node data.
- (void)childNodeInsertedWithParentNodeId:(NSNumber *)parentNodeId previousNodeId:(NSNumber *)previousNodeId node:(PDDOMNode *)node;

// Mirrors <code>DOMNodeRemoved</code> event.
// Param parentNodeId: Parent id.
// Param nodeId: Id of the node that has been removed.
- (void)childNodeRemovedWithParentNodeId:(NSNumber *)parentNodeId nodeId:(NSNumber *)nodeId;

// Called when shadow root is pushed into the element.
// Param hostId: Host element id.
// Param root: Shadow root.
- (void)shadowRootPushedWithHostId:(NSNumber *)hostId root:(PDDOMNode *)root;

// Called when shadow root is popped from the element.
// Param hostId: Host element id.
// Param rootId: Shadow root id.
- (void)shadowRootPoppedWithHostId:(NSNumber *)hostId rootId:(NSNumber *)rootId;

@end

@protocol PDDOMCommandDelegate <PDCommandDelegate>
@optional

// Returns the root DOM node to the caller.
// Callback Param root: Resulting node.
- (void)domain:(PDDOMDomain *)domain getDocumentWithCallback:(void (^)(PDDOMNode *root, id error))callback;

// Requests that children of the node with given id are returned to the caller in form of <code>setChildNodes</code> events.
// Param nodeId: Id of the node to get children for.
- (void)domain:(PDDOMDomain *)domain requestChildNodesWithNodeId:(NSNumber *)nodeId callback:(void (^)(id error))callback;

// Executes <code>querySelector</code> on a given node.
// Param nodeId: Id of the node to query upon.
// Param selector: Selector string.
// Callback Param nodeId: Query selector result.
- (void)domain:(PDDOMDomain *)domain querySelectorWithNodeId:(NSNumber *)nodeId selector:(NSString *)selector callback:(void (^)(NSNumber *nodeId, id error))callback;

// Executes <code>querySelectorAll</code> on a given node.
// Param nodeId: Id of the node to query upon.
// Param selector: Selector string.
// Callback Param nodeIds: Query selector result.
- (void)domain:(PDDOMDomain *)domain querySelectorAllWithNodeId:(NSNumber *)nodeId selector:(NSString *)selector callback:(void (^)(NSArray *nodeIds, id error))callback;

// Sets node name for a node with given id.
// Param nodeId: Id of the node to set name for.
// Param name: New node's name.
// Callback Param nodeId: New node's id.
- (void)domain:(PDDOMDomain *)domain setNodeNameWithNodeId:(NSNumber *)nodeId name:(NSString *)name callback:(void (^)(NSNumber *nodeId, id error))callback;

// Sets node value for a node with given id.
// Param nodeId: Id of the node to set value for.
// Param value: New node's value.
- (void)domain:(PDDOMDomain *)domain setNodeValueWithNodeId:(NSNumber *)nodeId value:(NSString *)value callback:(void (^)(id error))callback;

// Removes node with given id.
// Param nodeId: Id of the node to remove.
- (void)domain:(PDDOMDomain *)domain removeNodeWithNodeId:(NSNumber *)nodeId callback:(void (^)(id error))callback;

// Sets attribute for an element with given id.
// Param nodeId: Id of the element to set attribute for.
// Param name: Attribute name.
// Param value: Attribute value.
- (void)domain:(PDDOMDomain *)domain setAttributeValueWithNodeId:(NSNumber *)nodeId name:(NSString *)name value:(NSString *)value callback:(void (^)(id error))callback;

// Sets attributes on element with given id. This method is useful when user edits some existing attribute value and types in several attribute name/value pairs.
// Param nodeId: Id of the element to set attributes for.
// Param text: Text with a number of attributes. Will parse this text using HTML parser.
// Param name: Attribute name to replace with new attributes derived from text in case text parsed successfully.
- (void)domain:(PDDOMDomain *)domain setAttributesAsTextWithNodeId:(NSNumber *)nodeId text:(NSString *)text name:(NSString *)name callback:(void (^)(id error))callback;

// Removes attribute with given name from an element with given id.
// Param nodeId: Id of the element to remove attribute from.
// Param name: Name of the attribute to remove.
- (void)domain:(PDDOMDomain *)domain removeAttributeWithNodeId:(NSNumber *)nodeId name:(NSString *)name callback:(void (^)(id error))callback;

// Returns event listeners relevant to the node.
// Param nodeId: Id of the node to get listeners for.
// Callback Param listeners: Array of relevant listeners.
- (void)domain:(PDDOMDomain *)domain getEventListenersForNodeWithNodeId:(NSNumber *)nodeId callback:(void (^)(NSArray *listeners, id error))callback;

// Returns node's HTML markup.
// Param nodeId: Id of the node to get markup for.
// Callback Param outerHTML: Outer HTML markup.
- (void)domain:(PDDOMDomain *)domain getOuterHTMLWithNodeId:(NSNumber *)nodeId callback:(void (^)(NSString *outerHTML, id error))callback;

// Sets node HTML markup, returns new node id.
// Param nodeId: Id of the node to set markup for.
// Param outerHTML: Outer HTML markup to set.
- (void)domain:(PDDOMDomain *)domain setOuterHTMLWithNodeId:(NSNumber *)nodeId outerHTML:(NSString *)outerHTML callback:(void (^)(id error))callback;

// Searches for a given string in the DOM tree. Use <code>getSearchResults</code> to access search results or <code>cancelSearch</code> to end this search session.
// Param query: Plain text or query selector or XPath search query.
// Callback Param searchId: Unique search session identifier.
// Callback Param resultCount: Number of search results.
- (void)domain:(PDDOMDomain *)domain performSearchWithQuery:(NSString *)query callback:(void (^)(NSString *searchId, NSNumber *resultCount, id error))callback;

// Returns search results from given <code>fromIndex</code> to given <code>toIndex</code> from the sarch with the given identifier.
// Param searchId: Unique search session identifier.
// Param fromIndex: Start index of the search result to be returned.
// Param toIndex: End index of the search result to be returned.
// Callback Param nodeIds: Ids of the search result nodes.
- (void)domain:(PDDOMDomain *)domain getSearchResultsWithSearchId:(NSString *)searchId fromIndex:(NSNumber *)fromIndex toIndex:(NSNumber *)toIndex callback:(void (^)(NSArray *nodeIds, id error))callback;

// Discards search results from the session with the given id. <code>getSearchResults</code> should no longer be called for that search.
// Param searchId: Unique search session identifier.
- (void)domain:(PDDOMDomain *)domain discardSearchResultsWithSearchId:(NSString *)searchId callback:(void (^)(id error))callback;

// Requests that the node is sent to the caller given the JavaScript node object reference. All nodes that form the path from the node to the root are also sent to the client as a series of <code>setChildNodes</code> notifications.
// Param objectId: JavaScript object id to convert into node.
// Callback Param nodeId: Node id for given object.
- (void)domain:(PDDOMDomain *)domain requestNodeWithObjectId:(NSString *)objectId callback:(void (^)(NSNumber *nodeId, id error))callback;

// Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted. Backend then generates 'inspect' command upon element selection.
// Param enabled: True to enable inspection mode, false to disable it.
// Param highlightConfig: A descriptor for the highlight appearance of hovered-over nodes. May be omitted if <code>enabled == false</code>.
- (void)domain:(PDDOMDomain *)domain setInspectModeEnabledWithEnabled:(NSNumber *)enabled highlightConfig:(PDDOMHighlightConfig *)highlightConfig callback:(void (^)(id error))callback;

// Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport.
// Param x: X coordinate
// Param y: Y coordinate
// Param width: Rectangle width
// Param height: Rectangle height
// Param color: The highlight fill color (default: transparent).
// Param outlineColor: The highlight outline color (default: transparent).
- (void)domain:(PDDOMDomain *)domain highlightRectWithX:(NSNumber *)x y:(NSNumber *)y width:(NSNumber *)width height:(NSNumber *)height color:(PDDOMRGBA *)color outlineColor:(PDDOMRGBA *)outlineColor callback:(void (^)(id error))callback;

// Highlights DOM node with given id.
// Param nodeId: Identifier of the node to highlight.
// Param highlightConfig: A descriptor for the highlight appearance.
- (void)domain:(PDDOMDomain *)domain highlightNodeWithNodeId:(NSNumber *)nodeId highlightConfig:(PDDOMHighlightConfig *)highlightConfig callback:(void (^)(id error))callback;

// Hides DOM node highlight.
- (void)domain:(PDDOMDomain *)domain hideHighlightWithCallback:(void (^)(id error))callback;

// Highlights owner element of the frame with given id.
// Param frameId: Identifier of the frame to highlight.
// Param contentColor: The content box highlight fill color (default: transparent).
// Param contentOutlineColor: The content box highlight outline color (default: transparent).
- (void)domain:(PDDOMDomain *)domain highlightFrameWithFrameId:(NSString *)frameId contentColor:(PDDOMRGBA *)contentColor contentOutlineColor:(PDDOMRGBA *)contentOutlineColor callback:(void (^)(id error))callback;

// Requests that the node is sent to the caller given its path. // FIXME, use XPath
// Param path: Path to node in the proprietary format.
// Callback Param nodeId: Id of the node for given path.
- (void)domain:(PDDOMDomain *)domain pushNodeByPathToFrontendWithPath:(NSString *)path callback:(void (^)(NSNumber *nodeId, id error))callback;

// Resolves JavaScript node object for given node id.
// Param nodeId: Id of the node to resolve.
// Param objectGroup: Symbolic group name that can be used to release multiple objects.
// Callback Param object: JavaScript object wrapper for given node.
- (void)domain:(PDDOMDomain *)domain resolveNodeWithNodeId:(NSNumber *)nodeId objectGroup:(NSString *)objectGroup callback:(void (^)(PDRuntimeRemoteObject *object, id error))callback;

// Returns attributes for the specified node.
// Param nodeId: Id of the node to retrieve attibutes for.
// Callback Param attributes: An interleaved array of node attribute names and values.
- (void)domain:(PDDOMDomain *)domain getAttributesWithNodeId:(NSNumber *)nodeId callback:(void (^)(NSArray *attributes, id error))callback;

// Moves node into the new container, places it before the given anchor.
// Param nodeId: Id of the node to drop.
// Param targetNodeId: Id of the element to drop into.
// Param insertBeforeNodeId: Drop node before given one.
// Callback Param nodeId: New id of the moved node.
- (void)domain:(PDDOMDomain *)domain moveToWithNodeId:(NSNumber *)nodeId targetNodeId:(NSNumber *)targetNodeId insertBeforeNodeId:(NSNumber *)insertBeforeNodeId callback:(void (^)(NSNumber *nodeId, id error))callback;

// Undoes the last performed action.
- (void)domain:(PDDOMDomain *)domain undoWithCallback:(void (^)(id error))callback;

// Re-does the last undone action.
- (void)domain:(PDDOMDomain *)domain redoWithCallback:(void (^)(id error))callback;

// Marks last undoable state.
- (void)domain:(PDDOMDomain *)domain markUndoableStateWithCallback:(void (^)(id error))callback;

@end

@interface PDDebugger (PDDOMDomain)

@property (nonatomic, readonly, strong) PDDOMDomain *DOMDomain;

@end


<|start_filename|>ObjC/Weaver/NSObject+WVCSSRuleMatchesProviding.h<|end_filename|>
//
//  NSObject+WVCSSRuleMatchesProviding.h
//  Texture
//
//  Copyright (c) 2017-present, Pinterest, Inc.  All rights reserved.
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@class PDCSSRuleMatch, PDCSSProperty;

@interface NSObject (PDCSSRuleMatchesProviding)

- (NSArray<PDCSSRuleMatch *> *)wv_generateCSSRuleMatchesWithObjectId:(NSNumber *)objectId;

- (nullable PDCSSRuleMatch *)wv_generateCSSRuleMatchWithName:(NSString *)ruleMatchName objectId:(NSNumber *)objectId;

- (void)wv_applyCSSProperty:(PDCSSProperty *)property withRuleMatchName:(NSString *)ruleMatchName;

@end

NS_ASSUME_NONNULL_END


<|start_filename|>ObjC/PonyDebugger/PDDebugger.h<|end_filename|>
//
//  PDDebugger.h
//  PonyDebugger
//
//  Created by <NAME> on 11/5/11.
//
//  Licensed to Square, Inc. under one or more contributor license agreements.
//  See the LICENSE file distributed with this work for the terms under
//  which Square, Inc. licenses this file to you.
//

#import <Foundation/Foundation.h>

#pragma mark - Definitions

@class SRWebSocket;
@class PDDomainController;

@interface PDDebugger : NSObject

+ (PDDebugger *)defaultInstance;

- (id)domainForName:(NSString *)name;
- (void)sendEventWithName:(NSString *)string parameters:(id)params;

#pragma mark Connect/Disconnect
- (void)autoConnect;
- (void)autoConnectToBonjourServiceNamed:(NSString*)serviceName;
- (void)connectToURL:(NSURL *)url;
- (BOOL)isConnected;
- (void)disconnect;

#pragma mark Custom Controller Support
- (void)addController:(PDDomainController *)controller;

@end


<|start_filename|>ObjC/Weaver/WVElementPropsDomainController.h<|end_filename|>
//
//  WVElementPropsDomainController.h
//  Texture
//
//  Copyright (c) 2017-present, Pinterest, Inc.  All rights reserved.
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//

#import <Weaver/PDCSSDomain.h>
#import <Weaver/PDDomainController.h>

@class WVElementPropsDomainController, WVDOMContext;

NS_ASSUME_NONNULL_BEGIN

@protocol WVElementPropsDomainControllerDataSource <NSObject>

- (WVDOMContext *)contextForElementPropsDomainController:(WVElementPropsDomainController *)controller;

@end

@interface WVElementPropsDomainController : PDDomainController <PDCSSCommandDelegate>

@property (nonatomic, strong) PDCSSDomain *domain;
@property (nonatomic, weak) id<WVElementPropsDomainControllerDataSource> dataSource;

+ (WVElementPropsDomainController *)defaultInstance;

@end

NS_ASSUME_NONNULL_END
